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