[PATCH] D35783: Ignore shadowing for declarations coming from within macros.

Roman Lebedev via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 31 14:04:12 PDT 2017


On Mon, Jul 31, 2017 at 9:57 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
> On Tue, Jul 25, 2017 at 1:19 AM Roman Lebedev via Phabricator via
> cfe-commits <cfe-commits at lists.llvm.org> wrote:
>>
>> lebedev.ri added a comment.
>>
>> How does this relate to the gcc behavior?
>> I suspect not everyone would want to have this relaxed `-Wshadow` mode.
>
>
> Generally I think the goal hasn't been to allow a clang user to keep their
> code GCC warning clean - if a warning has too many false positives, it
> can/will be changed in clang, even if it means it misses cases GCC will
> flag. (for example -Wreturn-type, which pops up a lot in the LLVM codebase
> when it fires on code that's probably unreachable that Clang is nice enough
> to assume won't be reached (code after a fully covered switch over enum,
> where each case returns))
>
> Though it's not unheard of to bisect the diagnostic space to provide these
> variations if suitable - but I wouldn't suggest doing so 'just' for
> compatibility with GCC.
Makes sense.

>>
>> Perhaps it could be hidden under some new flag, which is not going to be
>> automatically enabled by `-Weverything`.
>
>
> Nothing is ever not going to be automatically enabled by -Weverything (the
> intent is that it's really, always, everything). Or perhaps you meant -Wall?
No, i understand that, and i quite like that, but i meant -Weverything, do
read the second part: -Weverything would enable a NOP flag, but when
the flag is explicitly disabled like -Wno-.., THEN this exception is enabled.
I'm not sure if it is doable in llvm.
>...

>> Like, `-Wshadow-in-macros` which does nothing compared to `-Wshadow`, and
>> then `-Wno-shadow-in-macros` which enables this relaxed mode?

>>
>> https://reviews.llvm.org/D35783
Roman.

>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list