[PATCH] Add -Wshadow-local and -Wshadow-compatible-local.

Jason Merrill jason@redhat.com
Mon Oct 31 12:42:00 GMT 2016


On Sun, Oct 30, 2016 at 3:53 PM, Mark Wielaard <mjw@redhat.com> wrote:
> On Tue, Oct 25, 2016 at 01:57:09AM +0200, Mark Wielaard wrote:
>> I think the only thing "blocking" the patch from going in is that
>> nobody made a decission on how the actual warning option should be
>> named. I think the suggestion for -Wshadow=[global|local|compatible-local]
>> is the right one. With -Wshadow being an alias for -Wshadow=global.
>> But since there are already gcc versions out there that accept
>> -Wshadow-local and -Wshadow-compatible-local (and you can find some
>> configure scripts that already check for those options) it would be
>> good to have those as (hidden) aliases.
>> If people, some maintainer, agrees with that then we can do the .opt
>> file hacking to make it so.
> Nobody objected, nor did anybody say this is a great idea. But I think
> it is. So I just implemented the options this way.
> I made one small diagnostic change to fix a regression pointed out by
> gcc/testsuite/gcc.dg/pr48062.c. It should still be possible to ignore
> all shadow warnings with #pragma GCC diagnostic ignored "-Wshadow" when
> -Wshadow was given, but not the new -Wshadow=(local|compatible-local).
> So we now set warning_code = OPT_Wshadow when -Wshadow was given.
> The documentation and code comments were updated to refer to the
> new -Wshadow=... variants.
> OK to commit the attached patch?
> Thanks,
> Mark

More information about the Gcc-patches mailing list