diff options
author | Ori Bernstein <ori@eigenstate.org> | 2020-03-17 22:03:25 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2020-03-17 22:03:25 -0700 |
commit | 37b86df09ff381bcc4f60802d43e57bd9bfcac73 (patch) | |
tree | 76065637ec0ea0d646ec783c00a156f9702968c7 /sys/src/cmd/cpp/test.expected | |
parent | 52dc943702a8f7815546e76286b153c3813e1db0 (diff) |
Improve the posix preprocessor.
This fixes token pasting, making it expand when
it should expand, and paste before expansion when
it should paste before expanding.
#define CAT(a, b) a ## b
#define BAR 3
#define FOO CAT(BAR, 3)
FOO
now produces 33, while
#define CAT(a, b) a ## b
#define EOF (-1)
#define NOP(x) x
NOP(CAT(foo, EOF))
CAT(,EOF)
CAT(,)
produces
fooEOF
(-1)
<empty>
respectively.
Diffstat (limited to 'sys/src/cmd/cpp/test.expected')
-rw-r--r-- | sys/src/cmd/cpp/test.expected | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/sys/src/cmd/cpp/test.expected b/sys/src/cmd/cpp/test.expected new file mode 100644 index 000000000..bf4b3aa99 --- /dev/null +++ b/sys/src/cmd/cpp/test.expected @@ -0,0 +1,49 @@ +#line 1 "/usr/ori/src/cpp/test.c" + + + +x fooEOF y +x EOFfoo y +x(-1) y +y foo x +x foo y +X y + + + foobar + + +foo ## bar + + + ablahb + + + + 33 + + +#line 32 "/usr/ori/src/cpp/test.c" + + + + + a,b + + + + + + + + + + + + + + + + f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); + f(2 * (2+(3,4)- 0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^ m(0,1); +#line 55 "/usr/ori/src/cpp/test.c" |