You.i Engine
YiPreprocessorMacros.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_PREPROCESSOR_MACROS_H_
3 #define _YI_PREPROCESSOR_MACROS_H_
4 
28 #if ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) || defined(__clang__))
29 # define YI_GCC_DIAGNOSTIC_AWARE 1
30 #else
31 # define YI_GCC_DIAGNOSTIC_AWARE 0
32 #endif
33 
34 #if defined(DOXY)
35 
48 # define YI_MAKE_VARIADIC_MACRO(fn, ...)
49 
50 #else
51 
52 # define YI_EXPAND_ARGUMENTS(x) x
53 # 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__))
54 # 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
55 
56 #endif
57 
58 #if defined(DOXY)
59 
73 # define YI_MAKE_VARIADIC_MACRO_2(fn, ...)
74 
75 #else
76 
77 # 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__))
78 
79 #endif
80 
81 #if defined(DOXY)
82 
93 # define YI_STRINGIFY(x)
94 
95 #else
96 
97 # define YI_STRINGIFY_INNER(x) # x
98 # define YI_STRINGIFY(x) YI_STRINGIFY_INNER(x)
99 
100 #endif
101 
102 #if defined(DOXY)
103 
112 # define YI_CONCATENATE
113 
114 #else
115 
116 # define YI_CONCATENATE_INNER(x, y) x##y
117 # define YI_CONCATENATE(x, y) YI_CONCATENATE_INNER(x, y)
118 
119 #endif
120 
121 #if defined(DOXY)
122 
132 # define YI_STATIC_ASSERT(EXPRESSION, MSG)
133 
134 #else
135 
136 # define YI_STATIC_ASSERT(EXPRESSION, MSG) static_assert((EXPRESSION), YI_STRINGIFY(MSG))
137 
138 #endif
139 
140 #if defined(DOXY)
141 
150 # define YI_WARNING(MSG)
151 
160 # define YI_ERROR(MSG)
161 
162 #else
163 
164 # if defined(_MSC_VER)
165 # define YI_PRAGMA(x) __pragma(x)
166 # define YI_WARNING(MSG) YI_PRAGMA(message(__FILE__ "(" YI_STRINGIFY(__LINE__) ") : warning c0000:" MSG))
167 # define YI_ERROR(MSG) YI_PRAGMA(message(__FILE__ "(" YI_STRINGIFY(__LINE__) ") : error c0000:" MSG))
168 # else
169 # define YI_PRAGMA(x) _Pragma(# x)
170 # define YI_WARNING(MSG) YI_PRAGMA(GCC warning MSG)
171 # define YI_ERROR(MSG) YI_PRAGMA(GCC error MSG)
172 # endif
173 
174 #endif
175 
187 #define YI_ENSURE_STRING_LITERAL(x) "" x ""
188 
191 #endif