]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Compile with -Wcast-qual.
authorGuy Harris <[email protected]>
Mon, 27 Apr 2015 01:50:49 +0000 (18:50 -0700)
committerGuy Harris <[email protected]>
Mon, 27 Apr 2015 01:50:49 +0000 (18:50 -0700)
That let me find what might have been the bulk of the 579(!) instances
of "Deconst" reported in

    http://www.cl.cam.ac.uk/~dc552/papers/asplos15-memory-safe-c.pdf

and, hopefully, will prevent more from creeping in.

There are some remaining ones - and they represent attempts to overwrite
the packet bytes handed to tcpdump by libpcap, which could well *fail*
with, for example, memory-mapped capture mechanisms!

aclocal.m4
configure

index 285000d902cd0d2594fa702fa1ea04e4ebf83810..223f9384a19caf2f3c4ec141599df9c8b169942b 100644 (file)
@@ -947,6 +947,7 @@ AC_DEFUN(AC_LBL_DEVEL,
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wstrict-prototypes)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wwrite-strings)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wpointer-arith)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wstrict-prototypes)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wwrite-strings)
                    AC_LBL_CHECK_COMPILER_OPT($1, -Wpointer-arith)
+                   AC_LBL_CHECK_COMPILER_OPT($1, -Wcast-qual)
                    AC_LBL_CHECK_COMPILER_OPT($1, -W)
            fi
            AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT()
                    AC_LBL_CHECK_COMPILER_OPT($1, -W)
            fi
            AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT()
index 43b3068aab43eef0a043c7237ffd4f83f6bc25e3..268d487a9818e2b017ef729e4ad6eff2a80de7c7 100755 (executable)
--- a/configure
+++ b/configure
@@ -7811,6 +7811,38 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wcast-qual option" >&5
+$as_echo_n "checking whether the compiler supports the -Wcast-qual option... " >&6; }
+       save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors -Wcast-qual"
+       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 -Wcast-qual"
+
+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"
        { $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"