From 78145f612583750e25090c4d37e418db9aa9c5e2 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 13 Oct 2025 19:44:50 +0200 Subject: lex: allow ## in non func macros. and error reporting --- test/pp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test') 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; } -- cgit v1.2.3