Fixed #1183 (False positive: uninitialized variable p 'd = bar(sizeof(*p));')
This commit is contained in:
parent
0ee3d7e46a
commit
0159287437
|
@ -1628,6 +1628,13 @@ private:
|
||||||
--parlevel;
|
--parlevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (Token::simpleMatch(tok2, "sizeof ("))
|
||||||
|
{
|
||||||
|
tok2 = tok2->link();
|
||||||
|
if (!tok2)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
else if (tok2->varId())
|
else if (tok2->varId())
|
||||||
{
|
{
|
||||||
if (Token::Match(tok2->tokAt(-2), "[(,] *"))
|
if (Token::Match(tok2->tokAt(-2), "[(,] *"))
|
||||||
|
|
|
@ -1302,6 +1302,13 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("void foo()\n"
|
||||||
|
"{\n"
|
||||||
|
" Foo *p;\n"
|
||||||
|
" x = bar(sizeof(*p));\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// arrays..
|
// arrays..
|
||||||
checkUninitVar("void f()\n"
|
checkUninitVar("void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue