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: Warning from -Wshadow should indicate the location of the definition of the variable being shadowed


I've just committed a patch to do this in 3.1 CVS.

Lakshmankumar Mukkavilli wrote:-

> My test.c (just for illustration):
> int myvar;
> 
> void myfunction ()
> {
>   char myvar;
> 
>   myvar='a';
> }

This example now gives:

$ gcc -Wshadow /tmp/foo.c -c
/tmp/foo.c: In function `myfunction':
/tmp/foo.c:5: warning: declaration of `myvar' shadows a global declaration
/tmp/foo.c:1: warning: shadowed declaration is here
$


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