Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ const Token *Tokenizer::processFunc(const Token *tok2, bool inOperator) const
tok2 = tok2->next();

while (Token::Match(tok2, "*|&") &&
!Token::Match(tok2->next(), ")|>"))
!Token::Match(tok2->next(), "[)>,]"))
tok2 = tok2->next();

// skip over namespace
Expand Down
7 changes: 7 additions & 0 deletions test/testsimplifytypedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class TestSimplifyTypedef : public TestFixture {
TEST_CASE(cfunction1);
TEST_CASE(cfunction2);
TEST_CASE(cfunction3);
TEST_CASE(cfunction4);
TEST_CASE(cfp1);
TEST_CASE(cfp2);
TEST_CASE(cfp4);
Expand Down Expand Up @@ -415,6 +416,12 @@ class TestSimplifyTypedef : public TestFixture {
ASSERT_EQUALS("[file.c:2]: (portability) It is unspecified behavior to const qualify a function type.\n", errout_str());
}

void cfunction4() {
const char code[] = "typedef int (func_t) (int);\n" // #12625
"int f(int*, func_t*, int);\n";
ASSERT_EQUALS("int f ( int * , int ( * ) ( int ) , int ) ;", simplifyTypedefC(code));
}

void cfp1() {
const char code[] = "typedef void (*fp)(void * p);\n"
"fp x;";
Expand Down