Re: [PATCH 18/348] Fix -Wsahdow warnings

Andrey Smirnov
2011-11-30T03:48:05Z

On Wed, Nov 30, 2011 at 2:17 AM, Tom Tromey <tromey@redhat.com> wrote:
> Could we possibly mandate that -Wshadow only be used with a GCC that has
> Alan Modra's patch in it?
>
> Joel pinged it, and it went in, though I didn't see the actual patch:
>
>    http://gcc.gnu.org/ml/gcc-patches/2011-11/msg02340.html
>

I know I probably should go to GCC mailing list and ask that question
there, but anyways, would this patch cause gcc to stop generating the
warning about local variable shadowing global one from system headers?

The reason I'm asking is because there are several instances of said
shadowing in GDB, for example
https://github.com/ndreys/gdb/commit/bf87d6034f7093aa207a1b14233be48214a6c3d8
(please ignore the erroneous description, for some unknown reason I
call `optarg' `optparse')

I hope that kinds of shadowing would still be detectable even with this
patch applied.

> Still, what it does is prevent the warning when shadowing something from
> a system header.  This seems decent to me and in particular will, I
> think, largely address Mark's concerns.
>

It would pretty much solve that problem, yes, but still it would
divide patch submitters into two groups those who have newest gcc and
-Wshadow enabled by default, and those who don't. And the people
without -Wshadow enabled compilers would be, on occasion, breaking the
build because they have no means to check for -Wshadow caused errors.
I hope I missing something and it is not the case, but that how the
things seems to me now.

Andrey Smirnov