History

tccpp.c: fix ##-in-macros logic

The old code had an inverted condition, so #define a(b)## b would be accepted while #define a(b,c) b ## ## c would be rejected with the confusing error message "'##' invalid at start of macro".

Philip committed 11 years ago

Commit 3a922ad1 parent a6b94ef1 file · +2 −2Browse files

Unified · Split

tccpp.c+2−2
@@ -1296,7 +1296,7 @@ ST_FUNC void parse_define(void) · 1295 unmodified lines
12961296 ptok = 0;
12971297 macro_list_start = 1;
12981298 while (tok != TOK_LINEFEED && tok != TOK_EOF) {
1299− if (!macro_list_start && spc == 2 && tok == TOK_TWOSHARPS)
1299+ if (macro_list_start && spc == 2 && tok == TOK_TWOSHARPS)
13001300 tcc_error("'##' invalid at start of macro");
13011301 ptok = tok;
13021302 /* remove spaces around ## and after '#' */
@@ -1310,9 +1310,9 @@ ST_FUNC void parse_define(void) · 7 unmodified lines
13101310 goto skip;
13111311 }
13121312 tok_str_add2(&str, tok, &tokc);
1313+ macro_list_start = 0;
13131314 skip:
13141315 next_nomacro_spc();
1315− macro_list_start = 0;
13161316 }
13171317 if (ptok == TOK_TWOSHARPS)
13181318 tcc_error("'##' invalid at end of macro");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t