]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Compile with '-Wsign-compare' in devel mode if supported
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 29 Oct 2018 21:28:53 +0000 (22:28 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 29 Oct 2018 21:28:53 +0000 (22:28 +0100)
aclocal.m4
configure

index bb322371b722b519eba31e735df46520755b90cb..2b45203d317df87801ab18cf0e1f3f5ba2f86c35 100644 (file)
@@ -879,6 +879,7 @@ AC_DEFUN(AC_LBL_DEVEL,
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wpedantic)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wpointer-arith)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wshadow)
+                   AC_LBL_CHECK_COMPILER_OPT($1, -Wsign-compare)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wstrict-prototypes)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wunreachable-code-return)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wused-but-marked-unused)
index b76db5207c21eb9321f370ff49998bfbef5a4cdc..25ffe864c8ae143cbe7ca81cdb9f7deed9d409cc 100755 (executable)
--- a/configure
+++ b/configure
@@ -7135,6 +7135,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 -Wsign-compare option" >&5
+$as_echo_n "checking whether the compiler supports the -Wsign-compare option... " >&6; }
+       save_CFLAGS="$CFLAGS"
+       if expr "x-Wsign-compare" : "x-W.*" >/dev/null
+       then
+           CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wsign-compare"
+       elif expr "x-Wsign-compare" : "x-f.*" >/dev/null
+       then
+           CFLAGS="$CFLAGS -Werror -Wsign-compare"
+       elif expr "x-Wsign-compare" : "x-m.*" >/dev/null
+       then
+           CFLAGS="$CFLAGS -Werror -Wsign-compare"
+       else
+           CFLAGS="$CFLAGS -Wsign-compare"
+       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 -Wsign-compare"
+
+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 -Wstrict-prototypes option" >&5
 $as_echo_n "checking whether the compiler supports the -Wstrict-prototypes option... " >&6; }
        save_CFLAGS="$CFLAGS"