summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorEric Gallager <egall@gwmail.gwu.edu>2018-02-12 01:42:47 -0500
committerDaniel Stenberg <daniel@haxx.se>2018-04-07 11:18:58 +0200
commita19fefb0706f939d2df7a76704ee549fecb1c4fd (patch)
tree46ffddbc152bbf3753e132af5997df91b146ba3c /m4
parent4e884615d1702914c1ec4c182f94eb9b8efc7a16 (diff)
downloadcurl-a19fefb0706f939d2df7a76704ee549fecb1c4fd.tar.gz
build: add picky compiler warning flags for gcc 6 and 7
Diffstat (limited to 'm4')
-rw-r--r--m4/curl-compilers.m417
1 files changed, 17 insertions, 0 deletions
diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4
index 422946e26..20bdbd706 100644
--- a/m4/curl-compilers.m4
+++ b/m4/curl-compilers.m4
@@ -1044,6 +1044,23 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion"
fi
#
+ dnl Only gcc 6 or later
+ if test "$compiler_num" -ge "600"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wshift-negative-value"
+ tmp_CFLAGS="$tmp_CFLAGS -Wshift-overflow=2"
+ tmp_CFLAGS="$tmp_CFLAGS -Wnull-dereference"
+ tmp_CFLAGS="$tmp_CFLAGS -Wduplicated-cond"
+ fi
+ #
+ dnl Only gcc 7 or later
+ if test "$compiler_num" -ge "700"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wduplicated-branches"
+ tmp_CFLAGS="$tmp_CFLAGS -Wrestrict"
+ tmp_CFLAGS="$tmp_CFLAGS -Walloc-zero"
+ tmp_CFLAGS="$tmp_CFLAGS -Wformat-overflow=2"
+ tmp_CFLAGS="$tmp_CFLAGS -Wformat-truncation=2"
+ fi
+ #
fi
#
dnl Do not issue warnings for code in system include paths.