HomePhabricator

Extend -Wtautological-overlap-compare to more cases.

Description

Extend -Wtautological-overlap-compare to more cases.

Previously, -Wtautological-overlap-compare did not warn on cases where the
boolean expression was in an assignment or return statement. This patch
should cause all boolean statements to be passed to the tautological compare
checks in the CFG analysis.

This is one of the issues from PR13101

Details

Committed
rtrieuJan 3 2017, 4:46 PM
Parents
rL290919: Add -plugin-opt=sample-profile for thinLTO build.
Branches
Unknown
Tags
Unknown

Event Timeline

Hello,

do you know why this warning is not on by default? :/

Hello,

do you know why this warning is not on by default? :/

On by default warnings need to be fast and cheap to run. Warnings which require building the CFG do not fall into this category, as the CFG is only built when something requires it. The overlap compare warning utilizes the CFG as part of its analysis.

Thanks. Are you still working at this?

I have a case where Clang does not warn, GCC does:
https://godbolt.org/z/ntQ4vw