[tor-commits] [tor/master] Only use -Wlogical-op with GCC 4.6 and later
nickm at torproject.org
nickm at torproject.org
Thu Oct 31 15:58:36 UTC 2013
commit 4c6081910d4c0f5848c6ebfba65798a0985111bb
Author: Nick Mathewson <nickm at torproject.org>
Date: Thu Oct 31 11:57:50 2013 -0400
Only use -Wlogical-op with GCC 4.6 and later
It generates an apparently spurious warning with gcc 4.4 in debian;
we haven't tested 4.5.
---
configure.ac | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 974ff27..536a2b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1446,6 +1446,12 @@ if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xy
#error
#endif])], have_gcc43=yes, have_gcc43=no)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
+#if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
+#error
+#endif])], have_gcc46=yes, have_gcc46=no)
+
+
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wshorten-64-to-32"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], have_shorten64_flag=yes,
@@ -1494,13 +1500,21 @@ if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xy
if test x$have_gcc43 = xyes ; then
# These warnings break gcc 4.2 and work on gcc 4.3
# XXXX020 See if any of these work with earlier versions.
- CFLAGS="$CFLAGS -Wextra -Warray-bounds -Wlogical-op"
+ CFLAGS="$CFLAGS -Wextra -Warray-bounds"
+ fi
+
+ if test x$have_gcc46 = xyes ; then
+ # This warning was added in gcc 4.3, but it appears to generate
+ # spurious warnings in gcc 4.4. I don't know if it works in 4.5.
+ CFLAGS="$CFLAGS -Wlogical-op"
fi
if test x$have_shorten64_flag = xyes ; then
CFLAGS="$CFLAGS -Wshorten-64-to-32"
fi
+
+
##This will break the world on some 64-bit architectures
# CFLAGS="$CFLAGS -Winline"
fi
More information about the tor-commits
mailing list