blob: 21e59e148126fb1520e618ca17faa784e7f63df0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// variadic-macro.slang
//DIAGNOSTIC_TEST:SIMPLE:-E
// First we text a variadic macro with the default variadic
// parameter name (`__VA_ARGS__`) and other non-variadic parameter.
#define A(X, ...) (X ; __VA_ARGS__)
A(1, 2, 3)
// Next we test a varadic macro where the variadic parameter
// has been given an explicit name.
#define B(B_ARGS...) (B_ARGS)
B(4, 5)
// Finally, we test the case where the variadic parameter
// might have zero arguments passed for it, so that
// the result produces a trailing comma.
//
// TODO: If we add support for deleting trailing commas
// in these cases to Slang, we can update this case to
// test that support.
#define C(Y, ARGS...) (Y , ARGS)
C(1)
C(2, 3)
C(4, 5, 6)
|