summaryrefslogtreecommitdiff
path: root/bfd/warning.m4
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-03-22 09:41:16 +0000
committerNick Clifton <nickc@redhat.com>2016-03-22 09:41:16 +0000
commit9780e045073b1719a7a4c6cbe00e4aa7525bd180 (patch)
tree3def78d7a5256187ded65f646443c1d13101d0a3 /bfd/warning.m4
parent648c5cbbf34dcbf96bde7e07b14868777fd5d635 (diff)
downloadbinutils-gdb-9780e045073b1719a7a4c6cbe00e4aa7525bd180.tar.gz
Add -Wstack-usage to the gcc warning flags list, but only if using a sufficiently recent version of gcc.
bfd * warning.m4 (GCC_WARN_CFLAGS): Only add -Wstack-usage if using a sufficiently recent version of GCC. * configure: Regenerate. others * configure: Regenerate.
Diffstat (limited to 'bfd/warning.m4')
-rw-r--r--bfd/warning.m49
1 files changed, 8 insertions, 1 deletions
diff --git a/bfd/warning.m4 b/bfd/warning.m4
index 0e838f6951c..028d0792027 100644
--- a/bfd/warning.m4
+++ b/bfd/warning.m4
@@ -21,9 +21,16 @@ AC_DEFUN([AM_BINUTILS_WARNINGS],[
# Set the 'development' global.
. $srcdir/../bfd/development.sh
+# Default set of GCC warnings to enable.
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+
+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
+AC_EGREP_CPP([^[0-4]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144")
+
+
AC_ARG_ENABLE(werror,
[ --enable-werror treat compile warnings as errors],
[case "${enableval}" in
@@ -49,7 +56,7 @@ fi
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror -Wstack-usage=262144"
+ GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
NO_WERROR="-Wno-error"
fi