This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR c/53066 Wshadow should not warn for shadowing an extern function


As described by Linus here:
http://lkml.indiana.edu/hypermail/linux/kernel/0611.3/1020.html

Wshadow warns whenever any declaration shadows a global function
declaration. This is almost always noise, since most (always?) of the
time one cannot mistakenly replace a function by another variable. The
false positives are too common (Linus mentions using the name 'index'
when including string.h).

Interestingly, the C++ FE does not warn for this case, but it is not
very clear to me where this decision is taken.

Bootstrapped and tested.

OK?

2012-04-22  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53066
gcc/
	* c-decl.c (warn_if_shadowing): Do not warn for shadowed function
	declarations.
testsuite/
	* c-c++-common/wshadow.c: New.

Attachment: wshadow.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]