You.i Engine
YiPreprocessorMacros.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_PREPROCESSOR_MACROS_H_
3 #define _YI_PREPROCESSOR_MACROS_H_
4 
10 #if defined(DOXY)
11 
24 # define YI_MAKE_VARIADIC_MACRO(fn, ...)
25 
26 #else
27 
28 # define YI_EXPAND_ARGUMENTS(x) x
29 # define YI_MAKE_VARIADIC_MACRO(fn, ...) YI_EXPAND_ARGUMENTS(YI_MAKE_VARIADIC_MACRO_N(fn, ##__VA_ARGS__, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)(__VA_ARGS__))
30 # define YI_MAKE_VARIADIC_MACRO_N(fn, n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19, n20, n21, n22, n23, n24, n25, n26, n27, n28, n29, n30, n31, n32, n33, n34, n35, n36, n37, n38, n39, n40, n41, n42, n43, n44, n45, n46, n47, n48, n49, n50, n51, n52, n53, n54, n55, n56, n57, n58, n59, n60, n61, n, ...) fn##n
31 
32 #endif
33 
34 #if defined(DOXY)
35 
49 # define YI_MAKE_VARIADIC_MACRO_2(fn, ...)
50 
51 #else
52 
53 # define YI_MAKE_VARIADIC_MACRO_2(fn, ...) YI_EXPAND_ARGUMENTS(YI_MAKE_VARIADIC_MACRO_N(fn, ##__VA_ARGS__, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0)(__VA_ARGS__))
54 
55 #endif
56 
57 #if defined(DOXY)
58 
69 # define YI_STRINGIFY(x)
70 
71 #else
72 
73 # define YI_STRINGIFY_INNER(x) # x
74 # define YI_STRINGIFY(x) YI_STRINGIFY_INNER(x)
75 
76 #endif
77 
78 #if defined(DOXY)
79 
88 # define YI_CONCATENATE
89 
90 #else
91 
92 # define YI_CONCATENATE_INNER(x, y) x##y
93 # define YI_CONCATENATE(x, y) YI_CONCATENATE_INNER(x, y)
94 
95 #endif
96 
97 #if defined(DOXY)
98 
108 # define YI_STATIC_ASSERT(EXPRESSION, MSG)
109 
110 #else
111 
112 # define YI_STATIC_ASSERT(EXPRESSION, MSG) static_assert((EXPRESSION), YI_STRINGIFY(MSG))
113 
114 #endif
115 
116 #if defined(DOXY)
117 
126 # define YI_WARNING(MSG)
127 
136 # define YI_ERROR(MSG)
137 
138 #else
139 
140 # if defined(_MSC_VER)
141 # define YI_PRAGMA(x) __pragma(x)
142 # define YI_WARNING(MSG) YI_PRAGMA(message(__FILE__ "(" YI_STRINGIFY(__LINE__) ") : warning c0000:" MSG))
143 # define YI_ERROR(MSG) YI_PRAGMA(message(__FILE__ "(" YI_STRINGIFY(__LINE__) ") : error c0000:" MSG))
144 # else
145 # define YI_PRAGMA(x) _Pragma(# x)
146 # define YI_WARNING(MSG) YI_PRAGMA(GCC warning MSG)
147 # define YI_ERROR(MSG) YI_PRAGMA(GCC error MSG)
148 # endif
149 
150 #endif
151 
163 #define YI_ENSURE_STRING_LITERAL(x) "" x ""
164 
167 #endif