Uninitialized variables: Fix false positive if variable is used after return (goto). Ticket: #3369

This commit is contained in:
Daniel Marjamäki 2011-12-15 20:05:11 +01:00
parent 10228881c7
commit f797307edc
1 changed files with 2 additions and 0 deletions

View File

@ -1131,6 +1131,8 @@ bool CheckUninitVar::checkScopeForVariable(const Token *tok, const unsigned int
if (Token::Match(tok, "return|break|continue|throw")) if (Token::Match(tok, "return|break|continue|throw"))
ret = true; ret = true;
else if (ret && tok->str() == ";")
return false;
// variable is seen.. // variable is seen..
if (tok->varId() == varid) { if (tok->varId() == varid) {