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% {"))
|
if (Token::Match(tok, "struct %type% {"))
|
||||||
tok = tok->tokAt(2)->link();
|
tok = tok->tokAt(2)->link();
|
||||||
|
|
||||||
if (Token::Match(tok, "= {") || Token::Match(tok, "= ( %type% !!="))
|
if (Token::Match(tok, "= {"))
|
||||||
{
|
{
|
||||||
tok = tok->next()->link();
|
tok = tok->next()->link();
|
||||||
if (Token::simpleMatch(tok, ") {"))
|
|
||||||
tok = tok->next()->link();
|
|
||||||
if (!tok)
|
if (!tok)
|
||||||
{
|
{
|
||||||
ExecutionPath::bailOut(checks);
|
ExecutionPath::bailOut(checks);
|
||||||
|
|
|
@ -1209,6 +1209,14 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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"
|
checkUninitVar("void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue