]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - tests/pp_va_args.qc
adding 'final'
[xonotic/gmqcc.git] / tests / pp_va_args.qc
index 6e4002cf4315ca5384a1785ca908644e606038d4..a42e1927938e2c1e499d81f64444ff9da92aea01 100644 (file)
@@ -1,5 +1,3 @@
-void print(...) = #1;
-
 // method 0
 #define METHOD__(...) __VA_ARGS__
 #define METHOD_0(F,A) F METHOD__(A)
@@ -13,9 +11,12 @@ void print(...) = #1;
 // method 3
 #define METHOD_3(F,...) F __VA_ARGS__
 
+// selector
+#define METHOD(I, F, ...) METHOD_##I (F, __VA_ARGS__)
+
 void main() {
-    METHOD_0(print, ("Method", " <zero>\n"));
-    METHOD_1(print, ("Method", " <one>\n"));
-    METHOD_2(print, ("Method", " <two>\n"));
-    METHOD_3(print, ("Method", " <three>\n"));
+    METHOD(0, print, ("Method", " <zero>\n"));
+    METHOD(1, print, ("Method", " <one>\n"));
+    METHOD(2, print, ("Method", " <two>\n"));
+    METHOD(3, print, ("Method", " <three>\n"));
 }