This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
-Wshadow and older versions of gcc
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 29 Mar 2010 12:50:20 +1030
- Subject: -Wshadow and older versions of gcc
I've had reason to build recent binutils on older systems, and often
run into build errors due to -Wshadow. Other people do too. eg.
http://sourceware.org/ml/binutils/2010-01/msg00334.html
I propose we turn off -Wshadow unless using gcc-4. Comments?
* warning.m4 (GCC_WARN_CFLAGS): Only add -Wshadow for gcc-4 and above.
plus of course regenerate configure files that use bfd/warning.m4.
Index: bfd/warning.m4
===================================================================
RCS file: /cvs/src/src/bfd/warning.m4,v
retrieving revision 1.5
diff -u -p -r1.5 warning.m4
--- bfd/warning.m4 11 Dec 2009 13:42:04 -0000 1.5
+++ bfd/warning.m4 29 Mar 2010 02:15:44 -0000
@@ -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],
--
Alan Modra
Australia Development Lab, IBM