]> 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>
Sun, 27 Nov 2016 07:13:46 +0000 (10:13 +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 73da0c98996850653a263e1a94b913e3f442f8bb..1c4e2a4aa92753c3f1498c087eab5a7eae537e58 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)