Fixed #1835 (false positive: uninitialized variable when using ?)
This commit is contained in:
parent
ee2f785529
commit
11a72461f3
|
@ -183,6 +183,13 @@ static void checkExecutionPaths_(const Token *tok, std::list<ExecutionPath *> &c
|
|||
return;
|
||||
}
|
||||
|
||||
// ?: => bailout
|
||||
if (tok->str() == "?")
|
||||
{
|
||||
ExecutionPath::bailOut(checks);
|
||||
return;
|
||||
}
|
||||
|
||||
if (tok->str() == "switch")
|
||||
{
|
||||
const Token *tok2 = tok->next()->link();
|
||||
|
|
|
@ -1713,6 +1713,18 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("void foo()\n"
|
||||
"{\n"
|
||||
" const char *msgid1, *msgid2;\n"
|
||||
" int ret = bar(&msgid1);\n"
|
||||
" if (ret > 0) {\n"
|
||||
" ret = bar(&msgid2);\n"
|
||||
" }\n"
|
||||
" ret = ret <= 0 ? -1 :\n"
|
||||
" strcmp(msgid1, msgid2) == 0;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// while..
|
||||
checkUninitVar("int f()\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue