]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Compile with '-Wused-but-marked-unused' in devel mode if supported
authorFrancois-Xavier Le Bail <[email protected]>
Thu, 18 Aug 2016 23:19:51 +0000 (01:19 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 18 Aug 2016 23:30:14 +0000 (01:30 +0200)
f.e. clang version 3.4 support this warning option.

aclocal.m4
configure

index ca78a02c98e8b247898ffbdc1cf63942fb31476f..4fa5b80dac48c937ac6e6ebccda7928936d0d32c 100644 (file)
@@ -994,6 +994,7 @@ AC_DEFUN(AC_LBL_DEVEL,
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wdeclaration-after-statement)
                    AC_LBL_CHECK_COMPILER_OPT($1, -pedantic)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wold-style-definition)
+                   AC_LBL_CHECK_COMPILER_OPT($1, -Wused-but-marked-unused)
                    AC_LBL_CHECK_COMPILER_OPT($1, -W)
            fi
            AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT()
index a5c1026a69e3192e0130e0d620e363c6d48a8338..af19566ad62f4112d58223be2588c0dc78dd5719 100755 (executable)
--- a/configure
+++ b/configure
@@ -7660,6 +7660,49 @@ 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
+
+
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -W option" >&5
 $as_echo_n "checking whether the compiler supports the -W option... " >&6; }
        save_CFLAGS="$CFLAGS"