[PATCH] D45685: [Sema] Add -wtest global flag that silences -Wself-assign for overloaded operators.
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 18 04:54:10 PDT 2018
rjmccall added a comment.
The goal of having a unified option is that you can uniformly suppress warnings that don't always make sense in unit tests. It's future-proofing against the addition of other warnings (probably C++ warnings) that might not make sense for unit tests, like extending the `x &= x` warning (which is not in -Wself-assign) to user-defined operators. You don't think you would be able to take advantage of that? Because `-Wno-self-assign-overloaded-nonfield` is rather, uh, pretty precisely targeted for exactly that use case; I can't imagine why someone would use `-Wself-assign-overloaded-nofield` *positively*, or even *negatively* for any purpose besides suppressing a unit-test problem.
If you can't reasonably just add this to unit tests, of course you can just add it globally, but that's just as true for `-wtest`as it would be for `-Wno-self-assign-overloaded-nonfield`, and the former seems more self-descriptive of the problem when it appears in a general CFLAGS line: you don't have a reasonable way of suppressing it for just unit tests so you have to suppress it globally.
Repository:
rC Clang
https://reviews.llvm.org/D45685
More information about the cfe-commits
mailing list