Fix FP in CheckUnusedVar. Caused by #7230 fix.
This commit is contained in:
parent
7c1a4da6a4
commit
350908d0e9
|
@ -897,8 +897,10 @@ void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(const Scope* const
|
||||||
|
|
||||||
if (tok && tok->isAssignmentOp() && tok->str() != "=") {
|
if (tok && tok->isAssignmentOp() && tok->str() != "=") {
|
||||||
variables.use(varid1, tok);
|
variables.use(varid1, tok);
|
||||||
if (Token::Match(tok, "%assign% %name%"))
|
if (Token::Match(tok, "%assign% %name%")) {
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
variables.read(tok->varId(), tok);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pre || post)
|
if (pre || post)
|
||||||
|
|
|
@ -3153,6 +3153,13 @@ private:
|
||||||
" return a;\n"
|
" return a;\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
functionVariableUsage("void f() {\n"
|
||||||
|
" Fred fred;\n"
|
||||||
|
" int *a; a = b;\n"
|
||||||
|
" fred += a;\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void localvarFor() {
|
void localvarFor() {
|
||||||
|
|
Loading…
Reference in New Issue