[llvm] [mlir] eliminating g++ warnings (PR #105520)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 10:27:56 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:

Seems like the wrong bracing - though, again, this one comes up semi-regularly and I'd consider disabling the GCC warning, since Clang's does the right thing by observing that the RHS is a constant true  and so the braces don't change the expression semantics here)

If we're adding braces, though, it should probably be around the whole assertion condition:
```
assert((operands.empty() || set.getNumInputs() == operands.size()) && "...");
```

https://github.com/llvm/llvm-project/pull/105520


More information about the llvm-commits mailing list