From a19fefb0706f939d2df7a76704ee549fecb1c4fd Mon Sep 17 00:00:00 2001 From: Eric Gallager Date: Mon, 12 Feb 2018 01:42:47 -0500 Subject: build: add picky compiler warning flags for gcc 6 and 7 --- m4/curl-compilers.m4 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'm4') 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. -- cgit v1.2.3