missing return; Fixed FP when function ends with assert(0)
This commit is contained in:
parent
eb9a251a4c
commit
02682ab17d
|
@ -338,7 +338,7 @@ static const Token *checkMissingReturnScope(const Token *tok, const Library &lib
|
|||
return nullptr;
|
||||
if (tok->str() == "goto" && !isForwardJump(tok))
|
||||
return nullptr;
|
||||
if (Token::Match(tok, "%name% (") && library.isnoreturn(tok))
|
||||
if (Token::Match(tok, "%name% (") && !library.isnotnoreturn(tok))
|
||||
return nullptr;
|
||||
if (Token::Match(tok, "[;{}] %name% :"))
|
||||
return tok;
|
||||
|
|
|
@ -1487,6 +1487,9 @@ private:
|
|||
// noreturn function
|
||||
check("int f(int x) { exit(0); }");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int f(int x) { assert(0); }");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
// NRVO check
|
||||
void returnLocalStdMove1() {
|
||||
|
|
Loading…
Reference in New Issue