uninitialized struct members: improved fix

This commit is contained in:
Daniel Marjamäki 2013-01-17 17:21:21 +01:00
parent 93fb6b0c6a
commit e32ab4bf65
1 changed files with 2 additions and 2 deletions

View File

@ -1345,10 +1345,10 @@ bool CheckUninitVar::checkScopeForVariable(const Scope* scope, const Token *tok,
if (membervar) { if (membervar) {
if (Token::Match(tok, "%var% . %var% =") && tok->strAt(2) == membervar->name()) if (Token::Match(tok, "%var% . %var% =") && tok->strAt(2) == membervar->name())
return true; return true;
else if (Token::Match(tok, "%var% ="))
return true;
else if (Token::Match(tok->previous(), "[(,] %var% [,)]") && isVariableUsage(scope, tok, var.isPointer())) else if (Token::Match(tok->previous(), "[(,] %var% [,)]") && isVariableUsage(scope, tok, var.isPointer()))
uninitvarError(tok, tok->str() + "." + membervar->name()); uninitvarError(tok, tok->str() + "." + membervar->name());
else
return true;
} else { } else {
// Use variable // Use variable
if (!suppressErrors && isVariableUsage(scope, tok, var.isPointer())) if (!suppressErrors && isVariableUsage(scope, tok, var.isPointer()))