]> granicus.if.org Git - gc/commitdiff
Report gcc/clang pedantic warnings (configure)
authorIvan Maidanski <ivmai@mail.ru>
Tue, 22 Nov 2016 12:18:36 +0000 (15:18 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 22 Nov 2016 12:19:32 +0000 (15:19 +0300)
* configure.ac [GCC] (WPEDANTIC): New variable (set to
"-Wpedantic -Wno-long-long" if supported by the compiler).
* configure.ac [GCC] (CFLAGS): Add $WPEDANTIC.

configure.ac

index bf03f454a7b8c3939694cc3fd29d8e70bd8ed95c..af4a45ec8e445ed6551f0a5c441ca1d2c7f9231e 100644 (file)
@@ -407,7 +407,17 @@ if test "$GCC" = yes; then
   CFLAGS="$old_CFLAGS"
   AC_MSG_RESULT($ac_cv_cc_wextra)
   AS_IF([test "$ac_cv_cc_wextra" = yes], [WEXTRA="-Wextra"], [WEXTRA="-W"])
-  CFLAGS="-Wall $WEXTRA $CFLAGS"
+  AC_MSG_CHECKING(for gcc -Wpedantic)
+  CFLAGS="-Wpedantic -Wno-long-long $CFLAGS"
+  AC_TRY_COMPILE([],[
+    extern int quiet;
+  ], [ac_cv_cc_pedantic=yes], [ac_cv_cc_pedantic=no])
+  CFLAGS="$old_CFLAGS"
+  AC_MSG_RESULT($ac_cv_cc_pedantic)
+  WPEDANTIC=
+  AS_IF([test "$ac_cv_cc_pedantic" = yes],
+        [WPEDANTIC="-Wpedantic -Wno-long-long"])
+  CFLAGS="-Wall $WEXTRA $WPEDANTIC $CFLAGS"
 fi
 
 AC_MSG_CHECKING(for xlc)