From f4e07c31799cc8034e2309945431bb3bb25ec2b7 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Thu, 1 Sep 2011 19:10:58 -0400 Subject: [PATCH] fix #3070 (Other: failed to parse a typedef string. Check continues anyway.) --- lib/tokenize.cpp | 2 +- test/testsimplifytokens.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d5f1ad837..44c3cf9d9 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -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++; diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index d4e8b42d6..c5da21f0f 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -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() { {