missingReturn; Fixed FP when function is declared in macro

This commit is contained in:
Daniel Marjamäki 2021-07-08 13:14:11 +02:00
parent 4ecf3ccd17
commit ef0af26d9f
2 changed files with 4 additions and 1 deletions

View File

@ -259,7 +259,7 @@ void CheckFunctions::checkMissingReturn()
continue;
if (function->type != Function::Type::eFunction && function->type != Function::Type::eOperatorEqual)
continue;
if (Token::Match(function->retDef, "void %name%"))
if (Token::Match(function->retDef, "void| %name% ("))
continue;
const Token *errorToken = checkMissingReturnScope(scope->bodyEnd);
if (errorToken)

View File

@ -1373,6 +1373,9 @@ private:
check("int f() {}");
ASSERT_EQUALS("[test.cpp:1]: (error) Found a exit path from function with non-void return type that has missing return statement\n", errout.str());
check("F(A,B) { x=1; }");
ASSERT_EQUALS("", errout.str());
// switch
check("int f() {\n"
" switch (x) {\n"