From 9780e045073b1719a7a4c6cbe00e4aa7525bd180 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 22 Mar 2016 09:41:16 +0000 Subject: [PATCH] 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. --- bfd/ChangeLog | 6 ++++++ bfd/configure | 20 +++++++++++++++++++- bfd/warning.m4 | 9 ++++++++- binutils/ChangeLog | 4 ++++ binutils/configure | 20 +++++++++++++++++++- gas/ChangeLog | 4 ++++ gas/configure | 20 +++++++++++++++++++- gold/ChangeLog | 4 ++++ gold/configure | 20 +++++++++++++++++++- gprof/ChangeLog | 4 ++++ gprof/configure | 20 +++++++++++++++++++- ld/ChangeLog | 4 ++++ ld/configure | 20 +++++++++++++++++++- opcodes/ChangeLog | 4 ++++ opcodes/configure | 20 +++++++++++++++++++- 15 files changed, 171 insertions(+), 8 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ffafbf631f6..6e393a3216b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2016-03-22 Nick Clifton + + * warning.m4 (GCC_WARN_CFLAGS): Only add -Wstack-usage if using a + sufficiently recent version of GCC. + * configure: Regenerate. + 2016-03-22 Alan Modra PR 19851 diff --git a/bfd/configure b/bfd/configure index de5f36d9e0b..d03b9962bde 100755 --- a/bfd/configure +++ b/bfd/configure @@ -12223,7 +12223,10 @@ fi # 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. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ __GNUC__ @@ -12237,6 +12240,21 @@ fi rm -f conftest* +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + + + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : enableval=$enable_werror; case "${enableval}" in @@ -12264,7 +12282,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 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 diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 805c6d81385..0694a58c549 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2016-03-22 Nick Clifton + + * configure: Regenerate. + 2016-03-21 Andrew Burgess * readelf.c (decode_ARC_machine_flags): Handle nps400. diff --git a/binutils/configure b/binutils/configure index a36b30b1ba7..6ff47084b5c 100755 --- a/binutils/configure +++ b/binutils/configure @@ -11941,7 +11941,10 @@ _ACEOF # 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. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ __GNUC__ @@ -11955,6 +11958,21 @@ fi rm -f conftest* +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + + + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : enableval=$enable_werror; case "${enableval}" in @@ -11982,7 +12000,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 diff --git a/gas/ChangeLog b/gas/ChangeLog index 25c0ee6f24c..43e467e89c4 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2016-03-22 Nick Clifton + + * configure: Regenerate. + 2016-03-21 Andrew Burgess * testsuite/gas/arc/nps400-0.d: New file. diff --git a/gas/configure b/gas/configure index 6c4327929cb..11e6ed436a1 100755 --- a/gas/configure +++ b/gas/configure @@ -11714,7 +11714,10 @@ using_cgen=no # 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. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ __GNUC__ @@ -11728,6 +11731,21 @@ fi rm -f conftest* +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + + + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : enableval=$enable_werror; case "${enableval}" in @@ -11755,7 +11773,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 diff --git a/gold/ChangeLog b/gold/ChangeLog index 0052c0bd4c8..c3b4577d022 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,7 @@ +2016-03-22 Nick Clifton + + * configure: Regenerate. + 2016-03-21 Cary Coutant PR gold/19842 diff --git a/gold/configure b/gold/configure index 811a3704cae..7fe771c60d1 100755 --- a/gold/configure +++ b/gold/configure @@ -6687,7 +6687,10 @@ fi # 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. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ __GNUC__ @@ -6701,6 +6704,21 @@ fi rm -f conftest* +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + + + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : enableval=$enable_werror; case "${enableval}" in @@ -6728,7 +6746,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 diff --git a/gprof/ChangeLog b/gprof/ChangeLog index a23abcc445a..14b430d26a3 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,7 @@ +2016-03-22 Nick Clifton + + * configure: Regenerate. + 2016-01-17 Alan Modra * configure: Regenerate. diff --git a/gprof/configure b/gprof/configure index 79813e0ec87..77bfe7febfb 100755 --- a/gprof/configure +++ b/gprof/configure @@ -12097,7 +12097,10 @@ fi # 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. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ __GNUC__ @@ -12111,6 +12114,21 @@ fi rm -f conftest* +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + + + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : enableval=$enable_werror; case "${enableval}" in @@ -12138,7 +12156,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 diff --git a/ld/ChangeLog b/ld/ChangeLog index eda1986bbed..92a71b71f62 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,7 @@ +2016-03-22 Nick Clifton + + * configure: Regenerate. + 2016-03-21 Nick Clifton * emultempl/msp430.em: Replace use of alloca with call to xmalloc. diff --git a/ld/configure b/ld/configure index 4d8f237664e..572faa7d18f 100755 --- a/ld/configure +++ b/ld/configure @@ -15540,7 +15540,10 @@ fi # 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. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ __GNUC__ @@ -15554,6 +15557,21 @@ fi rm -f conftest* +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + + + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : enableval=$enable_werror; case "${enableval}" in @@ -15581,7 +15599,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 diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 811450dfde9..b0fec5e4a52 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2016-03-22 Nick Clifton + + * configure: Regenerate. + 2016-03-21 Andrew Burgess * arc-nps400-tbl.h: New file. diff --git a/opcodes/configure b/opcodes/configure index a130b847936..da03f50817c 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -11504,7 +11504,10 @@ fi # 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. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ __GNUC__ @@ -11518,6 +11521,21 @@ fi rm -f conftest* +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + + + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : enableval=$enable_werror; case "${enableval}" in @@ -11545,7 +11563,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 -- 2.30.2