| 4389 | } |
| 4390 | |
| 4391 | void CheckOtherImpl::knownPointerToBoolError(const Token* tok, const ValueFlow::Value* value) |
| 4392 | { |
| 4393 | if (!tok) { |
| 4394 | reportError(tok, Severity::style, "knownPointerToBool", "Pointer expression 'p' converted to bool is always true."); |
| 4395 | return; |
| 4396 | } |
| 4397 | std::string cond = bool_to_string(!!value->intvalue); |
| 4398 | const std::string& expr = tok->expressionString(); |
| 4399 | std::string errmsg = "Pointer expression '" + expr + "' converted to bool is always " + cond + "."; |
| 4400 | ErrorPath errorPath = getErrorPath(tok, value, errmsg); |
| 4401 | reportError(std::move(errorPath), Severity::style, "knownPointerToBool", errmsg, CWE570, Certainty::normal); |
| 4402 | } |
| 4403 | |
| 4404 | void CheckOtherImpl::checkComparePointers() |
| 4405 | { |
no test coverage detected