uninitialized variables: fixed fp when analysing loops
This commit is contained in:
parent
026514db1a
commit
132aa8d0c4
|
@ -3778,7 +3778,7 @@ private:
|
||||||
{
|
{
|
||||||
while (tok)
|
while (tok)
|
||||||
{
|
{
|
||||||
if (tok->str() == "{" || tok->str() == "}")
|
if (tok->str() == "{" || tok->str() == "}" || tok->str() == "for")
|
||||||
return;
|
return;
|
||||||
const Token *next = parse(*tok, checks);
|
const Token *next = parse(*tok, checks);
|
||||||
if (next)
|
if (next)
|
||||||
|
|
|
@ -1801,6 +1801,16 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("void x() {\n"
|
||||||
|
" do {\n"
|
||||||
|
" Token * tok;\n"
|
||||||
|
" for (tok = a; tok; tok = tok->next())\n"
|
||||||
|
" {\n"
|
||||||
|
" }\n"
|
||||||
|
" } while (tok2);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// while..
|
// while..
|
||||||
checkUninitVar("int f()\n"
|
checkUninitVar("int f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue