This is the mail archive of the mailing list for the elfutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] configure: Add explicit checks for all GNU99 extensions used.

Some compilers (clang) claim to support -std=gnu99 but don't actually
implement all extensions we use in the code. Producing really hard to
parse errors. Add explicit checks for some of the other language
extensions we use, Nested Functions and Arrays of Variable Length,
to the configure check to catch such issues early.

Signed-off-by: Mark Wielaard <>
 ChangeLog    |  5 +++++ | 29 ++++++++++++++++++++++++++---
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5c8e1c2..9a0a82d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-14  Mark Wielaard  <>
+	* (ac_cv_c99): Add explicit checks for all GNU99
+	extensions used.
 2015-03-13  Mark Wielaard  <>
 	* (ac_cv_c99): Add explicit return.
diff --git a/ b/
index c4b818d..ed2c964 100644
--- a/
+++ b/
@@ -79,15 +79,38 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 AC_CHECK_TOOL([READELF], [readelf])
 AC_CHECK_TOOL([NM], [nm])
-AC_CACHE_CHECK([for gcc with C99 support], ac_cv_c99, [dnl
+# We use -std=gnu99 but have explicit checks for some language constructs
+# and GNU extensions since some compilers claim GNU99 support, but don't
+# really support all language extensions. In particular we need
+# Mixed Declarations and Code
+# Nested Functions
+# Arrays of Variable Length
+AC_CACHE_CHECK([for gcc with GNU99 support], ac_cv_c99, [dnl
 CFLAGS="$CFLAGS -std=gnu99"
-int foo (int a) { for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; return s;}])],
+int foo (int a)
+  for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; return s;
+double bar (double a, double b)
+  double square (double z) { return z * z; }
+  return square (a) + square (b);
+void baz (int n)
+  struct S { int x[[n]]; };
 		  ac_cv_c99=yes, ac_cv_c99=no)
 AS_IF([test "x$ac_cv_c99" != xyes],
-      AC_MSG_ERROR([gcc with C99 support required]))
+      AC_MSG_ERROR([gcc with GNU99 support required]))
 AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
 # Use the same flags that we use for our DSOs, so the test is representative.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]