Fixed #4628 (False positive: Variable is assigned a value that is never used)

This commit is contained in:
Daniel Marjamäki 2013-03-04 19:13:49 +01:00
parent cc6d138209
commit 78a3a58a5a
2 changed files with 8 additions and 3 deletions

View File

@ -449,11 +449,9 @@ static const Token* doAssignment(Variables &variables, const Token *tok, bool de
if (Token::Match(tok, "struct|union"))
tok = tok->next();
tok = tok->next();
if (tok->str() == "*")
while ((tok->isName() && tok->varId() == 0) || (tok->str() == "*") || (tok->str() == ")"))
tok = tok->next();
tok = tok->next();
if (tok->str() == "&") {
addressOf = true;
tok = tok->next();

View File

@ -2735,6 +2735,13 @@ private:
" x(b);\n"
"}");
ASSERT_EQUALS("", errout.str());
functionVariableUsage("int f(void) {\n" // #4628
" int x=1,y;\n"
" y = (x * a) / 100;\n"
" return y;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void localvarasm() {