MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / assignIfError

Method assignIfError

lib/checkcondition.cpp:243–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243void CheckConditionImpl::assignIfError(const Token *tok1, const Token *tok2, const std::string &condition, bool result)
244{
245 if (tok2 && diag(tok2->tokAt(2)))
246 return;
247 std::list<const Token *> locations = { tok1, tok2 };
248 reportError(locations,
249 Severity::style,
250 "assignIfError",
251 "Mismatching assignment and comparison, comparison '" + condition + "' is always " + std::string(bool_to_string(result)) + ".", CWE398, Certainty::normal);
252}
253
254
255void CheckConditionImpl::mismatchingBitAndError(const Token *tok1, const MathLib::bigint num1, const Token *tok2, const MathLib::bigint num2)

Callers 1

getErrorMessagesMethod · 0.80

Calls 4

bool_to_stringFunction · 0.85
diagFunction · 0.70
reportErrorFunction · 0.70
tokAtMethod · 0.45

Tested by

no test coverage detected