[Mlir-commits] [llvm] [mlir] eliminating g++ warnings (PR #105520)
David Blaikie
llvmlistbot at llvm.org
Thu Aug 22 09:57:41 PDT 2024
================
@@ -893,7 +893,7 @@ FlatLinearValueConstraints::FlatLinearValueConstraints(IntegerSet set,
set.getNumDims(), set.getNumSymbols(),
/*numLocals=*/0) {
assert(operands.empty() ||
- set.getNumInputs() == operands.size() && "operand count mismatch");
+ (set.getNumInputs() == operands.size() && "operand count mismatch"));
----------------
dwblaikie wrote:
> What you are proposing looks more correct, but is not the same as without.
It is the same semantics (though it gets there through a different intermediate path) because string literals are always true. and `(x || y) && true` is the same as `x || (y && true)` - and the former is more what people intend, and means line wrapping/formatting will align with what the user intent, etc.
It's not that GCC doesn't know what to do - and it is a common bug pattern in general, and clang warns on this case in general - but clang has a carveout for string literals (& maybe constants more generally) because in this particular context it's not bug prone - the string literal being always true makes the bug benign.
https://github.com/llvm/llvm-project/pull/105520
More information about the Mlir-commits
mailing list