Fixed #618 (Tokenizer: Wrong handling of enum)

http://sourceforge.net/apps/trac/cppcheck/ticket/618
This commit is contained in:
Slava Semushin 2009-08-29 16:42:42 +07:00
parent 78d44e67ef
commit ae413a1ef0
2 changed files with 6 additions and 1 deletions

View File

@ -3576,7 +3576,7 @@ bool Tokenizer::simplifyComma()
continue;
}
if (Token::simpleMatch(tok, "= {"))
if (Token::Match(tok, "=|enum {"))
{
tok = tok->next()->link();
if (!tok)

View File

@ -1119,6 +1119,11 @@ private:
ASSERT_EQUALS(" void f ( ) { for ( int a , b ; a < 10 ; a = a + 1 , b = b + 1 ) { ; } }", sizeof_(code));
}
{
const char code[] = " typedef enum { a = 0 , b = 1 , c = 2 } abc ;";
ASSERT_EQUALS(code, sizeof_(code));
}
{
const char code[] = "void f()\n"
"{\n"