[PATCH] D45685: [Sema] Add -wtest global flag that silences -Wself-assign for overloaded operators.
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 16 12:13:11 PDT 2018
On Mon, Apr 16, 2018 at 12:08 PM Roman Lebedev via Phabricator <
reviews at reviews.llvm.org> wrote:
> lebedev.ri added a comment.
>
> In https://reviews.llvm.org/D45685#1069040, @dblaikie wrote:
>
> > I'm not sure this is a practical direction to pursue - though perhaps
> > others disagree.
>
>
>
>
> > It's likely non-trivial to plumb a flag through most build systems to be
> > applied only to test code
>
> I'm sorry, I don't understand.
>
> If you don't separate between source code and `*_test.cpp` sources, sure,
> you will loose the warning coverage either way.
>
> What difference is there between passing `-wtest` and passing
> `-Wno-self-assign-overloaded`?
>
Not much, if any.
> Just pass it alongside with the googletest include paths so to speak.
>
But build systems don't necessarily expose that kind of ability. (For
example, googletest (not the only kind of test suite/code) is checked into
the LLVM codebase like another library - so depending on it is just another
library dependency, not a special "test" library dependency).
>
> > (& likely would suppress the warning in headers
> > only included in test code - so for example, in a header-only library if
> > the user ran their tests they wouldn't see the warning, but when the
> users
> > code was used in some other production code it might warn (& possibly
> break
> > the build if -Werror is in use))
>
> Could you please explain how it is not an issue if this would be a
> `-Wno-self-assign-overloaded`?
>
It isn't any different - though it sounds like "-wtest" is being proposed
as a way that test code could specifically be corrected without impacting
the rest of the code. I'm not sure that's true/viable/accessible to most
developers, so the justification seems a bit infeasible - likely naming it
-Wno-self-assign-overloaded would at least name it how it'll be used, to
turn the warning off across a whole codebase because the false positive
rate across the whole codebase is unacceptable for a given user.
>
>
> Repository:
> rC Clang
>
> https://reviews.llvm.org/D45685
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180416/a65999e2/attachment-0001.html>
More information about the cfe-commits
mailing list