Fixed false positive when noreturn function is defined (#5601, second attempt)

This commit is contained in:
PKEuS 2014-03-22 19:55:13 +01:00
parent 6395cb9b95
commit 58c2f372b9
2 changed files with 7 additions and 1 deletions

View File

@ -1609,7 +1609,7 @@ void CheckOther::checkUnreachableCode()
secondBreak = tok->tokAt(3);
labelName = tok->next();
} else if (Token::Match(tok, "%var% (") && _settings->library.isnoreturn(tok->str())) {
if (!tok->function() || (tok->function()->token != tok && tok->function()->tokenDef != tok))
if ((!tok->function() || (tok->function()->token != tok && tok->function()->tokenDef != tok)) && tok->linkAt(1)->strAt(1) != "{")
secondBreak = tok->linkAt(1)->tokAt(2);
}

View File

@ -2871,6 +2871,12 @@ private:
"}", 0, false, false, false, false, &settings);
ASSERT_EQUALS("", errout.str());
check("void NeonSession::exit()\n"
"{\n"
" SAL_INFO(\"ucb.ucp.webdav\", \"neon commands cannot be aborted\");\n"
"}", 0, false, false, false, false, &settings);
ASSERT_EQUALS("", errout.str());
check("void foo(int a)\n"
"{\n"
" switch(a) {\n"