]> The Tcpdump Group git mirrors - libpcap/commitdiff
Compile with '-Wused-but-marked-unused' in devel mode if supported
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 19 Aug 2016 06:13:12 +0000 (08:13 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 19 Aug 2016 06:13:12 +0000 (08:13 +0200)
f.e. clang version 3.4 support this warning option.

aclocal.m4
configure

index bbed5be179f2d86adb30efc6a2abc4fbc8a16789..83f5761f0b13c1a941d8bb156cd75d4d609040fc 100644 (file)
@@ -931,6 +931,7 @@ AC_DEFUN(AC_LBL_DEVEL,
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wstrict-prototypes)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wshadow)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wdeclaration-after-statement)
+                   AC_LBL_CHECK_COMPILER_OPT($1, -Wused-but-marked-unused)
            fi
            AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT()
            #
index a317804f97d8e8db81f91c8d20db412b64da0cee..94436fbb557591cb97dc0e975ba975a0b2df5f35 100755 (executable)
--- a/configure
+++ b/configure
@@ -8027,6 +8027,49 @@ else
 $as_echo "no" >&6; }
                CFLAGS="$save_CFLAGS"
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wused-but-marked-unused option" >&5
+$as_echo_n "checking whether the compiler supports the -Wused-but-marked-unused option... " >&6; }
+       save_CFLAGS="$CFLAGS"
+       if expr "x-Wused-but-marked-unused" : "x-W.*" >/dev/null
+       then
+           CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wused-but-marked-unused"
+       elif expr "x-Wused-but-marked-unused" : "x-f.*" >/dev/null
+       then
+           CFLAGS="$CFLAGS -Werror -Wused-but-marked-unused"
+       elif expr "x-Wused-but-marked-unused" : "x-m.*" >/dev/null
+       then
+           CFLAGS="$CFLAGS -Werror -Wused-but-marked-unused"
+       else
+           CFLAGS="$CFLAGS -Wused-but-marked-unused"
+       fi
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+return 0
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+               CFLAGS="$save_CFLAGS"
+               V_CCOPT="$V_CCOPT -Wused-but-marked-unused"
+
+else
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+               CFLAGS="$save_CFLAGS"
+
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext