]> granicus.if.org Git - libevent/commitdiff
Use -Wlogical-op on gcc 4.5 or higher
authorNick Mathewson <nickm@torproject.org>
Tue, 18 May 2010 18:05:01 +0000 (14:05 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 18 May 2010 18:05:01 +0000 (14:05 -0400)
It exposed one bug for us (see 8c3452bcb294e07888), and might
prevent more.

configure.in

index 40b95d8c945c7d1dcbc2da74d28b0e9a94cf5dca..a1fc67b8e95f4ba7d6950aaab5c1c833c007d61b 100644 (file)
@@ -565,6 +565,11 @@ if test x$enable_gcc_warnings = xyes; then
 #error
 #endif]), have_gcc42=yes, have_gcc42=no)
 
+  AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [
+#if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+#error
+#endif]), have_gcc45=yes, have_gcc45=no)
+
   CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror"
   CFLAGS="$CFLAGS -Wno-unused-parameter -Wno-sign-compare -Wstrict-aliasing"
 
@@ -579,6 +584,10 @@ if test x$enable_gcc_warnings = xyes; then
     CFLAGS="$CFLAGS -Waddress -Wnormalized=id -Woverride-init"
   fi
 
+  if test x$have_gcc45 = xyes ; then
+    # These warnings work on gcc 4.5
+    CFLAGS="$CFLAGS -Wlogical-op"
+  fi
 ##This will break the world on some 64-bit architectures
 # CFLAGS="$CFLAGS -Winline"