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

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 31 11:57:54 PDT 2017


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.


> 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? (which isn't everything & that ship's already sailed, so usually
more nuanced choices are made about what goes in there, etc)


> 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
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170731/c484df18/attachment.html>


More information about the cfe-commits mailing list