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".
Unified · Split
| @@ -1296,7 +1296,7 @@ ST_FUNC void parse_define(void) · 1295 unmodified lines | ||
| 1296 | 1296 | ptok = 0; |
| 1297 | 1297 | macro_list_start = 1; |
| 1298 | 1298 | 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) | |
| 1300 | 1300 | tcc_error("'##' invalid at start of macro"); |
| 1301 | 1301 | ptok = tok; |
| 1302 | 1302 | /* remove spaces around ## and after '#' */ |
| @@ -1310,9 +1310,9 @@ ST_FUNC void parse_define(void) · 7 unmodified lines | ||
| 1310 | 1310 | goto skip; |
| 1311 | 1311 | } |
| 1312 | 1312 | tok_str_add2(&str, tok, &tokc); |
| 1313 | + macro_list_start = 0; | |
| 1313 | 1314 | skip: |
| 1314 | 1315 | next_nomacro_spc(); |
| 1315 | − macro_list_start = 0; | |
| 1316 | 1316 | } |
| 1317 | 1317 | if (ptok == TOK_TWOSHARPS) |
| 1318 | 1318 | tcc_error("'##' invalid at end of macro"); |