missing return; Fixed FP when function ends with assert(0)

This commit is contained in:
Daniel Marjamäki 2021-07-18 14:54:25 +02:00
parent eb9a251a4c
commit 02682ab17d
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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() {