Fix inline suppression.

This commit is contained in:
Daniel Marjamäki 2019-01-13 12:10:26 +01:00
parent d45e4287e6
commit c75a2265c0
2 changed files with 8 additions and 1 deletions

View File

@ -360,6 +360,14 @@ bool CheckUninitVar::checkScopeForVariable(const Token *tok, const Variable& var
bool alwaysTrue = false;
bool alwaysFalse = false;
// Is variable assigned in condition?
if (!membervar.empty()) {
for (const Token *cond = tok->linkAt(1); cond != tok; cond = cond->previous()) {
if (cond->varId() == var.declarationId() && isMemberVariableAssignment(cond, membervar))
return true;
}
}
conditionAlwaysTrueOrFalse(tok->next()->astOperand2(), variableValue, &alwaysTrue, &alwaysFalse);
// initialization / usage in condition..

View File

@ -213,7 +213,6 @@ void CTU::FileInfo::loadFromXml(const tinyxml2::XMLElement *xmlElement)
if (std::strcmp(e->Name(), "function-call") == 0) {
FunctionCall functionCall;
if (functionCall.loadFromXml(e))
// cppcheck-suppress uninitStructMember // FP
functionCalls.push_back(functionCall);
} else if (std::strcmp(e->Name(), "nested-call") == 0) {
NestedCall nestedCall;