[Telepathy-commits] [telepathy-mission-control/master] Import even more pedantic compiler flags from tp-glib

Will Thompson will.thompson at collabora.co.uk
Tue Dec 16 09:28:29 PST 2008


---
 configure.ac |   37 ++++++++++++++++++++++++++-----------
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0365d83..ec76b74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,27 +15,42 @@ AM_PROG_MKDIR_P
 
 AC_HEADER_STDC
 
-AM_CFLAGS="$CFLAGS -Wall -fno-strict-aliasing -ansi -DDMALLOC"
-
 # Recommended CFLAGS for pedantic checking, from telepathy-glib
 
-AS_COMPILER_FLAG([-Wdeclaration-after-statement],
-  [AM_CFLAGS="$AM_CFLAGS -Wdeclaration-after-statement"])
-AS_COMPILER_FLAG([-Wstrict-prototypes],
-  [AM_CFLAGS="$AM_CFLAGS -Wstrict-prototypes"])
-AS_COMPILER_FLAG([-Wmissing-prototypes],
-  [AM_CFLAGS="$AM_CFLAGS -Wmissing-prototypes"])
-AS_COMPILER_FLAG([-Wmissing-declarations],
-  [AM_CFLAGS="$AM_CFLAGS -Wmissing-declarations"])
+AS_COMPILER_FLAG(-Wall, ERROR_CFLAGS="-Wall", ERROR_CFLAGS="")
 
 AC_ARG_ENABLE([Werror],
   AC_HELP_STRING([--enable-Werror],[compile with -Werror]),
   [werror=$enableval], [werror=no])
 
 if test "$werror" = yes; then
-  AS_COMPILER_FLAG([-Werror], [AM_CFLAGS="$AM_CFLAGS -Werror"])
+  AS_COMPILER_FLAG([-Werror], [ERROR_CFLAGS="$ERROR_CFLAGS -Werror"])
+fi
+
+AS_COMPILER_FLAG(-Wextra, wextra=yes, wextra=no)
+AS_COMPILER_FLAG(-Wno-missing-field-initializers,
+        wno_missing_field_initializers=yes,
+        wno_missing_field_initializers=no)
+AS_COMPILER_FLAG(-Wno-unused-parameter,
+        wno_unused_parameter=yes,
+        wno_unused_parameter=no)
+
+if test x$werror = xyes; then
+    ERROR_CFLAGS="$ERROR_CFLAGS -Werror"
+fi
+if test x$wextra = xyes -a \
+    x$wno_missing_field_initializers = xyes -a \
+    x$wno_unused_parameter = xyes; then
+    ERROR_CFLAGS="$ERROR_CFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter"
 fi
 
+AS_COMPILER_FLAG(-Wdeclaration-after-statement, ERROR_CFLAGS="$ERROR_CFLAGS -Wdeclaration-after-statement")
+AS_COMPILER_FLAG(-Wshadow, ERROR_CFLAGS="$ERROR_CFLAGS -Wshadow")
+AS_COMPILER_FLAG(-Wstrict-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wstrict-prototypes")
+AS_COMPILER_FLAG(-Wmissing-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-prototypes")
+AS_COMPILER_FLAG(-Wmissing-declarations, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-declarations")
+
+AM_CFLAGS="$CFLAGS -fno-strict-aliasing -ansi -DDMALLOC $ERROR_CFLAGS"
 AC_SUBST([AM_CFLAGS])
 
 define([EXPAND_VARIABLE],
-- 
1.5.6.5




More information about the Telepathy-commits mailing list