| 582 | } |
| 583 | |
| 584 | void CheckConditionImpl::oppositeElseIfConditionError(const Token *ifCond, const Token *elseIfCond, ErrorPath errorPath) |
| 585 | { |
| 586 | if (diag(ifCond, elseIfCond)) |
| 587 | return; |
| 588 | std::ostringstream errmsg; |
| 589 | errmsg << "Expression is always true because 'else if' condition is opposite to previous condition at line " |
| 590 | << ifCond->linenr() << "."; |
| 591 | |
| 592 | errorPath.emplace_back(ifCond, "first condition"); |
| 593 | errorPath.emplace_back(elseIfCond, "else if condition is opposite to first condition"); |
| 594 | |
| 595 | reportError(std::move(errorPath), Severity::style, "multiCondition", errmsg.str(), CWE398, Certainty::normal); |
| 596 | } |
| 597 | |
| 598 | //--------------------------------------------------------------------------- |
| 599 | // - Opposite inner conditions => always false |
nothing calls this directly
no test coverage detected