Skip to content

Commit

Permalink
Fix #13458 (Syntax error reported for function pointer array with @) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
danmar committed Dec 19, 2024
1 parent 8d7b56f commit 37e0628
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9848,7 +9848,7 @@ void Tokenizer::simplifyAt()
std::set<std::string> var;

for (Token *tok = list.front(); tok; tok = tok->next()) {
if (Token::Match(tok, "%name%|] @ %num%|%name%|%str%|(")) {
if (Token::Match(tok, "%name%|]|) @ %num%|%name%|%str%|(")) {
const Token *end = tok->tokAt(2);
if (end->isLiteral())
end = end->next();
Expand Down
2 changes: 2 additions & 0 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,8 @@ class TestTokenizer : public TestFixture {

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

ASSERT_EQUALS("void ( * f [ ] ) ( void ) ;", tokenizeAndStringify("void (*f[])(void)@0x100;")); // #13458

ASSERT_EQUALS("interrupt@ f ( ) { }", tokenizeAndStringify("@interrupt f() {}"));

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

0 comments on commit 37e0628

Please sign in to comment.