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

[Get raw message]
Lakshmankumar Mukkavilli wrote:-

> This is not a bug but a request for additional information while
> reporting problems about shadowing variables.
> 
> gcc -c -Wshadow test.c
>   produces a warning
> 
> t.c: In function `myfunction':
> t.c:5: warning: declaration of `myvar' shadows global declaration
> 
> This gives no indication of where 'myvar' is defined in the enclosing
> scope. In small programs this causes no problem. But when used in
> programs where the preprocessed files have tens of thousands of lines
> and scores of files are included locating the definition of the variable
> being shadowed is tedious and time-consuming.

Good point.  I recently changed the C++ front end to do this.
However, the C front end still does not.  I hope to get round to doing
the C front end too before 3.1.

Neil.


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