Don't show checkLibraryNoReturn for functions with visible declaration (#11523, #11190) (#4809)

This commit is contained in:
chrchr-github 2023-02-24 06:49:28 +01:00 committed by GitHub
parent 103ff907b6
commit d1e1f951df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -7176,7 +7176,7 @@ bool Tokenizer::isScopeNoReturn(const Token *endScopeToken, bool *unknown) const
bool warn = true;
if (Token::simpleMatch(endScopeToken->tokAt(-2), ") ; }")) {
const Token * const ftok = endScopeToken->linkAt(-2)->previous();
if (ftok && (ftok->type() || (ftok->function() && ftok->function()->hasBody()))) // constructor call
if (ftok && (ftok->type() || ftok->function())) // constructor call
warn = false;
}

View File

@ -2402,6 +2402,12 @@ private:
ASSERT_EQUALS("[test.c:3]: (information) --check-library: Function x() should have <noreturn> configuration\n"
"[test.c:4]: (information) --check-library: Function x() should have <use>/<leak-ignore> configuration\n",
errout.str());
check("void cb();\n" // #11190, #11523
"void f() {\n"
" cb();\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void configuration2() {