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