[Bug c/48062] `shadowed declaration is here' should be a note

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 9 07:55:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48062

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-06-09 07:55:37 UTC ---
(In reply to comment #2)
> Produces no warning. So for me it is a bit confusing, since the warning setting
> refers to pieces of code and not to variables.

You are right and it is a bug. The reason is that each warning message (the
second should be note) is produced by different calls to warning(). These calls
are conditional on Wshadow but the #pragmas only disable Wshadow for a certain
location. The fix is to make "shadowed declaration is here" a call to inform()
(that is, a note) conditional on the first warning being emitted, which one can
test by checking the return value of warning(). Patches welcome.



More information about the Gcc-bugs mailing list