| 422 | } |
| 423 | |
| 424 | void CheckConditionImpl::comparisonError(const Token *tok, const std::string &bitop, MathLib::bigint value1, const std::string &op, MathLib::bigint value2, bool result) |
| 425 | { |
| 426 | std::ostringstream expression; |
| 427 | expression << std::hex << "(X " << bitop << " 0x" << value1 << ") " << op << " 0x" << value2; |
| 428 | |
| 429 | const std::string errmsg("Expression '" + expression.str() + "' is always " + bool_to_string(result) + ".\n" |
| 430 | "The expression '" + expression.str() + "' is always " + bool_to_string(result) + |
| 431 | ". Check carefully constants and operators used, these errors might be hard to " |
| 432 | "spot sometimes. In case of complex expression it might help to split it to " |
| 433 | "separate expressions."); |
| 434 | |
| 435 | reportError(tok, Severity::style, "comparisonError", errmsg, CWE398, Certainty::normal); |
| 436 | } |
| 437 | |
| 438 | bool CheckConditionImpl::isOverlappingCond(const Token * const cond1, const Token * const cond2, bool pure) const |
| 439 | { |
no test coverage detected