| 1368 | } |
| 1369 | |
| 1370 | void CheckConditionImpl::incorrectLogicOperatorError(const Token *tok, const std::string &condition, bool always, bool inconclusive, ErrorPath errors) |
| 1371 | { |
| 1372 | if (diag(tok)) |
| 1373 | return; |
| 1374 | errors.emplace_back(tok, ""); |
| 1375 | if (always) |
| 1376 | reportError(std::move(errors), Severity::warning, "incorrectLogicOperator", |
| 1377 | "Logical disjunction always evaluates to true: " + condition + ".\n" |
| 1378 | "Logical disjunction always evaluates to true: " + condition + ". " |
| 1379 | "Are these conditions necessary? Did you intend to use && instead? Are the numbers correct? Are you comparing the correct variables?", CWE571, inconclusive ? Certainty::inconclusive : Certainty::normal); |
| 1380 | else |
| 1381 | reportError(std::move(errors), Severity::warning, "incorrectLogicOperator", |
| 1382 | "Logical conjunction always evaluates to false: " + condition + ".\n" |
| 1383 | "Logical conjunction always evaluates to false: " + condition + ". " |
| 1384 | "Are these conditions necessary? Did you intend to use || instead? Are the numbers correct? Are you comparing the correct variables?", CWE570, inconclusive ? Certainty::inconclusive : Certainty::normal); |
| 1385 | } |
| 1386 | |
| 1387 | void CheckConditionImpl::redundantConditionError(const Token *tok, const std::string &text, bool inconclusive) |
| 1388 | { |
no test coverage detected