This is the mail archive of the gcc-bugs@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]

Re: annoying -Wshadow warning


Joseph S. Myers writes:
 > On Tue, 9 Jul 2002, Doug Evans wrote:
 > 
 > > Is there any usefulness to this particular situation of the -Wshadow warning?
 > > 
 > > foo.c:
 > > void debug (void);
 > > void foo (char* debug);
 > > 
 > > casey:~$ gcc-3.0.4 -c -Wshadow foo.c
 > > foo.c:2: warning: declaration of `debug' shadows global declaration
 > > casey:~$ 
 > > 
 > > Print the warning at the definition site of foo, yes!
 > > But at the prototype site?
 > 
 > In general a parameter name could be used in a VLA declaration of another
 > parameter in the function prototype scope - in that special case, where
 > the parameter declared is used within the function prototype scope, the
 > warning should be kept, though in the normal case where it is not used the
 > warning is fairly useless.

It's worse than useless.
It can vastly reduce the signal/noise ratio of gcc output.
It bubbles up parameter names in header files into the global namespace.

Suppose I have an app that uses two separate libraries and one
library happens to declare a function with a parameter whose name
is that of a function in the other library [in my case bfd and rscheme].

Imposing a certain ordering of header file inclusion is a poor
workaround and isn't necessarily easy if one has generated C code.


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