missingReturn; Fixed FP when function is declared in macro
This commit is contained in:
parent
4ecf3ccd17
commit
ef0af26d9f
|
@ -259,7 +259,7 @@ void CheckFunctions::checkMissingReturn()
|
||||||
continue;
|
continue;
|
||||||
if (function->type != Function::Type::eFunction && function->type != Function::Type::eOperatorEqual)
|
if (function->type != Function::Type::eFunction && function->type != Function::Type::eOperatorEqual)
|
||||||
continue;
|
continue;
|
||||||
if (Token::Match(function->retDef, "void %name%"))
|
if (Token::Match(function->retDef, "void| %name% ("))
|
||||||
continue;
|
continue;
|
||||||
const Token *errorToken = checkMissingReturnScope(scope->bodyEnd);
|
const Token *errorToken = checkMissingReturnScope(scope->bodyEnd);
|
||||||
if (errorToken)
|
if (errorToken)
|
||||||
|
|
|
@ -1373,6 +1373,9 @@ private:
|
||||||
check("int f() {}");
|
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());
|
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
|
// switch
|
||||||
check("int f() {\n"
|
check("int f() {\n"
|
||||||
" switch (x) {\n"
|
" switch (x) {\n"
|
||||||
|
|
Loading…
Reference in New Issue