Skip to content

Commit b7167c7

Browse files
committed
[mlir] Fix incorrect comparison due to -Wtautological-constant-out-of-range-compare (NFC)
/llvm-project/mlir/include/mlir/Analysis/Presburger/Utils.h:320:26: error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always true [-Werror,-Wtautological-constant-out-of-range-compare] preIndent = (preIndent != std::string::npos) ? preIndent + 1 : 0; ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~ /llvm-project/mlir/include/mlir/Analysis/Presburger/Utils.h:335:28: error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always true [-Werror,-Wtautological-constant-out-of-range-compare] preIndent = (preIndent != std::string::npos) ? preIndent + 1 : 0; ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~ 2 errors generated.
1 parent ded0801 commit b7167c7

File tree

1 file changed

+2
-2
lines changed
  • mlir/include/mlir/Analysis/Presburger

1 file changed

+2
-2
lines changed

mlir/include/mlir/Analysis/Presburger/Utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ void updatePrintMetrics(T val, PrintTableMetrics &m) {
317317
if (str.empty())
318318
return;
319319
unsigned preIndent = str.find(m.preAlign);
320-
preIndent = (preIndent != std::string::npos) ? preIndent + 1 : 0;
320+
preIndent = (preIndent != (unsigned)std::string::npos) ? preIndent + 1 : 0;
321321
m.maxPreIndent = std::max(m.maxPreIndent, preIndent);
322322
m.maxPostIndent =
323323
std::max(m.maxPostIndent, (unsigned int)(str.length() - preIndent));
@@ -332,7 +332,7 @@ void printWithPrintMetrics(raw_ostream &os, T val, unsigned minSpacing,
332332
unsigned preIndent;
333333
if (!str.empty()) {
334334
preIndent = str.find(m.preAlign);
335-
preIndent = (preIndent != std::string::npos) ? preIndent + 1 : 0;
335+
preIndent = (preIndent != (unsigned)std::string::npos) ? preIndent + 1 : 0;
336336
} else {
337337
preIndent = 0;
338338
}

0 commit comments

Comments
 (0)