diff options
| author | Michael Matz <matz@suse.de> | 2016-10-31 03:59:31 +0100 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:49:56 +0100 |
| commit | 3e77bfb6e9b286bbb53377fb5d7343e58ba34127 (patch) | |
| tree | f8798307b10322c629c01217dafb36b3ab013a84 /tests/pp | |
| parent | 3db037387c16c7e582f76167d32d5c29ac32fb15 (diff) | |
| download | tinycc-3e77bfb6e9b286bbb53377fb5d7343e58ba34127.tar.gz tinycc-3e77bfb6e9b286bbb53377fb5d7343e58ba34127.tar.bz2 | |
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).
Diffstat (limited to 'tests/pp')
| -rw-r--r-- | tests/pp/17.c | 14 | ||||
| -rw-r--r-- | tests/pp/17.expect | 6 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/pp/17.c b/tests/pp/17.c new file mode 100644 index 0000000..f12196f --- /dev/null +++ b/tests/pp/17.c @@ -0,0 +1,14 @@ +#define STR1(u) # u +#define pass(a) a +#define __ASM_REG(reg) STR1(one##reg) +#define _ASM_DX __ASM_REG(tok) +X162 pass(__ASM_REG(tok)) +X161 pass(_ASM_DX) +X163 pass(STR1(one##tok)) + +X170 pass(x ## y) +X171 pass(x pass(##) y) + +#define Y(x) Z(x) +#define X Y +X180 return X(X(1)); diff --git a/tests/pp/17.expect b/tests/pp/17.expect new file mode 100644 index 0000000..e95aafe --- /dev/null +++ b/tests/pp/17.expect @@ -0,0 +1,6 @@ +X162 "onetok" +X161 "onetok" +X163 "one##tok" +X170 x ## y +X171 x ## y +X180 return Z(Z(1)); |
