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;
|
||||
}
|
||||
|
||||
if (Token::Match(tok, "abort|exit ("))
|
||||
{
|
||||
ExecutionPath::bailOut(checks);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// don't parse into "struct type { .."
|
||||
if (Token::Match(tok, "struct %type% {"))
|
||||
tok = tok->tokAt(2)->link();
|
||||
|
|
|
@ -954,6 +954,14 @@ private:
|
|||
"}\n");
|
||||
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"
|
||||
"{\n"
|
||||
" Foo *p = 0;\n"
|
||||
|
|
Loading…
Reference in New Issue