From a9d1924d22a91e99390f58b55b85108443c74102 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 7 Apr 2010 07:19:00 +0000 Subject: [PATCH] * warning.m4 (GCC_WARN_CFLAGS): Only add -Wshadow for gcc-4 and above. * configure: Regenerate. --- bfd/ChangeLog | 5 +++++ bfd/configure | 16 ++++++++++++++-- bfd/warning.m4 | 5 +++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1d4fecb8f..a4548e02e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2010-04-07 Alan Modra + + * warning.m4 (GCC_WARN_CFLAGS): Only add -Wshadow for gcc-4 and above. + * configure: Regenerate. + 2010-04-06 H.J. Lu PR ld/11434 diff --git a/bfd/configure b/bfd/configure index 0f73da3c2..f4aba27fe 100755 --- a/bfd/configure +++ b/bfd/configure @@ -12128,7 +12128,19 @@ fi -GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow" +GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-3]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow" +fi +rm -f conftest* + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : @@ -12140,7 +12152,7 @@ if test "${enable_werror+set}" = set; then : fi -# Enable -Wno-format by default when using gcc on mingw +# Disable -Wformat by default when using gcc on mingw case "${host}" in *-*-mingw32*) if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then diff --git a/bfd/warning.m4 b/bfd/warning.m4 index b4a2f48f8..6b846bf4e 100644 --- a/bfd/warning.m4 +++ b/bfd/warning.m4 @@ -1,7 +1,8 @@ dnl Common configure.in fragment AC_DEFUN([AM_BINUTILS_WARNINGS],[ -GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow" +GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow") AC_ARG_ENABLE(werror, [ --enable-werror treat compile warnings as errors], @@ -11,7 +12,7 @@ AC_ARG_ENABLE(werror, *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;; esac]) -# Enable -Wno-format by default when using gcc on mingw +# Disable -Wformat by default when using gcc on mingw case "${host}" in *-*-mingw32*) if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then -- 2.11.4.GIT