I’ve had some success using a tool called CppCheck via a Jenkins CI system. I don’t specifically track conditional branches, but, the amount of checks this tool provides is worth the look. In particular, check the
Condition part which lists various checks for conditions that are always true/false (including value tracking, duplicate conditions, interval logic), but other categories also list some possibly useful checks like:
- “pointer addition in condition“
- “identical code in both branches of if/else or ternary operator.”
- other types of suspicious or redundant conditions (for STL, strings, logic/numeric operations, ...)
And, it’s available as a plugin for your IDE.