build: add picky compiler warning flags for gcc 6 and 7

This commit is contained in:
Eric Gallager 2018-02-12 01:42:47 -05:00 committed by Daniel Stenberg
parent 4e884615d1
commit a19fefb070
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 25 additions and 5 deletions

View file

@ -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.