Fixed #2066 (false positive: uninitialized variable when initializing through function pointer)
This commit is contained in:
parent
80069f016e
commit
415cbc63c3
|
@ -3291,7 +3291,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (Token::Match(&tok, "%var% (") && uvarFunctions.find(tok.str()) == uvarFunctions.end())
|
if (Token::Match(&tok, "%var% (") && uvarFunctions.find(tok.str()) == uvarFunctions.end())
|
||||||
{
|
{
|
||||||
if (Token::simpleMatch(&tok, "sizeof ("))
|
if (Token::simpleMatch(&tok, "sizeof ("))
|
||||||
return tok.next()->link();
|
return tok.next()->link();
|
||||||
|
|
|
@ -2274,6 +2274,15 @@ private:
|
||||||
" return x;\n"
|
" return x;\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("void (*init)(char *str);\n"
|
||||||
|
"\n"
|
||||||
|
"char x() {\n"
|
||||||
|
" char cmd[10];\n"
|
||||||
|
" init(cmd);\n"
|
||||||
|
" return cmd[0];\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue