| 1674 | } |
| 1675 | |
| 1676 | void CheckConditionImpl::alwaysTrueFalseError(const Token* tok, const Token* condition, const ValueFlow::Value* value) |
| 1677 | { |
| 1678 | const bool alwaysTrue = value && (value->intvalue != 0 || value->isImpossible()); |
| 1679 | const std::string expr = tok ? tok->expressionString() : std::string("x"); |
| 1680 | const std::string conditionStr = getConditionString(condition); |
| 1681 | const std::string errmsg = conditionStr + " '" + expr + "' is always " + bool_to_string(alwaysTrue); |
| 1682 | ErrorPath errorPath = getErrorPath(tok, value, errmsg); |
| 1683 | reportError(std::move(errorPath), |
| 1684 | Severity::style, |
| 1685 | "knownConditionTrueFalse", |
| 1686 | errmsg, |
| 1687 | (alwaysTrue ? CWE571 : CWE570), Certainty::normal); |
| 1688 | } |
| 1689 | |
| 1690 | void CheckConditionImpl::checkInvalidTestForOverflow() |
| 1691 | { |
no test coverage detected