tccpp: Fix token pasting

See testcase.  We must always paste tokens (at least if not
currently substing a normal argument, which is a speed optimization
only now) but at the same time must not regard a ## token
coming from argument expansion as the token-paste operator, nor
if we constructed a ## token due to pasting itself (that was already
checked by pp/01.c).
This commit is contained in:
Michael Matz
2016-10-31 03:59:31 +01:00
parent 3db037387c
commit 3e77bfb6e9
4 changed files with 29 additions and 7 deletions

1
tcc.h
View File

@ -899,6 +899,7 @@ struct filespec {
#define TOK_TWOSHARPS 0xca /* ## preprocessing token */
#define TOK_PLCHLDR 0xcb /* placeholder token as defined in C99 */
#define TOK_NOSUBST 0xcc /* means following token has already been pp'd */
#define TOK_PPJOIN 0xce /* A '##' in the right position to mean pasting */
#define TOK_SHL 0x01 /* shift left */
#define TOK_SAR 0x02 /* signed shift right */