From 1ebf3669f92e7ea0cf9ef97e4d61ee24db2f0b6a Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 1 Mar 2026 11:07:45 +0100 Subject: cpp: fix token spacing (#2) (hopefully) --- test/07-pp.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/07-pp.c') diff --git a/test/07-pp.c b/test/07-pp.c index 3d2534a..2458111 100644 --- a/test/07-pp.c +++ b/test/07-pp.c @@ -9,6 +9,11 @@ Output ends here ok ... 11 11 +token spacing: +++ -- ++ === (0)~> ++ 3>0$ +sum = 1 + 2 +3;$ +[ baz]$ ++. *$ */ #include "07-pp.h" @@ -104,5 +109,24 @@ S\ countertest/* comment */(ww); +#define PLUS + +#define EMPTY + (void)+PLUS(0); /* (void) + + 0 */ + printf("token spacing:\n" +#define f(x) =x= +#define g(t,k) t##k> + xstr(+PLUS -EMPTY- PLUS+ f(=) (0)g(,~) g(+,+ 3)0) "$\n" +#define add(x, y, z) x + y +z; + xstr(sum = add (1,2, 3)) "$\n" +#define foo bar +#define bar EMPTY baz +#define EMPTY + xstr([foo] EMPTY) "$\n" +#define qx1(...)/**/__VA_ARGS__ +#define qx2(a) qx1 ( a ) + xstr(+qx2 ( .)// +qx2(*) ) "$\n" + ); + CAT(ret,urn) 0; } -- cgit v1.2.3