Match C's preprocessor semantics for token pasting with '##'.
[xonotic/gmqcc.git] / tests / pmacros.qc
1 /* will never happen unless blown up */
2 #ifndef GMQCC
3     void() main = { error-gmqcc-is-not-defined; };
4 #else
5     const string standard =
6 #   ifdef __STD_QCC__
7         "qcc"
8 #   else
9 #       ifdef __STD_GMQCC__
10             "gmqcc"
11 #       else
12 #           ifdef __STD_FTEQCC__
13                 "fteqcc"
14 #           else
15             "unknown"
16 #           endif
17 #       endif
18 #   endif
19     ;
20     const string verminor = __STD_VERSION_MINOR__;
21     const string vermajor = __STD_VERSION_MAJOR__;
22
23 #   define ALPHA_a "a"
24 #   define ALPHA_b "b"
25 #   define ALPHA_c "c"
26
27 #   define ALPHA(SEL) ALPHA_##SEL
28
29 #   define ABC ALPHA(a)ALPHA(b)ALPHA(c)
30
31     void() main = {
32         if (ABC == "abc")
33             print("ABC\n");
34         if (standard != "unknown")
35             print("123\n");
36     };
37 #endif