picox  0.1
xcompiler.h
1 
14 /*
15  * License: MIT license
16  * Copyright (c) <2015> <MaskedW [maskedw00@gmail.com]>
17  *
18  * Permission is hereby granted, free of charge, to any person
19  * obtaining a copy of this software and associated documentation
20  * files (the "Software"), to deal in the Software without
21  * restriction, including without limitation the rights to use, copy,
22  * modify, merge, publish, distribute, sublicense, and/or sell copies
23  * of the Software, and to permit persons to whom the Software is
24  * furnished to do so, subject to the following conditions:
25  *
26  * The above copyright notice and this permission notice shall be
27  * included in all copies or substantial portions of the Software.
28  *
29  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
33  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
34  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
35  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36  * SOFTWARE.
37  */
38 
39 
40 #ifndef picox_core_detail_xcompiler_h_
41 #define picox_core_detail_xcompiler_h_
42 
43 
60 #ifdef __STDC_VERSION__
61  #if (__STDC_VERSION__ >= 199901L)
62  #define X_COMPILER_C99 (1)
63  #else
64  #define X_COMPILER_C99 (0)
65  #endif
66 #else
67  #define X_COMPILER_C99 (0)
68 #endif
69 
70 
74 #if defined __GNUC__ && defined __GNUC_MINOR__
75  #define X_GNUC_PREREQ(maj, min) \
76  ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
77 #else
78  #define X_GNUC_PREREQ(maj, min) 0
79 #endif
80 
81 
82 /* コンパイラごとの設定のロード */
83 #if defined(__GNUC__)
84 
85  #include <picox/core/detail/compiler/xgcc.h>
86 
87 #elif defined(__RENESAS__)
88 
90 
91 #endif
92 
93 
99 #ifndef X_INLINE
100  #define X_INLINE static inline
101 #endif
102 
103 
110 #ifndef X_ALWAYS_INLINE
111  #define X_ALWAYS_INLINE static inline
112 #endif
113 
114 
124 #ifndef X_HAS_VARIADIC_MACROS
125  #if X_COMPILER_C99 > 0
126  #define X_HAS_VARIADIC_MACROS (1)
127  #endif
128 #endif
129 
130 
136 #ifndef X_HAS_TYPEOF
137  #define X_HAS_TYPEOF (0)
138 #endif
139 
140 
147 #ifndef X_LIKELY
148  #define X_LIKELY(x) x
149 #endif
150 
151 
157 #ifndef X_UNLIKELY
158  #define X_UNLIKELY(x) x
159 #endif
160 
161 
181 #ifndef X_HAS_STATEMENT_EXPRESSIONS
182  #define X_HAS_STATEMENT_EXPRESSIONS (0)
183 #endif
184 
185 
189 #ifndef X_MEMORY_BARRIER
190  #define X_MEMORY_BARRIER
191 #endif
192 
193 
197 #ifndef X_UNREACHABE
198  #define X_UNREACHABE for (;;)
199 #endif
200 
201 
214 #ifndef X_DEPRECATED
215  #define X_DEPRECATED
216 #endif
217 
218 
219 #ifndef X_FUNC
220  #define X_FUNC __func__
221 #endif
222 
223 
252 #ifndef X_PACKED_PRE_BEGIN
253  #define X_PACKED_PRE_BEGIN
254 #endif
255 
256 
257 #ifndef X_PACKED_POST_BEGIN
258  #define X_PACKED_POST_BEGIN
259 #endif
260 
261 
262 #ifndef X_PACKED_PRE_END
263  #define X_PACKED_PRE_END
264 #endif
265 
266 
267 #ifndef X_PACKED_POST_END
268  #define X_PACKED_POST_END
269 #endif
270 
274 #ifndef NULL
275  #define NULL ((void*)0)
276 #endif
277 
278 
279 #ifndef EOF
280  #define EOF (-1)
281 #endif
282 
283 
289 #endif // picox_core_detail_xcompiler_h_