[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Use -Wstrict-overflow=2 on gcc5+.



commit ad16c5528663489000ee3a7454a9bbff2e41f7f0
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon May 30 14:49:50 2016 -0400

    Use -Wstrict-overflow=2 on gcc5+.
---
 configure.ac | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index f21d9de..abed17f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1701,7 +1701,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
 #if !defined(__GNUC__) || (__GNUC__ < 6)
 #error
-#endif])], have_gcc6=yes, have_gcc5=no)
+#endif])], have_gcc6=yes, have_gcc6=no)
 
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Wshorten-64-to-32"
@@ -1734,9 +1734,13 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
   if test "x$have_gcc42" = "xyes"; then
     # These warnings break gcc 4.0.2 and work on gcc 4.2
     # XXXX020 See if any of these work with earlier versions.
-    CFLAGS="$CFLAGS -Waddress -Wmissing-noreturn -Wstrict-overflow=1"
+    CFLAGS="$CFLAGS -Waddress -Wmissing-noreturn"
+  fi
 
+  if test "x$have_gcc42" = "xyes" && test "x$have_gcc5" != "xyes"; then
+    CFLAGS="$CFLAGS -Wstrict-overflow=1"
     # We used to use -Wstrict-overflow=5, but that breaks us heavily under 4.3.
+    # Save it for GCC 5 where they improved the testing.
   fi
 
   if test "x$have_gcc42" = "xyes" && test "x$have_clang" = "xno"; then
@@ -1775,6 +1779,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
 
   if test "x$have_gcc5" = "xyes"; then
      CFLAGS="$CFLAGS -Wc99-c11-compat -Wshift-count-negative -Wshift-count-overflow -Wsizeof-array-argument -Wswitch-bool"
+    CFLAGS="$CFLAGS -Wstrict-overflow=2"
   fi
 
  if test "x$have_gcc6" = "xyes"; then



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits