aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/07-pp.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-03-01 11:07:45 +0100
committerlemon <lsof@mailbox.org>2026-03-01 11:09:02 +0100
commit1ebf3669f92e7ea0cf9ef97e4d61ee24db2f0b6a (patch)
tree3bd215daa826a93f3dc488909ea45bcd4c47c5cc /test/07-pp.c
parent80177ee3b38b9ab7ce6bc5c5ab9bec8f431ef77a (diff)
cpp: fix token spacing (#2) (hopefully)
Diffstat (limited to 'test/07-pp.c')
-rw-r--r--test/07-pp.c24
1 files changed, 24 insertions, 0 deletions
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;
}