This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: annoying -Wshadow warning
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Doug Evans <dje at transmeta dot com>
- Cc: <gcc-bugs at gcc dot gnu dot org>
- Date: Tue, 9 Jul 2002 20:36:08 +0100 (BST)
- Subject: Re: annoying -Wshadow warning
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.
--
Joseph S. Myers
jsm28@cam.ac.uk