Skip to content

Commit 37e0628

Browse files
committed
Fix #13458 (Syntax error reported for function pointer array with @) (#7119)
1 parent 8d7b56f commit 37e0628

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/tokenize.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9848,7 +9848,7 @@ void Tokenizer::simplifyAt()
98489848
std::set<std::string> var;
98499849

98509850
for (Token *tok = list.front(); tok; tok = tok->next()) {
9851-
if (Token::Match(tok, "%name%|] @ %num%|%name%|%str%|(")) {
9851+
if (Token::Match(tok, "%name%|]|) @ %num%|%name%|%str%|(")) {
98529852
const Token *end = tok->tokAt(2);
98539853
if (end->isLiteral())
98549854
end = end->next();

test/testtokenize.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,8 @@ class TestTokenizer : public TestFixture {
985985

986986
ASSERT_EQUALS("int x [ 10 ] ;", tokenizeAndStringify("int x[10]@0x100;"));
987987

988+
ASSERT_EQUALS("void ( * f [ ] ) ( void ) ;", tokenizeAndStringify("void (*f[])(void)@0x100;")); // #13458
989+
988990
ASSERT_EQUALS("interrupt@ f ( ) { }", tokenizeAndStringify("@interrupt f() {}"));
989991

990992
ASSERT_EQUALS("const short MyVariable = 0xF0F0 ;", tokenizeAndStringify("const short MyVariable @ \"MYOWNSECTION\" = 0xF0F0; ")); // #12602

0 commit comments

Comments
 (0)