uninitialized struct members: improved fix
This commit is contained in:
parent
93fb6b0c6a
commit
e32ab4bf65
|
@ -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()))
|
||||||
|
|
Loading…
Reference in New Issue