aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-10-13 19:44:50 +0200
committerlemon <lsof@mailbox.org>2025-10-13 19:46:19 +0200
commit78145f612583750e25090c4d37e418db9aa9c5e2 (patch)
treedd853a7044e7c5040f53d9f5b1e8c6728cc5e5bc /test
parent9812f88a9a612144bea02c7acf499867eb0cbeb9 (diff)
lex: allow ## in non func macros. and error reporting
Diffstat (limited to 'test')
-rw-r--r--test/pp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/pp.c b/test/pp.c
index 0aa5287..7c34542 100644
--- a/test/pp.c
+++ b/test/pp.c
@@ -8,6 +8,11 @@
#define CATr(a) foo##a
#define CAT(a,b) a##b
+#define hash_hash # ## #
+#define mkstr(a) # a
+#define in_between(a) mkstr(a)
+#define join(c, d) in_between(c hash_hash d)
+char p[] = join(x, y); // equivalent to char p[] = "x ## y";
int
main(void)
@@ -20,5 +25,7 @@ main(void)
05.5), STR(ADD(1,2)));
hi(ADD(Foo, SQR(Bar+1)));
int foo123 = 77;
- printf("%s %s %g\n", str(Foo,5), xstr(Foo), CAT(1.5,e3f) + CAT(7,)-CAT(1,));
+ printf("%s %s %g\n", str(Foo,5), xstr(Foo), CAT(1.5,e3f) + CAT(7,)-CAT(,1));
+ printf("join: \"%s\"\n", p);
+ CAT(ret,urn) 0;
}