]> git.xonotic.org Git - xonotic/gmqcc.git/blob - tests/noreturn.qc
Merge branch 'cooking'
[xonotic/gmqcc.git] / tests / noreturn.qc
1 #ifndef NORETURN
2 #define NORETURN [[noreturn]]
3 #endif
4
5 void   (...)            print     = #1;
6 string (float)          ftos      = #2;
7
8
9 NORETURN void error(...)  = #6;
10
11 #if TEST == 1
12 void test1(float a) {
13     float x;
14
15     if (a == 1)       x = 1337;
16     else if (a == 2)  x = 1338;
17     else
18         error("Error\n");
19     print("Is this initialized: ", ftos(x), "\n");
20 }
21
22 #else
23
24 float test2(float it) {
25     switch (it) {
26         case 1: return 0;
27         case 2: return 1;
28         default: error("End of non-void not reachable...\n");
29     }
30 }
31 #endif