is '-Wshadow' too chatty?

Eyal Lebedinsky eyal@eyal.emu.id.au
Wed Dec 27 02:35:00 GMT 2000


I am on a mission to make the best use of gcc's warnings for improving
the quality of my C programs. I already picked a few nasties. The
problem
with warnings is that you need to have just the right amount. Too
little and you do not know of a problem, too many and to are
desensitize and cannot see the bad ones in the larg crowd.

These -Wshadow warnings are very usefull, I started using it now.
A problem that I see is that it produces diagnostics even inside
a function declaration prototype. The fact is that there is no
risk is such shadowing since the argument names (optional in a
declaration) go out of scope at the end of the declaration.

I suggest the diagnostic be supressed in this situation. Does this
sound proper?


$ cat t.c
#include <stdlib.h>
extern int xx (int system);

$ gcc -Wshadow -c t.c
t.c:2: warning: declaration of `system' shadows global declaration

--
Eyal Lebedinsky		(eyal@eyal.emu.id.au)


More information about the Gcc-patches mailing list