xref: /minix3/external/bsd/llvm/dist/clang/test/Preprocessor/dump_macros.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -E -dM %s -o - | FileCheck %s -strict-whitespace
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // Space at end even without expansion tokens
4*f4a2713aSLionel Sambuc // CHECK: #define A(x)
5*f4a2713aSLionel Sambuc #define A(x)
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc // Space before expansion list.
8*f4a2713aSLionel Sambuc // CHECK: #define B(x,y) x y
9*f4a2713aSLionel Sambuc #define B(x,y)x y
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc // No space in argument list.
12*f4a2713aSLionel Sambuc // CHECK: #define C(x,y) x y
13*f4a2713aSLionel Sambuc #define C(x, y) x y
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc // No paste avoidance.
16*f4a2713aSLionel Sambuc // CHECK: #define D() ..
17*f4a2713aSLionel Sambuc #define D() ..
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc // Simple test.
20*f4a2713aSLionel Sambuc // CHECK: #define E .
21*f4a2713aSLionel Sambuc // CHECK: #define F X()Y
22*f4a2713aSLionel Sambuc #define E .
23*f4a2713aSLionel Sambuc #define F X()Y
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc // gcc prints macros at end of translation unit, so last one wins.
26*f4a2713aSLionel Sambuc // CHECK: #define G 2
27*f4a2713aSLionel Sambuc #define G 1
28*f4a2713aSLionel Sambuc #undef G
29*f4a2713aSLionel Sambuc #define G 2
30*f4a2713aSLionel Sambuc 
31*f4a2713aSLionel Sambuc // Variadic macros of various sorts. PR5699
32*f4a2713aSLionel Sambuc 
33*f4a2713aSLionel Sambuc // CHECK: H(x,...) __VA_ARGS__
34*f4a2713aSLionel Sambuc #define H(x, ...) __VA_ARGS__
35*f4a2713aSLionel Sambuc // CHECK: I(...) __VA_ARGS__
36*f4a2713aSLionel Sambuc #define I(...) __VA_ARGS__
37*f4a2713aSLionel Sambuc // CHECK: J(x...) __VA_ARGS__
38*f4a2713aSLionel Sambuc #define J(x ...) __VA_ARGS__
39