]> git.xonotic.org Git - xonotic/gmqcc.git/blob - tests/pp_va_args.qc
test for the simple __FUNC__ case
[xonotic/gmqcc.git] / tests / pp_va_args.qc
1 // method 0
2 #define METHOD__(...) __VA_ARGS__
3 #define METHOD_0(F,A) F METHOD__(A)
4
5 // method 1
6 #define METHOD_1(F,A) F(METHOD__ A)
7
8 // method 2
9 #define METHOD_2(F,...) F __VA_ARGS__##[0]
10
11 // method 3
12 #define METHOD_3(F,...) F __VA_ARGS__
13
14 // selector
15 #define METHOD(I, F, ...) METHOD_##I (F, __VA_ARGS__)
16
17 void main() {
18     METHOD(0, print, ("Method", " <zero>\n"));
19     METHOD(1, print, ("Method", " <one>\n"));
20     METHOD(2, print, ("Method", " <two>\n"));
21     METHOD(3, print, ("Method", " <three>\n"));
22 }