This is the mail archive of the gcc-patches@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: [PATCH] Add -Wshadow-local and -Wshadow-compatible-local.


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

Attachment: Add-Wshadow-global-Wshadow-local-and-Wshadow-compatible-local.patch
Description: Text document


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