diff options
| author | Philip <pipcet@gmail.com> | 2015-05-02 12:14:14 +0000 |
|---|---|---|
| committer | Philip <pipcet@gmail.com> | 2015-05-02 12:14:14 +0000 |
| commit | 3a922ad2ba5298e0a84b33cce7fe4bd2dc9622c2 (patch) | |
| tree | 180b4a7499ed6353352b244f2fb1285ec5af213e /tccpp.c | |
| parent | a6b94eff79d64e74505a40fb1d70d60e97d7c1f6 (diff) | |
| download | tinycc-3a922ad2ba5298e0a84b33cce7fe4bd2dc9622c2.tar.gz tinycc-3a922ad2ba5298e0a84b33cce7fe4bd2dc9622c2.tar.bz2 | |
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".
Diffstat (limited to 'tccpp.c')
| -rw-r--r-- | tccpp.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1296,7 +1296,7 @@ ST_FUNC void parse_define(void) ptok = 0; macro_list_start = 1; while (tok != TOK_LINEFEED && tok != TOK_EOF) { - if (!macro_list_start && spc == 2 && tok == TOK_TWOSHARPS) + if (macro_list_start && spc == 2 && tok == TOK_TWOSHARPS) tcc_error("'##' invalid at start of macro"); ptok = tok; /* remove spaces around ## and after '#' */ @@ -1310,9 +1310,9 @@ ST_FUNC void parse_define(void) goto skip; } tok_str_add2(&str, tok, &tokc); + macro_list_start = 0; skip: next_nomacro_spc(); - macro_list_start = 0; } if (ptok == TOK_TWOSHARPS) tcc_error("'##' invalid at end of macro"); |
