Fixed #1216 (false positive: uninitialized variable when using exit|abort)
This commit is contained in:
parent
fa535ff3ae
commit
e286896d75
|
@ -95,6 +95,12 @@ static const Token *checkExecutionPaths_(const Token *tok, std::list<ExecutionPa
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Token::Match(tok, "abort|exit ("))
|
||||||
|
{
|
||||||
|
ExecutionPath::bailOut(checks);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// don't parse into "struct type { .."
|
// don't parse into "struct type { .."
|
||||||
if (Token::Match(tok, "struct %type% {"))
|
if (Token::Match(tok, "struct %type% {"))
|
||||||
tok = tok->tokAt(2)->link();
|
tok = tok->tokAt(2)->link();
|
||||||
|
|
|
@ -954,6 +954,14 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkNullPointer("static void foo()\n"
|
||||||
|
"{\n"
|
||||||
|
" int *p = 0;\n"
|
||||||
|
" exit();\n"
|
||||||
|
" *p = 0;\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
checkNullPointer("static void foo(int a)\n"
|
checkNullPointer("static void foo(int a)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" Foo *p = 0;\n"
|
" Foo *p = 0;\n"
|
||||||
|
|
Loading…
Reference in New Issue