From d14bb926b42a91a1ac48c10b41cfe3a96e8408b9 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 18 May 2010 14:05:01 -0400 Subject: [PATCH] Use -Wlogical-op on gcc 4.5 or higher It exposed one bug for us (see 8c3452bcb294e07888), and might prevent more. --- configure.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configure.in b/configure.in index 40b95d8c..a1fc67b8 100644 --- a/configure.in +++ b/configure.in @@ -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" -- 2.40.0