diff --git a/CheckFunctionUsage.cpp b/CheckFunctionUsage.cpp index 9b9a64384..8c6745250 100644 --- a/CheckFunctionUsage.cpp +++ b/CheckFunctionUsage.cpp @@ -95,8 +95,9 @@ void CheckFunctionUsage::parseTokens( const Tokenizer &tokenizer ) TOKEN::Match(tok, ":: %var% (") || TOKEN::Match(tok, "|= %var% (") || TOKEN::Match(tok, "&= %var% (") || - TOKEN::Match(tok, "&& %var% (") || - TOKEN::Match(tok, "|| %var% (") ) + TOKEN::Match(tok, "&& %var% (") || + TOKEN::Match(tok, "|| %var% (") || + TOKEN::Match(tok, "return %var% (") ) funcname = tok->next; // funcname ( => Assert that the end paranthesis isn't followed by { diff --git a/testfunctionusage.cpp b/testfunctionusage.cpp index 06f9af938..4e6ad8dbd 100644 --- a/testfunctionusage.cpp +++ b/testfunctionusage.cpp @@ -36,7 +36,8 @@ private: void run() { - TEST_CASE( incondition ); + TEST_CASE( incondition ); + TEST_CASE( return1 ); } void check( const char code[] ) @@ -59,17 +60,22 @@ private: void incondition() { check( "int f1()\n" - "{\n" - " f2();\n" - "}\n" - "\n" - "void f2()\n" "{\n" " if (f1())\n" - " { }\n" + " { }\n" "}\n" ); std::string err( errout.str() ); ASSERT_EQUALS( std::string(""), errout.str() ); + } + + void return1() + { + check( "int f1()\n" + "{\n" + " return f1();\n" + "}\n" ); + std::string err( errout.str() ); + ASSERT_EQUALS( std::string(""), errout.str() ); } };