From cdd8d3f785eef2d9cdc4eaffcdfe38ac0012537f Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Sun, 13 Feb 2011 19:02:57 -0500 Subject: [PATCH] Really fix #2348 perl-tk --- lib/tokenize.cpp | 2 ++ test/testsimplifytokens.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 2797909b8..9398867d5 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -869,6 +869,8 @@ static Token *processFunc(Token *tok2, bool inOperator) tok2 = tok2->tokAt(5)->link(); else if (Token::Match(tok2->next(), "* ( * %type% ) (")) tok2 = tok2->tokAt(6)->link(); + else if (Token::Match(tok2->next(), "* ( * %type% ) ;")) + tok2 = tok2->tokAt(5); else if (Token::Match(tok2->next(), "* ( %type% [") && Token::Match(tok2->tokAt(4)->link(), "] ) ;|=")) tok2 = tok2->tokAt(4)->link()->next(); diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index b79b99f58..ac191e618 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -236,6 +236,7 @@ private: TEST_CASE(simplifyTypedef76); // ticket #2453 TEST_CASE(simplifyTypedef77); // ticket #2554 TEST_CASE(simplifyTypedef78); // ticket #2568 + TEST_CASE(simplifyTypedef79); // ticket #2348 TEST_CASE(simplifyTypedefFunction1); TEST_CASE(simplifyTypedefFunction2); // ticket #1685 @@ -4858,6 +4859,21 @@ private: ASSERT_EQUALS(expected, sizeof_(code)); } + void simplifyTypedef79() // ticket #2348 + { + const char code[] = "typedef int (Tcl_ObjCmdProc) (int x);\n" + "typedef struct LangVtab\n" + "{\n" + " Tcl_ObjCmdProc * (*V_LangOptionCommand);\n" + "} LangVtab;\n"; + const std::string expected = "; " + "struct LangVtab " + "{ " + "int ( * ( * V_LangOptionCommand ) ) ( int x ) ; " + "} ;"; + ASSERT_EQUALS(expected, sizeof_(code)); + } + void simplifyTypedefFunction1() { {