Fixed #1265 ((error) Uninitialized variable on macro expansion)
This commit is contained in:
parent
0212225859
commit
cefa695dba
|
@ -140,11 +140,9 @@ static const Token *checkExecutionPaths_(const Token *tok, std::list<ExecutionPa
|
|||
if (Token::Match(tok, "struct %type% {"))
|
||||
tok = tok->tokAt(2)->link();
|
||||
|
||||
if (Token::Match(tok, "= {") || Token::Match(tok, "= ( %type% !!="))
|
||||
if (Token::Match(tok, "= {"))
|
||||
{
|
||||
tok = tok->next()->link();
|
||||
if (Token::simpleMatch(tok, ") {"))
|
||||
tok = tok->next()->link();
|
||||
if (!tok)
|
||||
{
|
||||
ExecutionPath::bailOut(checks);
|
||||
|
|
|
@ -1209,6 +1209,14 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("void f()\n"
|
||||
"{\n"
|
||||
" int c;\n"
|
||||
" a = (f2(&c));\n"
|
||||
" c++;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// +=
|
||||
checkUninitVar("void f()\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue