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;
|
return nullptr;
|
||||||
if (tok->str() == "goto" && !isForwardJump(tok))
|
if (tok->str() == "goto" && !isForwardJump(tok))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (Token::Match(tok, "%name% (") && library.isnoreturn(tok))
|
if (Token::Match(tok, "%name% (") && !library.isnotnoreturn(tok))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (Token::Match(tok, "[;{}] %name% :"))
|
if (Token::Match(tok, "[;{}] %name% :"))
|
||||||
return tok;
|
return tok;
|
||||||
|
|
|
@ -1487,6 +1487,9 @@ private:
|
||||||
// noreturn function
|
// noreturn function
|
||||||
check("int f(int x) { exit(0); }");
|
check("int f(int x) { exit(0); }");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("int f(int x) { assert(0); }");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
// NRVO check
|
// NRVO check
|
||||||
void returnLocalStdMove1() {
|
void returnLocalStdMove1() {
|
||||||
|
|
Loading…
Reference in New Issue