Skip to content

Commit 80560a3

Browse files
author
Bart Wiegmans
committed
C preprocessor test case
1 parent 2d3e31d commit 80560a3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

c/macro.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#define COMMA ,
2+
#define FOO(_) _(x) COMMA _(y) COMMA _(z) COMMA _(c)
3+
#define SHIFT(x) (1 << (x))
4+
#define ID(x) x
5+
static int foo[] = { FOO(ID) }
6+
#undef COMMA
7+
#define COMMA |
8+
int i = FOO(SHIFT);
9+
#undef COMMA
10+
#define COMMA
11+
#define UNDERSCORE(x) _ ## x
12+
FOO(UNDERSCORE)

0 commit comments

Comments
 (0)