summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2018-07-07 09:00:29 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2018-08-21 18:53:46 +0200
commit014ed7c22f51463dfbf4566d9d2d7fe959a392ad (patch)
tree26aeca65934f5bcdd487eaa7e764911fb795b2a6 /m4
parent15ed9f87e3a1f91bd7b4a5291edf268b843e5987 (diff)
downloadcurl-014ed7c22f51463dfbf4566d9d2d7fe959a392ad.tar.gz
Enable more GCC warnings
This enables the following additional warnings: -Wold-style-definition -Warray-bounds=2 instead of the default 1 -Wformat=2, but only for GCC 4.8+ as Wno-format-nonliteral is not respected for older versions -Wunused-const-variable, which enables level 2 instead of the default 1 -Warray-bounds also in debug mode through -ftree-vrp -Wnull-dereference also in debug mode through -fdelete-null-pointer-checks Closes https://github.com/curl/curl/pull/2747
Diffstat (limited to 'm4')
-rw-r--r--m4/curl-compilers.m416
1 files changed, 15 insertions, 1 deletions
diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4
index 95afae426..b90e44d98 100644
--- a/m4/curl-compilers.m4
+++ b/m4/curl-compilers.m4
@@ -1012,6 +1012,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
dnl Only gcc 3.4 or later
if test "$compiler_num" -ge "304"; then
tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
+ tmp_CFLAGS="$tmp_CFLAGS -Wold-style-definition"
fi
#
dnl Only gcc 4.0 or later
@@ -1030,6 +1031,8 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body"
tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers"
tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla"
+ dnl required for -Warray-bounds, included in -Wall
+ tmp_CFLAGS="$tmp_CFLAGS -ftree-vrp"
fi
#
dnl Only gcc 4.5 or later
@@ -1045,12 +1048,23 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion"
fi
#
+ dnl only gcc 4.8 or later
+ if test "$compiler_num" -ge "408"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wformat=2"
+ fi
+ #
+ dnl Only gcc 5 or later
+ if test "$compiler_num" -ge "500"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Warray-bounds=2"
+ 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 -Wnull-dereference -fdelete-null-pointer-checks"
tmp_CFLAGS="$tmp_CFLAGS -Wduplicated-cond"
+ tmp_CFLAGS="$tmp_CFLAGS -Wunused-const-variable"
fi
#
dnl Only gcc 7 or later