From: Francois-Xavier Le Bail Date: Thu, 18 Aug 2016 23:19:51 +0000 (+0200) Subject: Compile with '-Wused-but-marked-unused' in devel mode if supported X-Git-Tag: tcpdump-4.9.0-bp~192 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/b7cbdfc92d1bddcdf4a6a7ad8cfb004364d4d59c Compile with '-Wused-but-marked-unused' in devel mode if supported f.e. clang version 3.4 support this warning option. --- diff --git a/aclocal.m4 b/aclocal.m4 index ca78a02c..4fa5b80d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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() diff --git a/configure b/configure index a5c1026a..af19566a 100755 --- 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"