Fixed #1265 ((error) Uninitialized variable on macro expansion)

This commit is contained in:
Daniel Marjamäki 2010-01-13 19:37:55 +01:00
parent 0212225859
commit cefa695dba
2 changed files with 9 additions and 3 deletions

View File

@ -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);

View File

@ -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"