Function Usage: Handling '.. else foo()'

This commit is contained in:
Daniel Marjamäki 2008-11-23 14:26:47 +00:00
parent 954371e3f8
commit c6264022f9
2 changed files with 14 additions and 1 deletions

View File

@ -97,6 +97,7 @@ void CheckFunctionUsage::parseTokens( const Tokenizer &tokenizer )
TOKEN::Match(tok, "&= %var% (") ||
TOKEN::Match(tok, "&& %var% (") ||
TOKEN::Match(tok, "|| %var% (") ||
TOKEN::Match(tok, "else %var% (") ||
TOKEN::Match(tok, "return %var% (") )
funcname = tok->next;

View File

@ -38,7 +38,8 @@ private:
{
TEST_CASE( incondition );
TEST_CASE( return1 );
TEST_CASE( callback1 );
TEST_CASE( callback1 );
TEST_CASE( else1 );
}
void check( const char code[] )
@ -87,6 +88,17 @@ private:
"}\n" );
std::string err( errout.str() );
ASSERT_EQUALS( std::string(""), errout.str() );
}
void else1()
{
check( "void f1()\n"
"{\n"
" if (cond) ;\n"
" else f1();\n"
"}\n" );
std::string err( errout.str() );
ASSERT_EQUALS( std::string(""), errout.str() );
}
};