[PATCH] D45685: [Sema] Add -wtest global flag that silences -Wself-assign for overloaded operators.

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 16 12:41:26 PDT 2018


lebedev.ri added a comment.

Uuuh, the fact that phab posts the top-postings, but silently ignores inline replies is annoying.

>> 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.

Ok, so this was a non-argument then?

>> 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).

It's a bit hard to talk about all and every spherical build system / project
in the vacuum, because there is an infinite number of possibilities.
Of course some build systems are horribly designed, and it will be hard to
do that there. But I sure hope that isn't the case in most of the cases.
It might be more productive to talk about a few good known realities.

In llvm's case you would simply add `-wtest` (or `-Wno-self-assign-overloaded`)
in here https://github.com/llvm-mirror/llvm/blob/2a6cf85828509e89e18739e5f4b9a958820d66d4/cmake/modules/AddLLVM.cmake#L1079-L1085
and around here https://github.com/llvm-mirror/libcxx/blob/73e00f8321b13559b3c41f6656686d980fe92fbe/utils/libcxx/test/config.py#L914
I'd say that is rather trivial.


Repository:
  rC Clang

https://reviews.llvm.org/D45685





More information about the cfe-commits mailing list