diff options
| author | 2026-02-23 20:33:42 +0100 | |
|---|---|---|
| committer | 2026-02-23 20:33:42 +0100 | |
| commit | 4e9020dfb847d80475415f9f5914efaa50238767 (patch) | |
| tree | 2929decccea0182ea83da656c926211168e941f7 /test/07-pp.c | |
| parent | 821db6af0a5b1894152c772d765762b7bdbf5d93 (diff) | |
cpp: add __COUNTER__ macro
Diffstat (limited to 'test/07-pp.c')
| -rw-r--r-- | test/07-pp.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/07-pp.c b/test/07-pp.c index b1afa17..be1dfe0 100644 --- a/test/07-pp.c +++ b/test/07-pp.c @@ -7,6 +7,8 @@ join: "x ## y" wide L"abc123 猫,€á💫", U+1f98b Output ends here ok ... +11 +11 */ #include "07-pp.h" @@ -62,6 +64,11 @@ static void f(void) { (void)strchr("",0); } +#define xcat(a,b) CAT(a,b) +#define uniq(p) xcat(p,__COUNTER__) +#define xcountertest(f) int f; f = 11; printf("%d\n", f); +#define countertest(v) xcountertest(uniq(v)) + #ifdef CMD_WORKING int main(V) @@ -93,5 +100,8 @@ S\ ); gnu_ext(printf, "ok %s", "...") gnu_ext(printf, "\n"); + countertest(ww); + countertest(ww); + CAT(ret,urn) 0; } |