Really fix #2348 perl-tk

This commit is contained in:
Robert Reif 2011-02-13 19:02:57 -05:00
parent d2a1d3f14a
commit cdd8d3f785
2 changed files with 18 additions and 0 deletions

View File

@ -869,6 +869,8 @@ static Token *processFunc(Token *tok2, bool inOperator)
tok2 = tok2->tokAt(5)->link(); tok2 = tok2->tokAt(5)->link();
else if (Token::Match(tok2->next(), "* ( * %type% ) (")) else if (Token::Match(tok2->next(), "* ( * %type% ) ("))
tok2 = tok2->tokAt(6)->link(); tok2 = tok2->tokAt(6)->link();
else if (Token::Match(tok2->next(), "* ( * %type% ) ;"))
tok2 = tok2->tokAt(5);
else if (Token::Match(tok2->next(), "* ( %type% [") && else if (Token::Match(tok2->next(), "* ( %type% [") &&
Token::Match(tok2->tokAt(4)->link(), "] ) ;|=")) Token::Match(tok2->tokAt(4)->link(), "] ) ;|="))
tok2 = tok2->tokAt(4)->link()->next(); tok2 = tok2->tokAt(4)->link()->next();

View File

@ -236,6 +236,7 @@ private:
TEST_CASE(simplifyTypedef76); // ticket #2453 TEST_CASE(simplifyTypedef76); // ticket #2453
TEST_CASE(simplifyTypedef77); // ticket #2554 TEST_CASE(simplifyTypedef77); // ticket #2554
TEST_CASE(simplifyTypedef78); // ticket #2568 TEST_CASE(simplifyTypedef78); // ticket #2568
TEST_CASE(simplifyTypedef79); // ticket #2348
TEST_CASE(simplifyTypedefFunction1); TEST_CASE(simplifyTypedefFunction1);
TEST_CASE(simplifyTypedefFunction2); // ticket #1685 TEST_CASE(simplifyTypedefFunction2); // ticket #1685
@ -4858,6 +4859,21 @@ private:
ASSERT_EQUALS(expected, sizeof_(code)); 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() void simplifyTypedefFunction1()
{ {
{ {