]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - misc/source/gmqcc-src/tests/noreturn.qc
By fteqcc, hello gmqcc
[voretournament/voretournament.git] / misc / source / gmqcc-src / tests / noreturn.qc
diff --git a/misc/source/gmqcc-src/tests/noreturn.qc b/misc/source/gmqcc-src/tests/noreturn.qc
new file mode 100644 (file)
index 0000000..ae614e7
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef NORETURN
+#define NORETURN [[noreturn]]
+#endif
+
+void   (...)            print     = #1;
+string (float)          ftos      = #2;
+
+
+NORETURN void error(...)  = #6;
+
+#if TEST == 1
+void test1(float a) {
+    float x;
+
+    if (a == 1)       x = 1337;
+    else if (a == 2)  x = 1338;
+    else
+        error("Error\n");
+    print("Is this initialized: ", ftos(x), "\n");
+}
+
+#else
+
+float test2(float it) {
+    switch (it) {
+        case 1: return 0;
+        case 2: return 1;
+        default: error("End of non-void not reachable...\n");
+    }
+}
+#endif