-Wtautological-overlap-compare checks compound conditionals which compare the same value multiple times against a constant. This patch allows the constant to be a negative value or implicitly cast from another integer type. There's also a minor change to reachable code analysis so that the negative value can act like other values for purposes of silencing the warning.
Details
Diff Detail
Event Timeline
test/Sema/warn-unreachable.c | ||
---|---|---|
437 | Why this change? |
test/Sema/warn-unreachable.c | ||
---|---|---|
437 | if (y == -1 && y != -1) // condition from warn-unreachable.cpp if (- 1) // condition here The test case below in warn-unreachable.cpp all have silence notes on them. For consistency, I wanted the new case involving (y == -1 && y != -1) to also have a silence case. The change to the reachability analysis to do that would also generate a silence note for (- 1). Since (- 1) now generates a silence, I picked a different unary operator that would not. |
*appreciates CFG tests*
test/Analysis/cfg.cpp | ||
---|---|---|
504–506 ↗ | (On Diff #215021) | Looks like runaway formatting. |
Typo: "subexpressions".