summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-05-30 14:49:50 -0400
committerNick Mathewson <nickm@torproject.org>2016-06-11 10:11:53 -0400
commitad16c5528663489000ee3a7454a9bbff2e41f7f0 (patch)
tree1087aa7c816841f36eeaf53d411e1826a1b9d1f4 /configure.ac
parent4caed2424a449712c8ac267d521563d31536aa6a (diff)
downloadtor-ad16c5528663489000ee3a7454a9bbff2e41f7f0.tar.gz
tor-ad16c5528663489000ee3a7454a9bbff2e41f7f0.zip
Use -Wstrict-overflow=2 on gcc5+.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac9
1 files changed, 7 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index f21d9de532..abed17f096 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