aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-09-10 20:15:56 +0200
committerlemon <lsof@mailbox.org>2025-09-10 22:41:39 +0200
commit5bcdee9f0702e4f54897166250898475f0d26ca3 (patch)
treeabc9087456157ab2b182b25a3ab65c3dfcf4433b /test
parent3fc3b2680581a59b3d08244a190d5d7bdcf80e45 (diff)
lex: stringify args in function macros
Diffstat (limited to 'test')
-rw-r--r--test/pp.c2
-rw-r--r--test/pp.h9
2 files changed, 8 insertions, 3 deletions
diff --git a/test/pp.c b/test/pp.c
index 2e6193e..f850c08 100644
--- a/test/pp.c
+++ b/test/pp.c
@@ -5,5 +5,7 @@
int
main(void)
{
+ printf("%s\n",STR ( ok /1 "\n"\n ;.&
+ 05.5));
hi(ADD(Foo, SQR(Bar+1)));
}
diff --git a/test/pp.h b/test/pp.h
index e914800..5ac7aac 100644
--- a/test/pp.h
+++ b/test/pp.h
@@ -1,18 +1,21 @@
#ifndef GUARD
#define GUARD
+extern int printf(const char *, ...);
extern warnhere();
#define Foo 9
void hi(int x) {
- extern int printf(const char *, ...);
printf("hi from header ;%d\n", x);
}
#if 1
#endif
#elifndef Ww
#define Bar 7
-#define SQR_(x) (x)*(x)
-#define SQR(y) SQR_(y)
+#define SQR_(x) ((x)*(x))
+#define SQR(y) SQR_(1+(y)-1)
#define ADD(a,b) (a)+(b)
+#define STR(h) #h
#endif
+
+extern int printf(const char *, ...);