fix #3070 (Other: failed to parse a typedef string. Check continues anyway.)

This commit is contained in:
Robert Reif 2011-09-01 19:10:58 -04:00
parent 2667e34a07
commit f4e07c3179
2 changed files with 9 additions and 1 deletions

View File

@ -1147,7 +1147,7 @@ void Tokenizer::simplifyTypedef()
typeStart = tok->next();
offset = 1;
while (Token::Match(tok->tokAt(offset), "const|signed|unsigned|struct|enum") ||
while (Token::Match(tok->tokAt(offset), "const|signed|unsigned|struct|enum %type%") ||
(tok->tokAt(offset + 1) && tok->tokAt(offset + 1)->isStandardType()))
offset++;

View File

@ -269,6 +269,7 @@ private:
TEST_CASE(simplifyTypedef101); // ticket #3003 (segmentation fault)
TEST_CASE(simplifyTypedef102); // ticket #3004
TEST_CASE(simplifyTypedef103); // ticket #3007
TEST_CASE(simplifyTypedef104); // ticket #3070
TEST_CASE(simplifyTypedefFunction1);
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
@ -5418,6 +5419,13 @@ private:
ASSERT_EQUALS("", errout.str());
}
void simplifyTypedef104() // ticket #3070
{
const char code[] = "typedef int (*in_func) (void FAR *, unsigned char FAR * FAR *);\n";
ASSERT_EQUALS(";", sizeof_(code));
ASSERT_EQUALS("", errout.str());
}
void simplifyTypedefFunction1()
{
{