Fixed #4628 (False positive: Variable is assigned a value that is never used)
This commit is contained in:
parent
cc6d138209
commit
78a3a58a5a
|
@ -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();
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue