1 | /** @file
|
---|
2 | * IPRT - Common C and C++ definitions.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2020 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef IPRT_INCLUDED_cdefs_h
|
---|
27 | #define IPRT_INCLUDED_cdefs_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 |
|
---|
33 | /** @defgroup grp_rt_cdefs IPRT Common Definitions and Macros
|
---|
34 | * @{
|
---|
35 | */
|
---|
36 |
|
---|
37 | /** @def RT_C_DECLS_BEGIN
|
---|
38 | * Used to start a block of function declarations which are shared
|
---|
39 | * between C and C++ program.
|
---|
40 | */
|
---|
41 |
|
---|
42 | /** @def RT_C_DECLS_END
|
---|
43 | * Used to end a block of function declarations which are shared
|
---|
44 | * between C and C++ program.
|
---|
45 | */
|
---|
46 |
|
---|
47 | #if defined(__cplusplus)
|
---|
48 | # define RT_C_DECLS_BEGIN extern "C" {
|
---|
49 | # define RT_C_DECLS_END }
|
---|
50 | #else
|
---|
51 | # define RT_C_DECLS_BEGIN
|
---|
52 | # define RT_C_DECLS_END
|
---|
53 | #endif
|
---|
54 |
|
---|
55 |
|
---|
56 | /*
|
---|
57 | * Shut up DOXYGEN warnings and guide it properly thru the code.
|
---|
58 | */
|
---|
59 | #ifdef DOXYGEN_RUNNING
|
---|
60 | # define __AMD64__
|
---|
61 | # define __X86__
|
---|
62 | # define RT_ARCH_AMD64
|
---|
63 | # define RT_ARCH_X86
|
---|
64 | # define RT_ARCH_SPARC
|
---|
65 | # define RT_ARCH_SPARC64
|
---|
66 | # define IN_RING0
|
---|
67 | # define IN_RING3
|
---|
68 | # define IN_RC
|
---|
69 | # define IN_RT_RC
|
---|
70 | # define IN_RT_R0
|
---|
71 | # define IN_RT_R3
|
---|
72 | # define IN_RT_STATIC
|
---|
73 | # define RT_STRICT
|
---|
74 | # define RT_NO_STRICT
|
---|
75 | # define RT_LOCK_STRICT
|
---|
76 | # define RT_LOCK_NO_STRICT
|
---|
77 | # define RT_LOCK_STRICT_ORDER
|
---|
78 | # define RT_LOCK_NO_STRICT_ORDER
|
---|
79 | # define RT_BREAKPOINT
|
---|
80 | # define RT_NO_DEPRECATED_MACROS
|
---|
81 | # define RT_EXCEPTIONS_ENABLED
|
---|
82 | # define RT_BIG_ENDIAN
|
---|
83 | # define RT_LITTLE_ENDIAN
|
---|
84 | # define RT_COMPILER_GROKS_64BIT_BITFIELDS
|
---|
85 | # define RT_COMPILER_WITH_80BIT_LONG_DOUBLE
|
---|
86 | # define RT_NO_VISIBILITY_HIDDEN
|
---|
87 | # define RT_GCC_SUPPORTS_VISIBILITY_HIDDEN
|
---|
88 | # define RT_COMPILER_SUPPORTS_VA_ARGS
|
---|
89 | # define RT_COMPILER_SUPPORTS_LAMBDA
|
---|
90 | #endif /* DOXYGEN_RUNNING */
|
---|
91 |
|
---|
92 | /** @def RT_ARCH_X86
|
---|
93 | * Indicates that we're compiling for the X86 architecture.
|
---|
94 | */
|
---|
95 |
|
---|
96 | /** @def RT_ARCH_AMD64
|
---|
97 | * Indicates that we're compiling for the AMD64 architecture.
|
---|
98 | */
|
---|
99 |
|
---|
100 | /** @def RT_ARCH_SPARC
|
---|
101 | * Indicates that we're compiling for the SPARC V8 architecture (32-bit).
|
---|
102 | */
|
---|
103 |
|
---|
104 | /** @def RT_ARCH_SPARC64
|
---|
105 | * Indicates that we're compiling for the SPARC V9 architecture (64-bit).
|
---|
106 | */
|
---|
107 | #if !defined(RT_ARCH_X86) \
|
---|
108 | && !defined(RT_ARCH_AMD64) \
|
---|
109 | && !defined(RT_ARCH_SPARC) \
|
---|
110 | && !defined(RT_ARCH_SPARC64) \
|
---|
111 | && !defined(RT_ARCH_ARM)
|
---|
112 | # if defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || defined(__AMD64__)
|
---|
113 | # define RT_ARCH_AMD64
|
---|
114 | # elif defined(__i386__) || defined(_M_IX86) || defined(__X86__)
|
---|
115 | # define RT_ARCH_X86
|
---|
116 | # elif defined(__sparcv9)
|
---|
117 | # define RT_ARCH_SPARC64
|
---|
118 | # elif defined(__sparc__)
|
---|
119 | # define RT_ARCH_SPARC
|
---|
120 | # elif defined(__arm__) || defined(__arm32__)
|
---|
121 | # define RT_ARCH_ARM
|
---|
122 | # else /* PORTME: append test for new archs. */
|
---|
123 | # error "Check what predefined macros your compiler uses to indicate architecture."
|
---|
124 | # endif
|
---|
125 | /* PORTME: append new archs checks. */
|
---|
126 | #elif defined(RT_ARCH_X86) && defined(RT_ARCH_AMD64)
|
---|
127 | # error "Both RT_ARCH_X86 and RT_ARCH_AMD64 cannot be defined at the same time!"
|
---|
128 | #elif defined(RT_ARCH_X86) && defined(RT_ARCH_SPARC)
|
---|
129 | # error "Both RT_ARCH_X86 and RT_ARCH_SPARC cannot be defined at the same time!"
|
---|
130 | #elif defined(RT_ARCH_X86) && defined(RT_ARCH_SPARC64)
|
---|
131 | # error "Both RT_ARCH_X86 and RT_ARCH_SPARC64 cannot be defined at the same time!"
|
---|
132 | #elif defined(RT_ARCH_AMD64) && defined(RT_ARCH_SPARC)
|
---|
133 | # error "Both RT_ARCH_AMD64 and RT_ARCH_SPARC cannot be defined at the same time!"
|
---|
134 | #elif defined(RT_ARCH_AMD64) && defined(RT_ARCH_SPARC64)
|
---|
135 | # error "Both RT_ARCH_AMD64 and RT_ARCH_SPARC64 cannot be defined at the same time!"
|
---|
136 | #elif defined(RT_ARCH_SPARC) && defined(RT_ARCH_SPARC64)
|
---|
137 | # error "Both RT_ARCH_SPARC and RT_ARCH_SPARC64 cannot be defined at the same time!"
|
---|
138 | #elif defined(RT_ARCH_ARM) && defined(RT_ARCH_AMD64)
|
---|
139 | # error "Both RT_ARCH_ARM and RT_ARCH_AMD64 cannot be defined at the same time!"
|
---|
140 | #elif defined(RT_ARCH_ARM) && defined(RT_ARCH_X86)
|
---|
141 | # error "Both RT_ARCH_ARM and RT_ARCH_X86 cannot be defined at the same time!"
|
---|
142 | #elif defined(RT_ARCH_ARM) && defined(RT_ARCH_SPARC64)
|
---|
143 | # error "Both RT_ARCH_ARM and RT_ARCH_SPARC64 cannot be defined at the same time!"
|
---|
144 | #elif defined(RT_ARCH_ARM) && defined(RT_ARCH_SPARC)
|
---|
145 | # error "Both RT_ARCH_ARM and RT_ARCH_SPARC cannot be defined at the same time!"
|
---|
146 | #endif
|
---|
147 |
|
---|
148 | /* Final check (PORTME). */
|
---|
149 | #if (defined(RT_ARCH_X86) != 0) \
|
---|
150 | + (defined(RT_ARCH_AMD64) != 0) \
|
---|
151 | + (defined(RT_ARCH_SPARC) != 0) \
|
---|
152 | + (defined(RT_ARCH_SPARC64) != 0) \
|
---|
153 | + (defined(RT_ARCH_ARM) != 0) \
|
---|
154 | != 1
|
---|
155 | # error "Exactly one RT_ARCH_XXX macro shall be defined"
|
---|
156 | #endif
|
---|
157 |
|
---|
158 | /** @def RT_CPLUSPLUS_PREREQ
|
---|
159 | * Require a minimum __cplusplus value, simplifying dealing with non-C++ code.
|
---|
160 | *
|
---|
161 | * @param a_Min The minimum version, e.g. 201100.
|
---|
162 | */
|
---|
163 | #ifdef __cplusplus
|
---|
164 | # define RT_CPLUSPLUS_PREREQ(a_Min) (__cplusplus >= (a_Min))
|
---|
165 | #else
|
---|
166 | # define RT_CPLUSPLUS_PREREQ(a_Min) (0)
|
---|
167 | #endif
|
---|
168 |
|
---|
169 | /** @def RT_GNUC_PREREQ
|
---|
170 | * Shorter than fiddling with __GNUC__ and __GNUC_MINOR__.
|
---|
171 | *
|
---|
172 | * @param a_MinMajor Minimum major version
|
---|
173 | * @param a_MinMinor The minor version number part.
|
---|
174 | */
|
---|
175 | #define RT_GNUC_PREREQ(a_MinMajor, a_MinMinor) RT_GNUC_PREREQ_EX(a_MinMajor, a_MinMinor, 0)
|
---|
176 | /** @def RT_GNUC_PREREQ_EX
|
---|
177 | * Simplified way of checking __GNUC__ and __GNUC_MINOR__ regardless of actual
|
---|
178 | * compiler used, returns @a a_OtherRet for other compilers.
|
---|
179 | *
|
---|
180 | * @param a_MinMajor Minimum major version
|
---|
181 | * @param a_MinMinor The minor version number part.
|
---|
182 | * @param a_OtherRet What to return for non-GCC compilers.
|
---|
183 | */
|
---|
184 | #if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
---|
185 | # define RT_GNUC_PREREQ_EX(a_MinMajor, a_MinMinor, a_OtherRet) \
|
---|
186 | ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((a_MinMajor) << 16) + (a_MinMinor))
|
---|
187 | #else
|
---|
188 | # define RT_GNUC_PREREQ_EX(a_MinMajor, a_MinMinor, a_OtherRet) (a_OtherRet)
|
---|
189 | #endif
|
---|
190 |
|
---|
191 | /** @def RT_MSC_PREREQ
|
---|
192 | * Convenient way of checking _MSC_VER regardless of actual compiler used
|
---|
193 | * (returns false if not MSC).
|
---|
194 | *
|
---|
195 | * @param a_MinVer Preferably a RT_MSC_VER_XXX value.
|
---|
196 | */
|
---|
197 | #define RT_MSC_PREREQ(a_MinVer) RT_MSC_PREREQ_EX(a_MinVer, 0)
|
---|
198 | /** @def RT_MSC_PREREQ_EX
|
---|
199 | * Convenient way of checking _MSC_VER regardless of actual compiler used,
|
---|
200 | * returns @a a_OtherRet for other compilers.
|
---|
201 | *
|
---|
202 | * @param a_MinVer Preferably a RT_MSC_VER_XXX value.
|
---|
203 | * @param a_OtherRet What to return for non-MSC compilers.
|
---|
204 | */
|
---|
205 | #if defined(_MSC_VER)
|
---|
206 | # define RT_MSC_PREREQ_EX(a_MinVer, a_OtherRet) ( (_MSC_VER) >= (a_MinVer) )
|
---|
207 | #else
|
---|
208 | # define RT_MSC_PREREQ_EX(a_MinVer, a_OtherRet) (a_OtherRet)
|
---|
209 | #endif
|
---|
210 | /** @name RT_MSC_VER_XXX - _MSC_VER values to use with RT_MSC_PREREQ.
|
---|
211 | * @remarks The VCxxx values are derived from the CRT DLLs shipping with the
|
---|
212 | * compilers.
|
---|
213 | * @{ */
|
---|
214 | #define RT_MSC_VER_VC50 (1100) /**< Visual C++ 5.0. */
|
---|
215 | #define RT_MSC_VER_VC60 (1200) /**< Visual C++ 6.0. */
|
---|
216 | #define RT_MSC_VER_VC70 (1300) /**< Visual C++ 7.0. */
|
---|
217 | #define RT_MSC_VER_VC70 (1300) /**< Visual C++ 7.0. */
|
---|
218 | #define RT_MSC_VER_VS2003 (1310) /**< Visual Studio 2003, aka Visual C++ 7.1. */
|
---|
219 | #define RT_MSC_VER_VC71 RT_MSC_VER_VS2003 /**< Visual C++ 7.1, aka Visual Studio 2003. */
|
---|
220 | #define RT_MSC_VER_VS2005 (1400) /**< Visual Studio 2005. */
|
---|
221 | #define RT_MSC_VER_VC80 RT_MSC_VER_VS2005 /**< Visual C++ 8.0, aka Visual Studio 2008. */
|
---|
222 | #define RT_MSC_VER_VS2008 (1500) /**< Visual Studio 2008. */
|
---|
223 | #define RT_MSC_VER_VC90 RT_MSC_VER_VS2008 /**< Visual C++ 9.0, aka Visual Studio 2008. */
|
---|
224 | #define RT_MSC_VER_VS2010 (1600) /**< Visual Studio 2010. */
|
---|
225 | #define RT_MSC_VER_VC100 RT_MSC_VER_VS2010 /**< Visual C++ 10.0, aka Visual Studio 2010. */
|
---|
226 | #define RT_MSC_VER_VS2012 (1700) /**< Visual Studio 2012. */
|
---|
227 | #define RT_MSC_VER_VC110 RT_MSC_VER_VS2012 /**< Visual C++ 11.0, aka Visual Studio 2012. */
|
---|
228 | #define RT_MSC_VER_VS2013 (1800) /**< Visual Studio 2013. */
|
---|
229 | #define RT_MSC_VER_VC120 RT_MSC_VER_VS2013 /**< Visual C++ 12.0, aka Visual Studio 2013. */
|
---|
230 | #define RT_MSC_VER_VS2015 (1900) /**< Visual Studio 2015. */
|
---|
231 | #define RT_MSC_VER_VC140 RT_MSC_VER_VS2015 /**< Visual C++ 14.0, aka Visual Studio 2015. */
|
---|
232 | #define RT_MSC_VER_VS2017 (1910) /**< Visual Studio 2017. */
|
---|
233 | #define RT_MSC_VER_VC141 RT_MSC_VER_VS2017 /**< Visual C++ 14.1, aka Visual Studio 2017. */
|
---|
234 | #define RT_MSC_VER_VS2019 (1920) /**< Visual Studio 2017. */
|
---|
235 | #define RT_MSC_VER_VC142 RT_MSC_VER_VS2019 /**< Visual C++ 14.2, aka Visual Studio 2019. */
|
---|
236 | /** @} */
|
---|
237 |
|
---|
238 | /** @def RT_CLANG_PREREQ
|
---|
239 | * Shorter than fiddling with __clang_major__ and __clang_minor__.
|
---|
240 | *
|
---|
241 | * @param a_MinMajor Minimum major version
|
---|
242 | * @param a_MinMinor The minor version number part.
|
---|
243 | */
|
---|
244 | #define RT_CLANG_PREREQ(a_MinMajor, a_MinMinor) RT_CLANG_PREREQ_EX(a_MinMajor, a_MinMinor, 0)
|
---|
245 | /** @def RT_CLANG_PREREQ_EX
|
---|
246 | * Simplified way of checking __clang_major__ and __clang_minor__ regardless of
|
---|
247 | * actual compiler used, returns @a a_OtherRet for other compilers.
|
---|
248 | *
|
---|
249 | * @param a_MinMajor Minimum major version
|
---|
250 | * @param a_MinMinor The minor version number part.
|
---|
251 | * @param a_OtherRet What to return for non-GCC compilers.
|
---|
252 | */
|
---|
253 | #if defined(__clang_major__) && defined(__clang_minor__)
|
---|
254 | # define RT_CLANG_PREREQ_EX(a_MinMajor, a_MinMinor, a_OtherRet) \
|
---|
255 | ((__clang_major__ << 16) + __clang_minor__ >= ((a_MinMajor) << 16) + (a_MinMinor))
|
---|
256 | #else
|
---|
257 | # define RT_CLANG_PREREQ_EX(a_MinMajor, a_MinMinor, a_OtherRet) (a_OtherRet)
|
---|
258 | #endif
|
---|
259 | /** @def RT_CLANG_HAS_FEATURE
|
---|
260 | * Wrapper around clang's __has_feature().
|
---|
261 | *
|
---|
262 | * @param a_Feature The feature to check for.
|
---|
263 | */
|
---|
264 | #if defined(__clang_major__) && defined(__clang_minor__) && defined(__has_feature)
|
---|
265 | # define RT_CLANG_HAS_FEATURE(a_Feature) (__has_feature(a_Feature))
|
---|
266 | #else
|
---|
267 | # define RT_CLANG_HAS_FEATURE(a_Feature) (0)
|
---|
268 | #endif
|
---|
269 |
|
---|
270 |
|
---|
271 | #if !defined(__X86__) && !defined(__AMD64__) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
|
---|
272 | # if defined(RT_ARCH_AMD64)
|
---|
273 | /** Indicates that we're compiling for the AMD64 architecture.
|
---|
274 | * @deprecated
|
---|
275 | */
|
---|
276 | # define __AMD64__
|
---|
277 | # elif defined(RT_ARCH_X86)
|
---|
278 | /** Indicates that we're compiling for the X86 architecture.
|
---|
279 | * @deprecated
|
---|
280 | */
|
---|
281 | # define __X86__
|
---|
282 | # else
|
---|
283 | # error "Check what predefined macros your compiler uses to indicate architecture."
|
---|
284 | # endif
|
---|
285 | #elif defined(__X86__) && defined(__AMD64__)
|
---|
286 | # error "Both __X86__ and __AMD64__ cannot be defined at the same time!"
|
---|
287 | #elif defined(__X86__) && !defined(RT_ARCH_X86)
|
---|
288 | # error "__X86__ without RT_ARCH_X86!"
|
---|
289 | #elif defined(__AMD64__) && !defined(RT_ARCH_AMD64)
|
---|
290 | # error "__AMD64__ without RT_ARCH_AMD64!"
|
---|
291 | #endif
|
---|
292 |
|
---|
293 | /** @def RT_BIG_ENDIAN
|
---|
294 | * Defined if the architecture is big endian. */
|
---|
295 | /** @def RT_LITTLE_ENDIAN
|
---|
296 | * Defined if the architecture is little endian. */
|
---|
297 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) || defined(RT_ARCH_ARM)
|
---|
298 | # define RT_LITTLE_ENDIAN
|
---|
299 | #elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
|
---|
300 | # define RT_BIG_ENDIAN
|
---|
301 | #else
|
---|
302 | # error "PORTME: architecture endianess"
|
---|
303 | #endif
|
---|
304 | #if defined(RT_BIG_ENDIAN) && defined(RT_LITTLE_ENDIAN)
|
---|
305 | # error "Both RT_BIG_ENDIAN and RT_LITTLE_ENDIAN are defined"
|
---|
306 | #endif
|
---|
307 |
|
---|
308 |
|
---|
309 | /** @def IN_RING0
|
---|
310 | * Used to indicate that we're compiling code which is running
|
---|
311 | * in Ring-0 Host Context.
|
---|
312 | */
|
---|
313 |
|
---|
314 | /** @def IN_RING3
|
---|
315 | * Used to indicate that we're compiling code which is running
|
---|
316 | * in Ring-3 Host Context.
|
---|
317 | */
|
---|
318 |
|
---|
319 | /** @def IN_RC
|
---|
320 | * Used to indicate that we're compiling code which is running
|
---|
321 | * in the Raw-mode Context (implies R0).
|
---|
322 | */
|
---|
323 | #if !defined(IN_RING3) && !defined(IN_RING0) && !defined(IN_RC)
|
---|
324 | # error "You must define which context the compiled code should run in; IN_RING3, IN_RING0 or IN_RC"
|
---|
325 | #endif
|
---|
326 | #if (defined(IN_RING3) && (defined(IN_RING0) || defined(IN_RC)) ) \
|
---|
327 | || (defined(IN_RING0) && (defined(IN_RING3) || defined(IN_RC)) ) \
|
---|
328 | || (defined(IN_RC) && (defined(IN_RING3) || defined(IN_RING0)) )
|
---|
329 | # error "Only one of the IN_RING3, IN_RING0, IN_RC defines should be defined."
|
---|
330 | #endif
|
---|
331 |
|
---|
332 |
|
---|
333 | /** @def ARCH_BITS
|
---|
334 | * Defines the bit count of the current context.
|
---|
335 | */
|
---|
336 | #if !defined(ARCH_BITS) || defined(DOXYGEN_RUNNING)
|
---|
337 | # if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64) || defined(DOXYGEN_RUNNING)
|
---|
338 | # define ARCH_BITS 64
|
---|
339 | # elif !defined(__I86__) || !defined(__WATCOMC__)
|
---|
340 | # define ARCH_BITS 32
|
---|
341 | # else
|
---|
342 | # define ARCH_BITS 16
|
---|
343 | # endif
|
---|
344 | #endif
|
---|
345 |
|
---|
346 | /* ARCH_BITS validation (PORTME). */
|
---|
347 | #if ARCH_BITS == 64
|
---|
348 | #if defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC) || defined(RT_ARCH_ARM)
|
---|
349 | # error "ARCH_BITS=64 but non-64-bit RT_ARCH_XXX defined."
|
---|
350 | #endif
|
---|
351 | #if !defined(RT_ARCH_AMD64) && !defined(RT_ARCH_SPARC64)
|
---|
352 | # error "ARCH_BITS=64 but no 64-bit RT_ARCH_XXX defined."
|
---|
353 | #endif
|
---|
354 |
|
---|
355 | #elif ARCH_BITS == 32
|
---|
356 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
|
---|
357 | # error "ARCH_BITS=32 but non-32-bit RT_ARCH_XXX defined."
|
---|
358 | #endif
|
---|
359 | #if !defined(RT_ARCH_X86) && !defined(RT_ARCH_SPARC) && !defined(RT_ARCH_ARM)
|
---|
360 | # error "ARCH_BITS=32 but no 32-bit RT_ARCH_XXX defined."
|
---|
361 | #endif
|
---|
362 |
|
---|
363 | #elif ARCH_BITS == 16
|
---|
364 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64) || defined(RT_ARCH_ARM)
|
---|
365 | # error "ARCH_BITS=16 but non-16-bit RT_ARCH_XX defined."
|
---|
366 | #endif
|
---|
367 | #if !defined(RT_ARCH_X86)
|
---|
368 | # error "ARCH_BITS=16 but RT_ARCH_X86 isn't defined."
|
---|
369 | #endif
|
---|
370 |
|
---|
371 | #else
|
---|
372 | # error "Unsupported ARCH_BITS value!"
|
---|
373 | #endif
|
---|
374 |
|
---|
375 | /** @def HC_ARCH_BITS
|
---|
376 | * Defines the host architecture bit count.
|
---|
377 | */
|
---|
378 | #if !defined(HC_ARCH_BITS) || defined(DOXYGEN_RUNNING)
|
---|
379 | # if !defined(IN_RC) || defined(DOXYGEN_RUNNING)
|
---|
380 | # define HC_ARCH_BITS ARCH_BITS
|
---|
381 | # else
|
---|
382 | # define HC_ARCH_BITS 32
|
---|
383 | # endif
|
---|
384 | #endif
|
---|
385 |
|
---|
386 | /** @def GC_ARCH_BITS
|
---|
387 | * Defines the guest architecture bit count.
|
---|
388 | */
|
---|
389 | #if !defined(GC_ARCH_BITS) || defined(DOXYGEN_RUNNING)
|
---|
390 | # if defined(VBOX_WITH_64_BITS_GUESTS) || defined(DOXYGEN_RUNNING)
|
---|
391 | # define GC_ARCH_BITS 64
|
---|
392 | # else
|
---|
393 | # define GC_ARCH_BITS 32
|
---|
394 | # endif
|
---|
395 | #endif
|
---|
396 |
|
---|
397 | /** @def R3_ARCH_BITS
|
---|
398 | * Defines the host ring-3 architecture bit count.
|
---|
399 | */
|
---|
400 | #if !defined(R3_ARCH_BITS) || defined(DOXYGEN_RUNNING)
|
---|
401 | # ifdef IN_RING3
|
---|
402 | # define R3_ARCH_BITS ARCH_BITS
|
---|
403 | # else
|
---|
404 | # define R3_ARCH_BITS HC_ARCH_BITS
|
---|
405 | # endif
|
---|
406 | #endif
|
---|
407 |
|
---|
408 | /** @def R0_ARCH_BITS
|
---|
409 | * Defines the host ring-0 architecture bit count.
|
---|
410 | */
|
---|
411 | #if !defined(R0_ARCH_BITS) || defined(DOXYGEN_RUNNING)
|
---|
412 | # ifdef IN_RING0
|
---|
413 | # define R0_ARCH_BITS ARCH_BITS
|
---|
414 | # else
|
---|
415 | # define R0_ARCH_BITS HC_ARCH_BITS
|
---|
416 | # endif
|
---|
417 | #endif
|
---|
418 |
|
---|
419 |
|
---|
420 |
|
---|
421 | /** @name RT_OPSYS_XXX - Operative System Identifiers.
|
---|
422 | * These are the value that the RT_OPSYS \#define can take. @{
|
---|
423 | */
|
---|
424 | /** Unknown OS. */
|
---|
425 | #define RT_OPSYS_UNKNOWN 0
|
---|
426 | /** OS Agnostic. */
|
---|
427 | #define RT_OPSYS_AGNOSTIC 1
|
---|
428 | /** Darwin - aka Mac OS X. */
|
---|
429 | #define RT_OPSYS_DARWIN 2
|
---|
430 | /** DragonFly BSD. */
|
---|
431 | #define RT_OPSYS_DRAGONFLY 3
|
---|
432 | /** DOS. */
|
---|
433 | #define RT_OPSYS_DOS 4
|
---|
434 | /** FreeBSD. */
|
---|
435 | #define RT_OPSYS_FREEBSD 5
|
---|
436 | /** Haiku. */
|
---|
437 | #define RT_OPSYS_HAIKU 6
|
---|
438 | /** Linux. */
|
---|
439 | #define RT_OPSYS_LINUX 7
|
---|
440 | /** L4. */
|
---|
441 | #define RT_OPSYS_L4 8
|
---|
442 | /** Minix. */
|
---|
443 | #define RT_OPSYS_MINIX 9
|
---|
444 | /** NetBSD. */
|
---|
445 | #define RT_OPSYS_NETBSD 11
|
---|
446 | /** Netware. */
|
---|
447 | #define RT_OPSYS_NETWARE 12
|
---|
448 | /** NT (native). */
|
---|
449 | #define RT_OPSYS_NT 13
|
---|
450 | /** OpenBSD. */
|
---|
451 | #define RT_OPSYS_OPENBSD 14
|
---|
452 | /** OS/2. */
|
---|
453 | #define RT_OPSYS_OS2 15
|
---|
454 | /** Plan 9. */
|
---|
455 | #define RT_OPSYS_PLAN9 16
|
---|
456 | /** QNX. */
|
---|
457 | #define RT_OPSYS_QNX 17
|
---|
458 | /** Solaris. */
|
---|
459 | #define RT_OPSYS_SOLARIS 18
|
---|
460 | /** UEFI. */
|
---|
461 | #define RT_OPSYS_UEFI 19
|
---|
462 | /** Windows. */
|
---|
463 | #define RT_OPSYS_WINDOWS 20
|
---|
464 | /** The max RT_OPSYS_XXX value (exclusive). */
|
---|
465 | #define RT_OPSYS_MAX 21
|
---|
466 | /** @} */
|
---|
467 |
|
---|
468 | /** @def RT_OPSYS
|
---|
469 | * Indicates which OS we're targeting. It's a \#define with is
|
---|
470 | * assigned one of the RT_OPSYS_XXX defines above.
|
---|
471 | *
|
---|
472 | * So to test if we're on FreeBSD do the following:
|
---|
473 | * @code
|
---|
474 | * #if RT_OPSYS == RT_OPSYS_FREEBSD
|
---|
475 | * some_funky_freebsd_specific_stuff();
|
---|
476 | * #endif
|
---|
477 | * @endcode
|
---|
478 | */
|
---|
479 |
|
---|
480 | /*
|
---|
481 | * Set RT_OPSYS_XXX according to RT_OS_XXX.
|
---|
482 | *
|
---|
483 | * Search: #define RT_OPSYS_([A-Z0-9]+) .*
|
---|
484 | * Replace: # elif defined(RT_OS_\1)\n# define RT_OPSYS RT_OPSYS_\1
|
---|
485 | */
|
---|
486 | #ifndef RT_OPSYS
|
---|
487 | # if defined(RT_OS_UNKNOWN) || defined(DOXYGEN_RUNNING)
|
---|
488 | # define RT_OPSYS RT_OPSYS_UNKNOWN
|
---|
489 | # elif defined(RT_OS_AGNOSTIC)
|
---|
490 | # define RT_OPSYS RT_OPSYS_AGNOSTIC
|
---|
491 | # elif defined(RT_OS_DARWIN)
|
---|
492 | # define RT_OPSYS RT_OPSYS_DARWIN
|
---|
493 | # elif defined(RT_OS_DRAGONFLY)
|
---|
494 | # define RT_OPSYS RT_OPSYS_DRAGONFLY
|
---|
495 | # elif defined(RT_OS_DOS)
|
---|
496 | # define RT_OPSYS RT_OPSYS_DOS
|
---|
497 | # elif defined(RT_OS_FREEBSD)
|
---|
498 | # define RT_OPSYS RT_OPSYS_FREEBSD
|
---|
499 | # elif defined(RT_OS_HAIKU)
|
---|
500 | # define RT_OPSYS RT_OPSYS_HAIKU
|
---|
501 | # elif defined(RT_OS_LINUX)
|
---|
502 | # define RT_OPSYS RT_OPSYS_LINUX
|
---|
503 | # elif defined(RT_OS_L4)
|
---|
504 | # define RT_OPSYS RT_OPSYS_L4
|
---|
505 | # elif defined(RT_OS_MINIX)
|
---|
506 | # define RT_OPSYS RT_OPSYS_MINIX
|
---|
507 | # elif defined(RT_OS_NETBSD)
|
---|
508 | # define RT_OPSYS RT_OPSYS_NETBSD
|
---|
509 | # elif defined(RT_OS_NETWARE)
|
---|
510 | # define RT_OPSYS RT_OPSYS_NETWARE
|
---|
511 | # elif defined(RT_OS_NT)
|
---|
512 | # define RT_OPSYS RT_OPSYS_NT
|
---|
513 | # elif defined(RT_OS_OPENBSD)
|
---|
514 | # define RT_OPSYS RT_OPSYS_OPENBSD
|
---|
515 | # elif defined(RT_OS_OS2)
|
---|
516 | # define RT_OPSYS RT_OPSYS_OS2
|
---|
517 | # elif defined(RT_OS_PLAN9)
|
---|
518 | # define RT_OPSYS RT_OPSYS_PLAN9
|
---|
519 | # elif defined(RT_OS_QNX)
|
---|
520 | # define RT_OPSYS RT_OPSYS_QNX
|
---|
521 | # elif defined(RT_OS_SOLARIS)
|
---|
522 | # define RT_OPSYS RT_OPSYS_SOLARIS
|
---|
523 | # elif defined(RT_OS_UEFI)
|
---|
524 | # define RT_OPSYS RT_OPSYS_UEFI
|
---|
525 | # elif defined(RT_OS_WINDOWS)
|
---|
526 | # define RT_OPSYS RT_OPSYS_WINDOWS
|
---|
527 | # endif
|
---|
528 | #endif
|
---|
529 |
|
---|
530 | /*
|
---|
531 | * Guess RT_OPSYS based on compiler predefined macros.
|
---|
532 | */
|
---|
533 | #ifndef RT_OPSYS
|
---|
534 | # if defined(__APPLE__)
|
---|
535 | # define RT_OPSYS RT_OPSYS_DARWIN
|
---|
536 | # elif defined(__DragonFly__)
|
---|
537 | # define RT_OPSYS RT_OPSYS_DRAGONFLY
|
---|
538 | # elif defined(__FreeBSD__) /*??*/
|
---|
539 | # define RT_OPSYS RT_OPSYS_FREEBSD
|
---|
540 | # elif defined(__gnu_linux__)
|
---|
541 | # define RT_OPSYS RT_OPSYS_LINUX
|
---|
542 | # elif defined(__NetBSD__) /*??*/
|
---|
543 | # define RT_OPSYS RT_OPSYS_NETBSD
|
---|
544 | # elif defined(__OpenBSD__) /*??*/
|
---|
545 | # define RT_OPSYS RT_OPSYS_OPENBSD
|
---|
546 | # elif defined(__OS2__)
|
---|
547 | # define RT_OPSYS RT_OPSYS_OS2
|
---|
548 | # elif defined(__sun__) || defined(__SunOS__) || defined(__sun) || defined(__SunOS)
|
---|
549 | # define RT_OPSYS RT_OPSYS_SOLARIS
|
---|
550 | # elif defined(_WIN32) || defined(_WIN64)
|
---|
551 | # define RT_OPSYS RT_OPSYS_WINDOWS
|
---|
552 | # elif defined(MSDOS) || defined(_MSDOS) || defined(DOS16RM) /* OW+MSC || MSC || DMC */
|
---|
553 | # define RT_OPSYS RT_OPSYS_DOS
|
---|
554 | # else
|
---|
555 | # error "Port Me"
|
---|
556 | # endif
|
---|
557 | #endif
|
---|
558 |
|
---|
559 | #if RT_OPSYS < RT_OPSYS_UNKNOWN || RT_OPSYS >= RT_OPSYS_MAX
|
---|
560 | # error "Invalid RT_OPSYS value."
|
---|
561 | #endif
|
---|
562 |
|
---|
563 | /*
|
---|
564 | * Do some consistency checks.
|
---|
565 | *
|
---|
566 | * Search: #define RT_OPSYS_([A-Z0-9]+) .*
|
---|
567 | * Replace: #if defined(RT_OS_\1) && RT_OPSYS != RT_OPSYS_\1\n# error RT_OPSYS vs RT_OS_\1\n#endif
|
---|
568 | */
|
---|
569 | #if defined(RT_OS_UNKNOWN) && RT_OPSYS != RT_OPSYS_UNKNOWN
|
---|
570 | # error RT_OPSYS vs RT_OS_UNKNOWN
|
---|
571 | #endif
|
---|
572 | #if defined(RT_OS_AGNOSTIC) && RT_OPSYS != RT_OPSYS_AGNOSTIC
|
---|
573 | # error RT_OPSYS vs RT_OS_AGNOSTIC
|
---|
574 | #endif
|
---|
575 | #if defined(RT_OS_DARWIN) && RT_OPSYS != RT_OPSYS_DARWIN
|
---|
576 | # error RT_OPSYS vs RT_OS_DARWIN
|
---|
577 | #endif
|
---|
578 | #if defined(RT_OS_DRAGONFLY) && RT_OPSYS != RT_OPSYS_DRAGONFLY
|
---|
579 | # error RT_OPSYS vs RT_OS_DRAGONFLY
|
---|
580 | #endif
|
---|
581 | #if defined(RT_OS_DOS) && RT_OPSYS != RT_OPSYS_DOS
|
---|
582 | # error RT_OPSYS vs RT_OS_DOS
|
---|
583 | #endif
|
---|
584 | #if defined(RT_OS_FREEBSD) && RT_OPSYS != RT_OPSYS_FREEBSD
|
---|
585 | # error RT_OPSYS vs RT_OS_FREEBSD
|
---|
586 | #endif
|
---|
587 | #if defined(RT_OS_HAIKU) && RT_OPSYS != RT_OPSYS_HAIKU
|
---|
588 | # error RT_OPSYS vs RT_OS_HAIKU
|
---|
589 | #endif
|
---|
590 | #if defined(RT_OS_LINUX) && RT_OPSYS != RT_OPSYS_LINUX
|
---|
591 | # error RT_OPSYS vs RT_OS_LINUX
|
---|
592 | #endif
|
---|
593 | #if defined(RT_OS_L4) && RT_OPSYS != RT_OPSYS_L4
|
---|
594 | # error RT_OPSYS vs RT_OS_L4
|
---|
595 | #endif
|
---|
596 | #if defined(RT_OS_MINIX) && RT_OPSYS != RT_OPSYS_MINIX
|
---|
597 | # error RT_OPSYS vs RT_OS_MINIX
|
---|
598 | #endif
|
---|
599 | #if defined(RT_OS_NETBSD) && RT_OPSYS != RT_OPSYS_NETBSD
|
---|
600 | # error RT_OPSYS vs RT_OS_NETBSD
|
---|
601 | #endif
|
---|
602 | #if defined(RT_OS_NETWARE) && RT_OPSYS != RT_OPSYS_NETWARE
|
---|
603 | # error RT_OPSYS vs RT_OS_NETWARE
|
---|
604 | #endif
|
---|
605 | #if defined(RT_OS_NT) && RT_OPSYS != RT_OPSYS_NT
|
---|
606 | # error RT_OPSYS vs RT_OS_NT
|
---|
607 | #endif
|
---|
608 | #if defined(RT_OS_OPENBSD) && RT_OPSYS != RT_OPSYS_OPENBSD
|
---|
609 | # error RT_OPSYS vs RT_OS_OPENBSD
|
---|
610 | #endif
|
---|
611 | #if defined(RT_OS_OS2) && RT_OPSYS != RT_OPSYS_OS2
|
---|
612 | # error RT_OPSYS vs RT_OS_OS2
|
---|
613 | #endif
|
---|
614 | #if defined(RT_OS_PLAN9) && RT_OPSYS != RT_OPSYS_PLAN9
|
---|
615 | # error RT_OPSYS vs RT_OS_PLAN9
|
---|
616 | #endif
|
---|
617 | #if defined(RT_OS_QNX) && RT_OPSYS != RT_OPSYS_QNX
|
---|
618 | # error RT_OPSYS vs RT_OS_QNX
|
---|
619 | #endif
|
---|
620 | #if defined(RT_OS_SOLARIS) && RT_OPSYS != RT_OPSYS_SOLARIS
|
---|
621 | # error RT_OPSYS vs RT_OS_SOLARIS
|
---|
622 | #endif
|
---|
623 | #if defined(RT_OS_UEFI) && RT_OPSYS != RT_OPSYS_UEFI
|
---|
624 | # error RT_OPSYS vs RT_OS_UEFI
|
---|
625 | #endif
|
---|
626 | #if defined(RT_OS_WINDOWS) && RT_OPSYS != RT_OPSYS_WINDOWS
|
---|
627 | # error RT_OPSYS vs RT_OS_WINDOWS
|
---|
628 | #endif
|
---|
629 |
|
---|
630 | /*
|
---|
631 | * Make sure the RT_OS_XXX macro is defined.
|
---|
632 | *
|
---|
633 | * Search: #define RT_OPSYS_([A-Z0-9]+) .*
|
---|
634 | * Replace: #elif RT_OPSYS == RT_OPSYS_\1\n# ifndef RT_OS_\1\n# define RT_OS_\1\n# endif
|
---|
635 | */
|
---|
636 | #if RT_OPSYS == RT_OPSYS_UNKNOWN
|
---|
637 | # ifndef RT_OS_UNKNOWN
|
---|
638 | # define RT_OS_UNKNOWN
|
---|
639 | # endif
|
---|
640 | #elif RT_OPSYS == RT_OPSYS_AGNOSTIC
|
---|
641 | # ifndef RT_OS_AGNOSTIC
|
---|
642 | # define RT_OS_AGNOSTIC
|
---|
643 | # endif
|
---|
644 | #elif RT_OPSYS == RT_OPSYS_DARWIN
|
---|
645 | # ifndef RT_OS_DARWIN
|
---|
646 | # define RT_OS_DARWIN
|
---|
647 | # endif
|
---|
648 | #elif RT_OPSYS == RT_OPSYS_DRAGONFLY
|
---|
649 | # ifndef RT_OS_DRAGONFLY
|
---|
650 | # define RT_OS_DRAGONFLY
|
---|
651 | # endif
|
---|
652 | #elif RT_OPSYS == RT_OPSYS_DOS
|
---|
653 | # ifndef RT_OS_DOS
|
---|
654 | # define RT_OS_DOS
|
---|
655 | # endif
|
---|
656 | #elif RT_OPSYS == RT_OPSYS_FREEBSD
|
---|
657 | # ifndef RT_OS_FREEBSD
|
---|
658 | # define RT_OS_FREEBSD
|
---|
659 | # endif
|
---|
660 | #elif RT_OPSYS == RT_OPSYS_HAIKU
|
---|
661 | # ifndef RT_OS_HAIKU
|
---|
662 | # define RT_OS_HAIKU
|
---|
663 | # endif
|
---|
664 | #elif RT_OPSYS == RT_OPSYS_LINUX
|
---|
665 | # ifndef RT_OS_LINUX
|
---|
666 | # define RT_OS_LINUX
|
---|
667 | # endif
|
---|
668 | #elif RT_OPSYS == RT_OPSYS_L4
|
---|
669 | # ifndef RT_OS_L4
|
---|
670 | # define RT_OS_L4
|
---|
671 | # endif
|
---|
672 | #elif RT_OPSYS == RT_OPSYS_MINIX
|
---|
673 | # ifndef RT_OS_MINIX
|
---|
674 | # define RT_OS_MINIX
|
---|
675 | # endif
|
---|
676 | #elif RT_OPSYS == RT_OPSYS_NETBSD
|
---|
677 | # ifndef RT_OS_NETBSD
|
---|
678 | # define RT_OS_NETBSD
|
---|
679 | # endif
|
---|
680 | #elif RT_OPSYS == RT_OPSYS_NETWARE
|
---|
681 | # ifndef RT_OS_NETWARE
|
---|
682 | # define RT_OS_NETWARE
|
---|
683 | # endif
|
---|
684 | #elif RT_OPSYS == RT_OPSYS_NT
|
---|
685 | # ifndef RT_OS_NT
|
---|
686 | # define RT_OS_NT
|
---|
687 | # endif
|
---|
688 | #elif RT_OPSYS == RT_OPSYS_OPENBSD
|
---|
689 | # ifndef RT_OS_OPENBSD
|
---|
690 | # define RT_OS_OPENBSD
|
---|
691 | # endif
|
---|
692 | #elif RT_OPSYS == RT_OPSYS_OS2
|
---|
693 | # ifndef RT_OS_OS2
|
---|
694 | # define RT_OS_OS2
|
---|
695 | # endif
|
---|
696 | #elif RT_OPSYS == RT_OPSYS_PLAN9
|
---|
697 | # ifndef RT_OS_PLAN9
|
---|
698 | # define RT_OS_PLAN9
|
---|
699 | # endif
|
---|
700 | #elif RT_OPSYS == RT_OPSYS_QNX
|
---|
701 | # ifndef RT_OS_QNX
|
---|
702 | # define RT_OS_QNX
|
---|
703 | # endif
|
---|
704 | #elif RT_OPSYS == RT_OPSYS_SOLARIS
|
---|
705 | # ifndef RT_OS_SOLARIS
|
---|
706 | # define RT_OS_SOLARIS
|
---|
707 | # endif
|
---|
708 | #elif RT_OPSYS == RT_OPSYS_UEFI
|
---|
709 | # ifndef RT_OS_UEFI
|
---|
710 | # define RT_OS_UEFI
|
---|
711 | # endif
|
---|
712 | #elif RT_OPSYS == RT_OPSYS_WINDOWS
|
---|
713 | # ifndef RT_OS_WINDOWS
|
---|
714 | # define RT_OS_WINDOWS
|
---|
715 | # endif
|
---|
716 | #else
|
---|
717 | # error "Bad RT_OPSYS value."
|
---|
718 | #endif
|
---|
719 |
|
---|
720 |
|
---|
721 | /**
|
---|
722 | * Checks whether the given OpSys uses DOS-style paths or not.
|
---|
723 | *
|
---|
724 | * By DOS-style paths we include drive lettering and UNC paths.
|
---|
725 | *
|
---|
726 | * @returns true / false
|
---|
727 | * @param a_OpSys The RT_OPSYS_XXX value to check, will be reference
|
---|
728 | * multiple times.
|
---|
729 | */
|
---|
730 | #define RT_OPSYS_USES_DOS_PATHS(a_OpSys) \
|
---|
731 | ( (a_OpSys) == RT_OPSYS_WINDOWS \
|
---|
732 | || (a_OpSys) == RT_OPSYS_OS2 \
|
---|
733 | || (a_OpSys) == RT_OPSYS_DOS )
|
---|
734 |
|
---|
735 |
|
---|
736 |
|
---|
737 | /** @def CTXTYPE
|
---|
738 | * Declare a type differently in GC, R3 and R0.
|
---|
739 | *
|
---|
740 | * @param a_GCType The GC type.
|
---|
741 | * @param a_R3Type The R3 type.
|
---|
742 | * @param a_R0Type The R0 type.
|
---|
743 | * @remark For pointers used only in one context use RCPTRTYPE(), R3R0PTRTYPE(), R3PTRTYPE() or R0PTRTYPE().
|
---|
744 | */
|
---|
745 | #if defined(IN_RC) && !defined(DOXYGEN_RUNNING)
|
---|
746 | # define CTXTYPE(a_GCType, a_R3Type, a_R0Type) a_GCType
|
---|
747 | #elif defined(IN_RING3) || defined(DOXYGEN_RUNNING)
|
---|
748 | # define CTXTYPE(a_GCType, a_R3Type, a_R0Type) a_R3Type
|
---|
749 | #else
|
---|
750 | # define CTXTYPE(a_GCType, a_R3Type, a_R0Type) a_R0Type
|
---|
751 | #endif
|
---|
752 |
|
---|
753 | /** @def CTX_EXPR
|
---|
754 | * Expression selector for avoiding \#ifdef's.
|
---|
755 | *
|
---|
756 | * @param a_R3Expr The R3 expression.
|
---|
757 | * @param a_R0Expr The R0 expression.
|
---|
758 | * @param a_RCExpr The RC expression.
|
---|
759 | */
|
---|
760 | #if defined(IN_RC) && !defined(DOXYGEN_RUNNING)
|
---|
761 | # define CTX_EXPR(a_R3Expr, a_R0Expr, a_RCExpr) a_RCExpr
|
---|
762 | #elif defined(IN_RING0) && !defined(DOXYGEN_RUNNING)
|
---|
763 | # define CTX_EXPR(a_R3Expr, a_R0Expr, a_RCExpr) a_R0Expr
|
---|
764 | #else
|
---|
765 | # define CTX_EXPR(a_R3Expr, a_R0Expr, a_RCExpr) a_R3Expr
|
---|
766 | #endif
|
---|
767 |
|
---|
768 | /** @def RCPTRTYPE
|
---|
769 | * Declare a pointer which is used in the raw mode context but appears in structure(s) used by
|
---|
770 | * both HC and RC. The main purpose is to make sure structures have the same
|
---|
771 | * size when built for different architectures.
|
---|
772 | *
|
---|
773 | * @param a_RCType The RC type.
|
---|
774 | */
|
---|
775 | #define RCPTRTYPE(a_RCType) CTXTYPE(a_RCType, RTRCPTR, RTRCPTR)
|
---|
776 |
|
---|
777 | /** @def RGPTRTYPE
|
---|
778 | * This will become RCPTRTYPE once we've convered all uses of RCPTRTYPE to this.
|
---|
779 | *
|
---|
780 | * @param a_RCType The RC type.
|
---|
781 | */
|
---|
782 | #define RGPTRTYPE(a_RCType) CTXTYPE(a_RCType, RTGCPTR, RTGCPTR)
|
---|
783 |
|
---|
784 | /** @def R3R0PTRTYPE
|
---|
785 | * Declare a pointer which is used in HC, is explicitly valid in ring 3 and 0,
|
---|
786 | * but appears in structure(s) used by both HC and GC. The main purpose is to
|
---|
787 | * make sure structures have the same size when built for different architectures.
|
---|
788 | *
|
---|
789 | * @param a_R3R0Type The R3R0 type.
|
---|
790 | * @remarks This used to be called HCPTRTYPE.
|
---|
791 | */
|
---|
792 | #define R3R0PTRTYPE(a_R3R0Type) CTXTYPE(RTHCPTR, a_R3R0Type, a_R3R0Type)
|
---|
793 |
|
---|
794 | /** @def R3PTRTYPE
|
---|
795 | * Declare a pointer which is used in R3 but appears in structure(s) used by
|
---|
796 | * both HC and GC. The main purpose is to make sure structures have the same
|
---|
797 | * size when built for different architectures.
|
---|
798 | *
|
---|
799 | * @param a_R3Type The R3 type.
|
---|
800 | */
|
---|
801 | #define R3PTRTYPE(a_R3Type) CTXTYPE(RTHCUINTPTR, a_R3Type, RTHCUINTPTR)
|
---|
802 |
|
---|
803 | /** @def R0PTRTYPE
|
---|
804 | * Declare a pointer which is used in R0 but appears in structure(s) used by
|
---|
805 | * both HC and GC. The main purpose is to make sure structures have the same
|
---|
806 | * size when built for different architectures.
|
---|
807 | *
|
---|
808 | * @param a_R0Type The R0 type.
|
---|
809 | */
|
---|
810 | #define R0PTRTYPE(a_R0Type) CTXTYPE(RTHCUINTPTR, RTHCUINTPTR, a_R0Type)
|
---|
811 |
|
---|
812 | /** @def CTXSUFF
|
---|
813 | * Adds the suffix of the current context to the passed in
|
---|
814 | * identifier name. The suffix is HC or GC.
|
---|
815 | *
|
---|
816 | * This is macro should only be used in shared code to avoid a forest of ifdefs.
|
---|
817 | * @param a_Var Identifier name.
|
---|
818 | * @deprecated Use CTX_SUFF. Do NOT use this for new code.
|
---|
819 | */
|
---|
820 | /** @def OTHERCTXSUFF
|
---|
821 | * Adds the suffix of the other context to the passed in
|
---|
822 | * identifier name. The suffix is HC or GC.
|
---|
823 | *
|
---|
824 | * This is macro should only be used in shared code to avoid a forest of ifdefs.
|
---|
825 | * @param a_Var Identifier name.
|
---|
826 | * @deprecated Use CTX_SUFF. Do NOT use this for new code.
|
---|
827 | */
|
---|
828 | #if defined(IN_RC) && !defined(DOXYGEN_RUNNING)
|
---|
829 | # define CTXSUFF(a_Var) a_Var##GC
|
---|
830 | # define OTHERCTXSUFF(a_Var) a_Var##HC
|
---|
831 | #else
|
---|
832 | # define CTXSUFF(a_Var) a_Var##HC
|
---|
833 | # define OTHERCTXSUFF(a_Var) a_Var##GC
|
---|
834 | #endif
|
---|
835 |
|
---|
836 | /** @def CTXALLSUFF
|
---|
837 | * Adds the suffix of the current context to the passed in
|
---|
838 | * identifier name. The suffix is R3, R0 or GC.
|
---|
839 | *
|
---|
840 | * This is macro should only be used in shared code to avoid a forest of ifdefs.
|
---|
841 | * @param a_Var Identifier name.
|
---|
842 | * @deprecated Use CTX_SUFF. Do NOT use this for new code.
|
---|
843 | */
|
---|
844 | #if defined(IN_RC) && !defined(DOXYGEN_RUNNING)
|
---|
845 | # define CTXALLSUFF(a_Var) a_Var##GC
|
---|
846 | #elif defined(IN_RING0) && !defined(DOXYGEN_RUNNING)
|
---|
847 | # define CTXALLSUFF(a_Var) a_Var##R0
|
---|
848 | #else
|
---|
849 | # define CTXALLSUFF(a_Var) a_Var##R3
|
---|
850 | #endif
|
---|
851 |
|
---|
852 | /** @def CTX_SUFF
|
---|
853 | * Adds the suffix of the current context to the passed in
|
---|
854 | * identifier name. The suffix is R3, R0 or RC.
|
---|
855 | *
|
---|
856 | * This is macro should only be used in shared code to avoid a forest of ifdefs.
|
---|
857 | * @param a_Var Identifier name.
|
---|
858 | *
|
---|
859 | * @remark This will replace CTXALLSUFF and CTXSUFF before long.
|
---|
860 | */
|
---|
861 | #if defined(IN_RC) && !defined(DOXYGEN_RUNNING)
|
---|
862 | # define CTX_SUFF(a_Var) a_Var##RC
|
---|
863 | #elif defined(IN_RING0) && !defined(DOXYGEN_RUNNING)
|
---|
864 | # define CTX_SUFF(a_Var) a_Var##R0
|
---|
865 | #else
|
---|
866 | # define CTX_SUFF(a_Var) a_Var##R3
|
---|
867 | #endif
|
---|
868 |
|
---|
869 | /** @def CTX_SUFF_Z
|
---|
870 | * Adds the suffix of the current context to the passed in
|
---|
871 | * identifier name, combining RC and R0 into RZ.
|
---|
872 | * The suffix thus is R3 or RZ.
|
---|
873 | *
|
---|
874 | * This is macro should only be used in shared code to avoid a forest of ifdefs.
|
---|
875 | * @param a_Var Identifier name.
|
---|
876 | *
|
---|
877 | * @remark This will replace CTXALLSUFF and CTXSUFF before long.
|
---|
878 | */
|
---|
879 | #if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
|
---|
880 | # define CTX_SUFF_Z(a_Var) a_Var##R3
|
---|
881 | #else
|
---|
882 | # define CTX_SUFF_Z(a_Var) a_Var##RZ
|
---|
883 | #endif
|
---|
884 |
|
---|
885 |
|
---|
886 | /** @def CTXMID
|
---|
887 | * Adds the current context as a middle name of an identifier name
|
---|
888 | * The middle name is HC or GC.
|
---|
889 | *
|
---|
890 | * This is macro should only be used in shared code to avoid a forest of ifdefs.
|
---|
891 | * @param a_First First name.
|
---|
892 | * @param a_Last Surname.
|
---|
893 | */
|
---|
894 | /** @def OTHERCTXMID
|
---|
895 | * Adds the other context as a middle name of an identifier name
|
---|
896 | * The middle name is HC or GC.
|
---|
897 | *
|
---|
898 | * This is macro should only be used in shared code to avoid a forest of ifdefs.
|
---|
899 | * @param a_First First name.
|
---|
900 | * @param a_Last Surname.
|
---|
901 | * @deprecated use CTX_MID or CTX_MID_Z
|
---|
902 | */
|
---|
903 | #if defined(IN_RC) && !defined(DOXYGEN_RUNNING)
|
---|
904 | # define CTXMID(a_First, a_Last) a_First##GC##a_Last
|
---|
905 | # define OTHERCTXMID(a_First, a_Last) a_First##HC##a_Last
|
---|
906 | #else
|
---|
907 | # define CTXMID(a_First, a_Last) a_First##HC##a_Last
|
---|
908 | # define OTHERCTXMID(a_First, a_Last) a_First##GC##a_Last
|
---|
909 | #endif
|
---|
910 |
|
---|
911 | /** @def CTXALLMID
|
---|
912 | * Adds the current context as a middle name of an identifier name.
|
---|
913 | * The middle name is R3, R0 or GC.
|
---|
914 | *
|
---|
915 | * This is macro should only be used in shared code to avoid a forest of ifdefs.
|
---|
916 | * @param a_First First name.
|
---|
917 | * @param a_Last Surname.
|
---|
918 | * @deprecated use CTX_MID or CTX_MID_Z
|
---|
919 | */
|
---|
920 | #if defined(IN_RC) && !defined(DOXYGEN_RUNNING)
|
---|
921 | # define CTXALLMID(a_First, a_Last) a_First##GC##a_Last
|
---|
922 | #elif defined(IN_RING0) && !defined(DOXYGEN_RUNNING)
|
---|
923 | # define CTXALLMID(a_First, a_Last) a_First##R0##a_Last
|
---|
924 | #else
|
---|
925 | # define CTXALLMID(a_First, a_Last) a_First##R3##a_Last
|
---|
926 | #endif
|
---|
927 |
|
---|
928 | /** @def CTX_MID
|
---|
929 | * Adds the current context as a middle name of an identifier name.
|
---|
930 | * The middle name is R3, R0 or RC.
|
---|
931 | *
|
---|
932 | * This is macro should only be used in shared code to avoid a forest of ifdefs.
|
---|
933 | * @param a_First First name.
|
---|
934 | * @param a_Last Surname.
|
---|
935 | */
|
---|
936 | #if defined(IN_RC) && !defined(DOXYGEN_RUNNING)
|
---|
937 | # define CTX_MID(a_First, a_Last) a_First##RC##a_Last
|
---|
938 | #elif defined(IN_RING0) && !defined(DOXYGEN_RUNNING)
|
---|
939 | # define CTX_MID(a_First, a_Last) a_First##R0##a_Last
|
---|
940 | #else
|
---|
941 | # define CTX_MID(a_First, a_Last) a_First##R3##a_Last
|
---|
942 | #endif
|
---|
943 |
|
---|
944 | /** @def CTX_MID_Z
|
---|
945 | * Adds the current context as a middle name of an identifier name, combining RC
|
---|
946 | * and R0 into RZ.
|
---|
947 | * The middle name thus is either R3 or RZ.
|
---|
948 | *
|
---|
949 | * This is macro should only be used in shared code to avoid a forest of ifdefs.
|
---|
950 | * @param a_First First name.
|
---|
951 | * @param a_Last Surname.
|
---|
952 | */
|
---|
953 | #ifdef IN_RING3
|
---|
954 | # define CTX_MID_Z(a_First, a_Last) a_First##R3##a_Last
|
---|
955 | #else
|
---|
956 | # define CTX_MID_Z(a_First, a_Last) a_First##RZ##a_Last
|
---|
957 | #endif
|
---|
958 |
|
---|
959 |
|
---|
960 | /** @def R3STRING
|
---|
961 | * A macro which in GC and R0 will return a dummy string while in R3 it will return
|
---|
962 | * the parameter.
|
---|
963 | *
|
---|
964 | * This is typically used to wrap description strings in structures shared
|
---|
965 | * between R3, R0 and/or GC. The intention is to avoid the \#ifdef IN_RING3 mess.
|
---|
966 | *
|
---|
967 | * @param a_pR3String The R3 string. Only referenced in R3.
|
---|
968 | * @see R0STRING and GCSTRING
|
---|
969 | */
|
---|
970 | #ifdef IN_RING3
|
---|
971 | # define R3STRING(a_pR3String) (a_pR3String)
|
---|
972 | #else
|
---|
973 | # define R3STRING(a_pR3String) ("<R3_STRING>")
|
---|
974 | #endif
|
---|
975 |
|
---|
976 | /** @def R0STRING
|
---|
977 | * A macro which in GC and R3 will return a dummy string while in R0 it will return
|
---|
978 | * the parameter.
|
---|
979 | *
|
---|
980 | * This is typically used to wrap description strings in structures shared
|
---|
981 | * between R3, R0 and/or GC. The intention is to avoid the \#ifdef IN_RING0 mess.
|
---|
982 | *
|
---|
983 | * @param a_pR0String The R0 string. Only referenced in R0.
|
---|
984 | * @see R3STRING and GCSTRING
|
---|
985 | */
|
---|
986 | #ifdef IN_RING0
|
---|
987 | # define R0STRING(a_pR0String) (a_pR0String)
|
---|
988 | #else
|
---|
989 | # define R0STRING(a_pR0String) ("<R0_STRING>")
|
---|
990 | #endif
|
---|
991 |
|
---|
992 | /** @def RCSTRING
|
---|
993 | * A macro which in R3 and R0 will return a dummy string while in RC it will return
|
---|
994 | * the parameter.
|
---|
995 | *
|
---|
996 | * This is typically used to wrap description strings in structures shared
|
---|
997 | * between R3, R0 and/or RC. The intention is to avoid the \#ifdef IN_RC mess.
|
---|
998 | *
|
---|
999 | * @param a_pRCString The RC string. Only referenced in RC.
|
---|
1000 | * @see R3STRING, R0STRING
|
---|
1001 | */
|
---|
1002 | #ifdef IN_RC
|
---|
1003 | # define RCSTRING(a_pRCString) (a_pRCString)
|
---|
1004 | #else
|
---|
1005 | # define RCSTRING(a_pRCString) ("<RC_STRING>")
|
---|
1006 | #endif
|
---|
1007 |
|
---|
1008 |
|
---|
1009 | /** @def RT_NOTHING
|
---|
1010 | * A macro that expands to nothing.
|
---|
1011 | * This is primarily intended as a dummy argument for macros to avoid the
|
---|
1012 | * undefined behavior passing empty arguments to an macro (ISO C90 and C++98,
|
---|
1013 | * gcc v4.4 warns about it).
|
---|
1014 | */
|
---|
1015 | #define RT_NOTHING
|
---|
1016 |
|
---|
1017 | /** @def RT_GCC_EXTENSION
|
---|
1018 | * Macro for shutting up GCC warnings about using language extensions. */
|
---|
1019 | #ifdef __GNUC__
|
---|
1020 | # define RT_GCC_EXTENSION __extension__
|
---|
1021 | #else
|
---|
1022 | # define RT_GCC_EXTENSION
|
---|
1023 | #endif
|
---|
1024 |
|
---|
1025 | /** @def RT_GCC_NO_WARN_DEPRECATED_BEGIN
|
---|
1026 | * Used to start a block of code where GCC and Clang should not warn about
|
---|
1027 | * deprecated declarations. */
|
---|
1028 | /** @def RT_GCC_NO_WARN_DEPRECATED_END
|
---|
1029 | * Used to end a block of code where GCC and Clang should not warn about
|
---|
1030 | * deprecated declarations. */
|
---|
1031 | #if RT_CLANG_PREREQ(4, 0)
|
---|
1032 | # define RT_GCC_NO_WARN_DEPRECATED_BEGIN \
|
---|
1033 | _Pragma("clang diagnostic push") \
|
---|
1034 | _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
---|
1035 | # define RT_GCC_NO_WARN_DEPRECATED_END \
|
---|
1036 | _Pragma("clang diagnostic pop")
|
---|
1037 |
|
---|
1038 | #elif RT_GNUC_PREREQ(4, 6)
|
---|
1039 | # define RT_GCC_NO_WARN_DEPRECATED_BEGIN \
|
---|
1040 | _Pragma("GCC diagnostic push") \
|
---|
1041 | _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
---|
1042 | # define RT_GCC_NO_WARN_DEPRECATED_END \
|
---|
1043 | _Pragma("GCC diagnostic pop")
|
---|
1044 | #else
|
---|
1045 | # define RT_GCC_NO_WARN_DEPRECATED_BEGIN
|
---|
1046 | # define RT_GCC_NO_WARN_DEPRECATED_END
|
---|
1047 | #endif
|
---|
1048 |
|
---|
1049 | /** @def RT_GCC_NO_WARN_CONVERSION_BEGIN
|
---|
1050 | * Used to start a block of code where GCC should not warn about implicit
|
---|
1051 | * conversions that may alter a value. */
|
---|
1052 | #if RT_GNUC_PREREQ(4, 6)
|
---|
1053 | # define RT_GCC_NO_WARN_CONVERSION_BEGIN \
|
---|
1054 | _Pragma("GCC diagnostic push") \
|
---|
1055 | _Pragma("GCC diagnostic ignored \"-Wconversion\"")
|
---|
1056 | /** @def RT_GCC_NO_WARN_CONVERSION_END
|
---|
1057 | * Used to end a block of code where GCC should not warn about implicit
|
---|
1058 | * conversions that may alter a value. */
|
---|
1059 | # define RT_GCC_NO_WARN_CONVERSION_END \
|
---|
1060 | _Pragma("GCC diagnostic pop")
|
---|
1061 | #else
|
---|
1062 | # define RT_GCC_NO_WARN_CONVERSION_BEGIN
|
---|
1063 | # define RT_GCC_NO_WARN_CONVERSION_END
|
---|
1064 | #endif
|
---|
1065 |
|
---|
1066 | /** @def RT_COMPILER_GROKS_64BIT_BITFIELDS
|
---|
1067 | * Macro that is defined if the compiler understands 64-bit bitfields. */
|
---|
1068 | #if !defined(RT_OS_OS2) || (!defined(__IBMC__) && !defined(__IBMCPP__))
|
---|
1069 | # if !defined(__WATCOMC__) /* watcom compiler doesn't grok it either. */
|
---|
1070 | # define RT_COMPILER_GROKS_64BIT_BITFIELDS
|
---|
1071 | # endif
|
---|
1072 | #endif
|
---|
1073 |
|
---|
1074 | /** @def RT_COMPILER_WITH_80BIT_LONG_DOUBLE
|
---|
1075 | * Macro that is defined if the compiler implements long double as the
|
---|
1076 | * IEEE extended precision floating. */
|
---|
1077 | #if (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)) && !defined(RT_OS_WINDOWS)
|
---|
1078 | # define RT_COMPILER_WITH_80BIT_LONG_DOUBLE
|
---|
1079 | #endif
|
---|
1080 |
|
---|
1081 |
|
---|
1082 | /** @def RT_EXCEPTIONS_ENABLED
|
---|
1083 | * Defined when C++ exceptions are enabled.
|
---|
1084 | */
|
---|
1085 | #if !defined(RT_EXCEPTIONS_ENABLED) \
|
---|
1086 | && defined(__cplusplus) \
|
---|
1087 | && ( (defined(_MSC_VER) && defined(_CPPUNWIND)) \
|
---|
1088 | || (defined(__GNUC__) && defined(__EXCEPTIONS)))
|
---|
1089 | # define RT_EXCEPTIONS_ENABLED
|
---|
1090 | #endif
|
---|
1091 |
|
---|
1092 | /** @def DECL_NOTHROW
|
---|
1093 | * How to declare a function which does not throw C++ exceptions.
|
---|
1094 | *
|
---|
1095 | * @param a_Type The return type.
|
---|
1096 | *
|
---|
1097 | * @note This macro can be combined with other macros, for example
|
---|
1098 | * @code
|
---|
1099 | * EMR3DECL(DECL_NOTHROW(void)) foo(void);
|
---|
1100 | * @endcode
|
---|
1101 | *
|
---|
1102 | * @note GCC is currently restricted to 4.2+ given the ominous comments on
|
---|
1103 | * RT_NOTHROW_PROTO.
|
---|
1104 | */
|
---|
1105 | #ifdef __cplusplus
|
---|
1106 | # ifdef _MSC_VER
|
---|
1107 | # define DECL_NOTHROW(a_Type) __declspec(nothrow) a_Type
|
---|
1108 | # elif RT_CLANG_PREREQ(6,0) || RT_GNUC_PREREQ(4,2)
|
---|
1109 | # define DECL_NOTHROW(a_Type) __attribute__((__nothrow__)) a_Type
|
---|
1110 | # else
|
---|
1111 | # define DECL_NOTHROW(a_Type) a_Type
|
---|
1112 | # endif
|
---|
1113 | #else
|
---|
1114 | # define DECL_NOTHROW(a_Type) a_Type
|
---|
1115 | #endif
|
---|
1116 |
|
---|
1117 | /** @def RT_NOTHROW_PROTO
|
---|
1118 | * Function does not throw any C++ exceptions, prototype edition.
|
---|
1119 | *
|
---|
1120 | * How to express that a function doesn't throw C++ exceptions and the compiler
|
---|
1121 | * can thus save itself the bother of trying to catch any of them and generate
|
---|
1122 | * unwind info. Put this between the closing parenthesis and the semicolon in
|
---|
1123 | * function prototypes (and implementation if C++).
|
---|
1124 | *
|
---|
1125 | * @note This translates to 'noexcept' when compiling in newer C++ mode.
|
---|
1126 | *
|
---|
1127 | * @remarks The use of the nothrow attribute with GCC is because old compilers
|
---|
1128 | * (4.1.1, 32-bit) leaking the nothrow into global space or something
|
---|
1129 | * when used with RTDECL or similar. Using this forces us to have two
|
---|
1130 | * macros, as the nothrow attribute is not for the function definition.
|
---|
1131 | */
|
---|
1132 | /** @def RT_NOTHROW_DEF
|
---|
1133 | * Function does not throw any C++ exceptions, definition edition.
|
---|
1134 | *
|
---|
1135 | * The counter part to RT_NOTHROW_PROTO that is added to the function
|
---|
1136 | * definition.
|
---|
1137 | */
|
---|
1138 | #ifdef RT_EXCEPTIONS_ENABLED
|
---|
1139 | # if RT_MSC_PREREQ_EX(RT_MSC_VER_VS2015, 0) \
|
---|
1140 | || RT_CLANG_HAS_FEATURE(cxx_noexcept) \
|
---|
1141 | || (RT_GNUC_PREREQ(7, 0) && __cplusplus >= 201100)
|
---|
1142 | # define RT_NOTHROW_PROTO noexcept
|
---|
1143 | # define RT_NOTHROW_DEF noexcept
|
---|
1144 | # elif defined(__GNUC__)
|
---|
1145 | # if RT_GNUC_PREREQ(3, 3)
|
---|
1146 | # define RT_NOTHROW_PROTO __attribute__((__nothrow__))
|
---|
1147 | # else
|
---|
1148 | # define RT_NOTHROW_PROTO
|
---|
1149 | # endif
|
---|
1150 | # define RT_NOTHROW_DEF /* Would need a DECL_NO_THROW like __declspec(nothrow), which we wont do at this point. */
|
---|
1151 | # else
|
---|
1152 | # define RT_NOTHROW_PROTO throw()
|
---|
1153 | # define RT_NOTHROW_DEF throw()
|
---|
1154 | # endif
|
---|
1155 | #else
|
---|
1156 | # define RT_NOTHROW_PROTO
|
---|
1157 | # define RT_NOTHROW_DEF
|
---|
1158 | #endif
|
---|
1159 | /** @def RT_NOTHROW_PROTO
|
---|
1160 | * @deprecated Use RT_NOTHROW_PROTO. */
|
---|
1161 | #define RT_NO_THROW_PROTO RT_NOTHROW_PROTO
|
---|
1162 | /** @def RT_NOTHROW_DEF
|
---|
1163 | * @deprecated Use RT_NOTHROW_DEF. */
|
---|
1164 | #define RT_NO_THROW_DEF RT_NOTHROW_DEF
|
---|
1165 |
|
---|
1166 | /** @def RT_THROW
|
---|
1167 | * How to express that a method or function throws a type of exceptions. Some
|
---|
1168 | * compilers does not want this kind of information and will warning about it.
|
---|
1169 | *
|
---|
1170 | * @param a_Type The type exception.
|
---|
1171 | *
|
---|
1172 | * @remarks If the actual throwing is done from the header, enclose it by
|
---|
1173 | * \#ifdef RT_EXCEPTIONS_ENABLED ... \#else ... \#endif so the header
|
---|
1174 | * compiles cleanly without exceptions enabled.
|
---|
1175 | *
|
---|
1176 | * Do NOT use this for the actual throwing of exceptions!
|
---|
1177 | */
|
---|
1178 | #ifdef RT_EXCEPTIONS_ENABLED
|
---|
1179 | # if RT_MSC_PREREQ_EX(RT_MSC_VER_VC71, 0)
|
---|
1180 | # define RT_THROW(a_Type)
|
---|
1181 | # elif RT_GNUC_PREREQ(7, 0)
|
---|
1182 | # define RT_THROW(a_Type)
|
---|
1183 | # else
|
---|
1184 | # define RT_THROW(a_Type) throw(a_Type)
|
---|
1185 | # endif
|
---|
1186 | #else
|
---|
1187 | # define RT_THROW(a_Type)
|
---|
1188 | #endif
|
---|
1189 |
|
---|
1190 |
|
---|
1191 | /** @def RT_OVERRIDE
|
---|
1192 | * Wrapper for the C++11 override keyword.
|
---|
1193 | *
|
---|
1194 | * @remarks Recognized by g++ starting 4.7, however causes pedantic warnings
|
---|
1195 | * when used without officially enabling the C++11 features.
|
---|
1196 | */
|
---|
1197 | #ifdef __cplusplus
|
---|
1198 | # if RT_MSC_PREREQ_EX(RT_MSC_VER_VS2012, 0)
|
---|
1199 | # define RT_OVERRIDE override
|
---|
1200 | # elif RT_GNUC_PREREQ(4, 7)
|
---|
1201 | # if __cplusplus >= 201100
|
---|
1202 | # define RT_OVERRIDE override
|
---|
1203 | # else
|
---|
1204 | # define RT_OVERRIDE
|
---|
1205 | # endif
|
---|
1206 | # else
|
---|
1207 | # define RT_OVERRIDE
|
---|
1208 | # endif
|
---|
1209 | #else
|
---|
1210 | # define RT_OVERRIDE
|
---|
1211 | #endif
|
---|
1212 |
|
---|
1213 | /** @def RT_NOEXCEPT
|
---|
1214 | * Wrapper for the C++11 noexcept keyword (only true form).
|
---|
1215 | * @note use RT_NOTHROW instead.
|
---|
1216 | */
|
---|
1217 | /** @def RT_NOEXCEPT_EX
|
---|
1218 | * Wrapper for the C++11 noexcept keyword with expression.
|
---|
1219 | * @param a_Expr The expression.
|
---|
1220 | */
|
---|
1221 | #ifdef __cplusplus
|
---|
1222 | # if (RT_MSC_PREREQ_EX(RT_MSC_VER_VS2015, 0) && defined(RT_EXCEPTIONS_ENABLED)) \
|
---|
1223 | || RT_CLANG_HAS_FEATURE(cxx_noexcept) \
|
---|
1224 | || (RT_GNUC_PREREQ(7, 0) && __cplusplus >= 201100)
|
---|
1225 | # define RT_NOEXCEPT noexcept
|
---|
1226 | # define RT_NOEXCEPT_EX(a_Expr) noexcept(a_Expr)
|
---|
1227 | # else
|
---|
1228 | # define RT_NOEXCEPT
|
---|
1229 | # define RT_NOEXCEPT_EX(a_Expr)
|
---|
1230 | # endif
|
---|
1231 | #else
|
---|
1232 | # define RT_NOEXCEPT
|
---|
1233 | # define RT_NOEXCEPT_EX(a_Expr)
|
---|
1234 | #endif
|
---|
1235 |
|
---|
1236 |
|
---|
1237 | /** @def RT_FALL_THROUGH
|
---|
1238 | * Tell the compiler that we're falling through to the next case in a switch.
|
---|
1239 | * @sa RT_FALL_THRU */
|
---|
1240 | #if RT_CLANG_PREREQ(4, 0) && RT_CPLUSPLUS_PREREQ(201100)
|
---|
1241 | # define RT_FALL_THROUGH() [[clang::fallthrough]]
|
---|
1242 | #elif RT_GNUC_PREREQ(7, 0)
|
---|
1243 | # define RT_FALL_THROUGH() __attribute__((__fallthrough__))
|
---|
1244 | #else
|
---|
1245 | # define RT_FALL_THROUGH() (void)0
|
---|
1246 | #endif
|
---|
1247 | /** @def RT_FALL_THRU
|
---|
1248 | * Tell the compiler that we're falling thru to the next case in a switch.
|
---|
1249 | * @sa RT_FALL_THROUGH */
|
---|
1250 | #define RT_FALL_THRU() RT_FALL_THROUGH()
|
---|
1251 |
|
---|
1252 |
|
---|
1253 | /** @def RT_IPRT_FORMAT_ATTR
|
---|
1254 | * Identifies a function taking an IPRT format string.
|
---|
1255 | * @param a_iFmt The index (1-based) of the format string argument.
|
---|
1256 | * @param a_iArgs The index (1-based) of the first format argument, use 0 for
|
---|
1257 | * va_list.
|
---|
1258 | */
|
---|
1259 | #if defined(__GNUC__) && defined(WITH_IPRT_FORMAT_ATTRIBUTE)
|
---|
1260 | # define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs) __attribute__((__iprt_format__(a_iFmt, a_iArgs)))
|
---|
1261 | #else
|
---|
1262 | # define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs)
|
---|
1263 | #endif
|
---|
1264 |
|
---|
1265 | /** @def RT_IPRT_FORMAT_ATTR_MAYBE_NULL
|
---|
1266 | * Identifies a function taking an IPRT format string, NULL is allowed.
|
---|
1267 | * @param a_iFmt The index (1-based) of the format string argument.
|
---|
1268 | * @param a_iArgs The index (1-based) of the first format argument, use 0 for
|
---|
1269 | * va_list.
|
---|
1270 | */
|
---|
1271 | #if defined(__GNUC__) && defined(WITH_IPRT_FORMAT_ATTRIBUTE)
|
---|
1272 | # define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs) __attribute__((__iprt_format_maybe_null__(a_iFmt, a_iArgs)))
|
---|
1273 | #else
|
---|
1274 | # define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs)
|
---|
1275 | #endif
|
---|
1276 |
|
---|
1277 |
|
---|
1278 | /** @def RT_GCC_SUPPORTS_VISIBILITY_HIDDEN
|
---|
1279 | * Indicates that the "hidden" visibility attribute can be used (GCC) */
|
---|
1280 | #if defined(__GNUC__)
|
---|
1281 | # if __GNUC__ >= 4 && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS)
|
---|
1282 | # define RT_GCC_SUPPORTS_VISIBILITY_HIDDEN
|
---|
1283 | # endif
|
---|
1284 | #endif
|
---|
1285 |
|
---|
1286 | /** @def RT_COMPILER_SUPPORTS_VA_ARGS
|
---|
1287 | * If the defined, the compiler supports the variadic macro feature (..., __VA_ARGS__). */
|
---|
1288 | #if defined(_MSC_VER)
|
---|
1289 | # if _MSC_VER >= 1600 /* Visual C++ v10.0 / 2010 */
|
---|
1290 | # define RT_COMPILER_SUPPORTS_VA_ARGS
|
---|
1291 | # endif
|
---|
1292 | #elif defined(__GNUC__)
|
---|
1293 | # if __GNUC__ >= 3 /* not entirely sure when this was added */
|
---|
1294 | # define RT_COMPILER_SUPPORTS_VA_ARGS
|
---|
1295 | # endif
|
---|
1296 | #elif defined(__WATCOMC__)
|
---|
1297 | # define RT_COMPILER_SUPPORTS_VA_ARGS
|
---|
1298 | #endif
|
---|
1299 |
|
---|
1300 | /** @def RT_CB_LOG_CAST
|
---|
1301 | * Helper for logging function pointers to function may throw stuff.
|
---|
1302 | *
|
---|
1303 | * Not needed for function pointer types declared using our DECLCALLBACK
|
---|
1304 | * macros, only external types. */
|
---|
1305 | #if defined(_MSC_VER) && defined(RT_EXCEPTIONS_ENABLED)
|
---|
1306 | # define RT_CB_LOG_CAST(a_pfnCallback) ((uintptr_t)(a_pfnCallback) + 1 - 1)
|
---|
1307 | #else
|
---|
1308 | # define RT_CB_LOG_CAST(a_pfnCallback) (a_pfnCallback)
|
---|
1309 | #endif
|
---|
1310 |
|
---|
1311 |
|
---|
1312 |
|
---|
1313 | /** @def RTCALL
|
---|
1314 | * The standard calling convention for the Runtime interfaces.
|
---|
1315 | *
|
---|
1316 | * @remarks The regparm(0) in the X86/GNUC variant deals with -mregparm=x use in
|
---|
1317 | * the linux kernel and potentially elsewhere (3rd party).
|
---|
1318 | */
|
---|
1319 | #if defined(_MSC_VER) || defined(__WATCOMC__)
|
---|
1320 | # define RTCALL __cdecl
|
---|
1321 | #elif defined(RT_OS_OS2)
|
---|
1322 | # define RTCALL __cdecl
|
---|
1323 | #elif defined(__GNUC__) && defined(RT_ARCH_X86)
|
---|
1324 | # define RTCALL __attribute__((__cdecl__,__regparm__(0)))
|
---|
1325 | #else
|
---|
1326 | # define RTCALL
|
---|
1327 | #endif
|
---|
1328 |
|
---|
1329 | /** @def DECLEXPORT
|
---|
1330 | * How to declare an exported function.
|
---|
1331 | * @param a_RetType The return type of the function declaration.
|
---|
1332 | */
|
---|
1333 | #if defined(_MSC_VER) || defined(RT_OS_OS2)
|
---|
1334 | # define DECLEXPORT(a_RetType) __declspec(dllexport) a_RetType
|
---|
1335 | #elif defined(RT_USE_VISIBILITY_DEFAULT)
|
---|
1336 | # define DECLEXPORT(a_RetType) __attribute__((visibility("default"))) a_RetType
|
---|
1337 | #else
|
---|
1338 | # define DECLEXPORT(a_RetType) a_RetType
|
---|
1339 | #endif
|
---|
1340 |
|
---|
1341 | /** @def DECL_IMPORT_NOTHROW
|
---|
1342 | * How to declare an exported function that does not throw C++ exceptions.
|
---|
1343 | * @param a_RetType The return type of the function declaration.
|
---|
1344 | */
|
---|
1345 | #define DECL_EXPORT_NOTHROW(a_RetType) DECL_NOTHROW(DECLEXPORT(a_RetType))
|
---|
1346 |
|
---|
1347 | /** @def DECLIMPORT
|
---|
1348 | * How to declare an imported function.
|
---|
1349 | * @param a_RetType The return type of the function declaration.
|
---|
1350 | */
|
---|
1351 | #if defined(_MSC_VER) || (defined(RT_OS_OS2) && !defined(__IBMC__) && !defined(__IBMCPP__))
|
---|
1352 | # define DECLIMPORT(a_RetType) __declspec(dllimport) a_RetType
|
---|
1353 | #else
|
---|
1354 | # define DECLIMPORT(a_RetType) a_RetType
|
---|
1355 | #endif
|
---|
1356 |
|
---|
1357 | /** @def DECL_IMPORT_NOTHROW
|
---|
1358 | * How to declare an imported function that does not throw C++ exceptions.
|
---|
1359 | * @param a_RetType The return type of the function declaration.
|
---|
1360 | */
|
---|
1361 | #define DECL_IMPORT_NOTHROW(a_RetType) DECL_NOTHROW(DECLIMPORT(a_RetType))
|
---|
1362 |
|
---|
1363 | /** @def DECL_HIDDEN_ONLY
|
---|
1364 | * How to declare a non-exported function or variable.
|
---|
1365 | * @param a_Type The return type of the function or the data type of the variable.
|
---|
1366 | * @sa DECL_HIDDEN, DECL_HIDDEN_DATA, DECL_HIDDEN_CONST
|
---|
1367 | * @internal Considered more or less internal.
|
---|
1368 | */
|
---|
1369 | #if !defined(RT_GCC_SUPPORTS_VISIBILITY_HIDDEN) || defined(RT_NO_VISIBILITY_HIDDEN)
|
---|
1370 | # define DECL_HIDDEN_ONLY(a_Type) a_Type
|
---|
1371 | #else
|
---|
1372 | # define DECL_HIDDEN_ONLY(a_Type) __attribute__((visibility("hidden"))) a_Type
|
---|
1373 | #endif
|
---|
1374 |
|
---|
1375 | /** @def DECLHIDDEN
|
---|
1376 | * How to declare a non-exported function or variable.
|
---|
1377 | * @param a_Type The return type of the function or the data type of the variable.
|
---|
1378 | * @sa DECL_HIDDEN_THROW, DECL_HIDDEN_DATA, DECL_HIDDEN_CONST
|
---|
1379 | * @todo split up into data and non-data.
|
---|
1380 | */
|
---|
1381 | #define DECLHIDDEN(a_Type) DECL_NOTHROW(DECL_HIDDEN_ONLY(a_Type))
|
---|
1382 |
|
---|
1383 | /** @def DECL_HIDDEN_NOTHROW
|
---|
1384 | * How to declare a non-exported function that does not throw C++ exceptions.
|
---|
1385 | * @param a_RetType The return type of the function.
|
---|
1386 | * @note Same as DECLHIDDEN but provided to go along with DECL_IMPORT_NOTHROW
|
---|
1387 | * and DECL_EXPORT_NOTHROW.
|
---|
1388 | */
|
---|
1389 | #define DECL_HIDDEN_NOTHROW(a_RetType) DECL_NOTHROW(DECL_HIDDEN_ONLY(a_RetType))
|
---|
1390 |
|
---|
1391 | /** @def DECL_HIDDEN_THROW
|
---|
1392 | * How to declare a non-exported function that may throw C++ exceptions.
|
---|
1393 | * @param a_RetType The return type of the function.
|
---|
1394 | */
|
---|
1395 | #define DECL_HIDDEN_THROW(a_RetType) DECL_HIDDEN_ONLY(a_Type)
|
---|
1396 |
|
---|
1397 | /** @def DECL_HIDDEN_DATA
|
---|
1398 | * How to declare a non-exported variable.
|
---|
1399 | * @param a_Type The data type of the variable.
|
---|
1400 | * @sa DECL_HIDDEN_CONST
|
---|
1401 | */
|
---|
1402 | #if !defined(RT_GCC_SUPPORTS_VISIBILITY_HIDDEN) || defined(RT_NO_VISIBILITY_HIDDEN)
|
---|
1403 | # define DECL_HIDDEN_DATA(a_Type) a_Type
|
---|
1404 | #else
|
---|
1405 | # define DECL_HIDDEN_DATA(a_Type) __attribute__((visibility("hidden"))) a_Type
|
---|
1406 | #endif
|
---|
1407 |
|
---|
1408 | /** @def DECL_HIDDEN_CONST
|
---|
1409 | * Workaround for g++ warnings when applying the hidden attribute to a const
|
---|
1410 | * definition. Use DECL_HIDDEN_DATA for the declaration.
|
---|
1411 | * @param a_Type The data type of the variable.
|
---|
1412 | * @sa DECL_HIDDEN_DATA
|
---|
1413 | */
|
---|
1414 | #if defined(__cplusplus) && defined(__GNUC__)
|
---|
1415 | # define DECL_HIDDEN_CONST(a_Type) a_Type
|
---|
1416 | #else
|
---|
1417 | # define DECL_HIDDEN_CONST(a_Type) DECL_HIDDEN_DATA(a_Type)
|
---|
1418 | #endif
|
---|
1419 |
|
---|
1420 | /** @def DECL_INVALID
|
---|
1421 | * How to declare a function not available for linking in the current context.
|
---|
1422 | * The purpose is to create compile or like time errors when used. This isn't
|
---|
1423 | * possible on all platforms.
|
---|
1424 | * @param a_RetType The return type of the function.
|
---|
1425 | */
|
---|
1426 | #if defined(_MSC_VER)
|
---|
1427 | # define DECL_INVALID(a_RetType) __declspec(dllimport) a_RetType __stdcall
|
---|
1428 | #elif defined(__GNUC__) && defined(__cplusplus)
|
---|
1429 | # define DECL_INVALID(a_RetType) extern "C++" a_RetType
|
---|
1430 | #else
|
---|
1431 | # define DECL_INVALID(a_RetType) a_RetType
|
---|
1432 | #endif
|
---|
1433 |
|
---|
1434 | /** @def DECLASM
|
---|
1435 | * How to declare an internal assembly function.
|
---|
1436 | * @param a_RetType The return type of the function declaration.
|
---|
1437 | * @note DECL_NOTHROW is implied.
|
---|
1438 | */
|
---|
1439 | #ifdef __cplusplus
|
---|
1440 | # define DECLASM(a_RetType) extern "C" DECL_NOTHROW(a_RetType RTCALL)
|
---|
1441 | #else
|
---|
1442 | # define DECLASM(a_RetType) DECL_NOTHROW(a_RetType RTCALL)
|
---|
1443 | #endif
|
---|
1444 |
|
---|
1445 | /** @def RT_ASM_DECL_PRAGMA_WATCOM
|
---|
1446 | * How to declare a assembly method prototype with watcom \#pragma aux definition. */
|
---|
1447 | /** @def RT_ASM_DECL_PRAGMA_WATCOM_386
|
---|
1448 | * Same as RT_ASM_DECL_PRAGMA_WATCOM, but there is no 16-bit version when
|
---|
1449 | * 8086, 80186 or 80286 is selected as the target CPU. */
|
---|
1450 | #if defined(__WATCOMC__) && ARCH_BITS == 16 && defined(RT_ARCH_X86)
|
---|
1451 | # define RT_ASM_DECL_PRAGMA_WATCOM(a_RetType) a_RetType
|
---|
1452 | # if defined(__SW_0) || defined(__SW_1) || defined(__SW_2)
|
---|
1453 | # define RT_ASM_DECL_PRAGMA_WATCOM_386(a_RetType) DECLASM(a_RetType)
|
---|
1454 | # else
|
---|
1455 | # define RT_ASM_DECL_PRAGMA_WATCOM_386(a_RetType) a_RetType
|
---|
1456 | # endif
|
---|
1457 | #elif defined(__WATCOMC__) && ARCH_BITS == 32 && defined(RT_ARCH_X86)
|
---|
1458 | # define RT_ASM_DECL_PRAGMA_WATCOM(a_RetType) a_RetType
|
---|
1459 | # define RT_ASM_DECL_PRAGMA_WATCOM_386(a_RetType) a_RetType
|
---|
1460 | #else
|
---|
1461 | # define RT_ASM_DECL_PRAGMA_WATCOM(a_RetType) DECLASM(a_RetType)
|
---|
1462 | # define RT_ASM_DECL_PRAGMA_WATCOM_386(a_RetType) DECLASM(a_RetType)
|
---|
1463 | #endif
|
---|
1464 |
|
---|
1465 | /** @def DECL_NO_RETURN
|
---|
1466 | * How to declare a function which does not return.
|
---|
1467 | * @note This macro can be combined with other macros, for example
|
---|
1468 | * @code
|
---|
1469 | * EMR3DECL(DECL_NO_RETURN(void)) foo(void);
|
---|
1470 | * @endcode
|
---|
1471 | */
|
---|
1472 | #ifdef _MSC_VER
|
---|
1473 | # define DECL_NO_RETURN(a_RetType) __declspec(noreturn) a_RetType
|
---|
1474 | #elif defined(__GNUC__)
|
---|
1475 | # define DECL_NO_RETURN(a_RetType) __attribute__((noreturn)) a_RetType
|
---|
1476 | #else
|
---|
1477 | # define DECL_NO_RETURN(a_RetType) a_RetType
|
---|
1478 | #endif
|
---|
1479 |
|
---|
1480 | /** @def DECL_RETURNS_TWICE
|
---|
1481 | * How to declare a function which may return more than once.
|
---|
1482 | * @note This macro can be combined with other macros, for example
|
---|
1483 | * @code
|
---|
1484 | * EMR3DECL(DECL_RETURNS_TWICE(void)) MySetJmp(void);
|
---|
1485 | * @endcode
|
---|
1486 | */
|
---|
1487 | #if RT_GNUC_PREREQ(4, 1)
|
---|
1488 | # define DECL_RETURNS_TWICE(a_RetType) __attribute__((returns_twice)) a_RetType
|
---|
1489 | # else
|
---|
1490 | # define DECL_RETURNS_TWICE(a_RetType) a_RetType
|
---|
1491 | #endif
|
---|
1492 |
|
---|
1493 | /** @def DECLWEAK
|
---|
1494 | * How to declare a variable which is not necessarily resolved at
|
---|
1495 | * runtime.
|
---|
1496 | * @note This macro can be combined with other macros, for example
|
---|
1497 | * @code
|
---|
1498 | * EMR3DECL(DECLWEAK(int)) foo;
|
---|
1499 | * @endcode
|
---|
1500 | */
|
---|
1501 | #if defined(__GNUC__)
|
---|
1502 | # define DECLWEAK(a_Type) a_Type __attribute__((weak))
|
---|
1503 | #else
|
---|
1504 | # define DECLWEAK(a_Type) a_Type
|
---|
1505 | #endif
|
---|
1506 |
|
---|
1507 | /** @def DECLCALLBACK
|
---|
1508 | * How to declare an call back function.
|
---|
1509 | * @param a_RetType The return type of the function declaration.
|
---|
1510 | * @note DECL_NOTHROW is implied.
|
---|
1511 | * @note Use DECLCALLBACKTYPE for typedefs.
|
---|
1512 | */
|
---|
1513 | #define DECLCALLBACK(a_RetType) DECL_NOTHROW(a_RetType RT_FAR_CODE RTCALL)
|
---|
1514 |
|
---|
1515 | /** @def DECL_HIDDEN_CALLBACK
|
---|
1516 | * How to declare an call back function with hidden visibility.
|
---|
1517 | * @param a_RetType The return type of the function declaration.
|
---|
1518 | * @note DECL_NOTHROW is implied.
|
---|
1519 | * @note Use DECLCALLBACKTYPE for typedefs.
|
---|
1520 | */
|
---|
1521 | #define DECL_HIDDEN_CALLBACK(a_RetType) DECL_HIDDEN_ONLY(DECLCALLBACK(a_RetType))
|
---|
1522 |
|
---|
1523 | /** @def DECLCALLBACKTYPE_EX
|
---|
1524 | * How to declare an call back function type.
|
---|
1525 | * @param a_RetType The return type of the function declaration.
|
---|
1526 | * @param a_CallConv Calling convention.
|
---|
1527 | * @param a_Name The name of the typedef
|
---|
1528 | * @param a_Args The argument list enclosed in parentheses.
|
---|
1529 | * @note DECL_NOTHROW is implied, but not supported by all compilers yet.
|
---|
1530 | */
|
---|
1531 | #if RT_CLANG_PREREQ(6,0)
|
---|
1532 | # define DECLCALLBACKTYPE_EX(a_RetType, a_CallConv, a_Name, a_Args) __attribute__((__nothrow__)) a_RetType a_CallConv a_Name a_Args
|
---|
1533 | #elif defined(_MSC_VER) && defined(__cplusplus) && defined(_MSC_EXTENSIONS)
|
---|
1534 | # define DECLCALLBACKTYPE_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType a_CallConv a_Name a_Args throw()
|
---|
1535 | #else
|
---|
1536 | # define DECLCALLBACKTYPE_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType a_CallConv a_Name a_Args
|
---|
1537 | #endif
|
---|
1538 | /** @def DECLCALLBACKTYPE
|
---|
1539 | * How to declare an call back function type.
|
---|
1540 | * @param a_RetType The return type of the function declaration.
|
---|
1541 | * @param a_Name The name of the typedef
|
---|
1542 | * @param a_Args The argument list enclosed in parentheses.
|
---|
1543 | * @note DECL_NOTHROW is implied, but not supported by all compilers yet.
|
---|
1544 | */
|
---|
1545 | #define DECLCALLBACKTYPE(a_RetType, a_Name, a_Args) DECLCALLBACKTYPE_EX(a_RetType, RT_FAR_CODE RTCALL, a_Name, a_Args)
|
---|
1546 |
|
---|
1547 | /** @def DECLCALLBACKPTR_EX
|
---|
1548 | * How to declare an call back function pointer.
|
---|
1549 | * @param a_RetType The return type of the function declaration.
|
---|
1550 | * @param a_CallConv Calling convention.
|
---|
1551 | * @param a_Name The name of the variable member.
|
---|
1552 | * @param a_Args The argument list enclosed in parentheses.
|
---|
1553 | * @note DECL_NOTHROW is implied, but not supported by all compilers yet.
|
---|
1554 | */
|
---|
1555 | #if defined(__IBMC__) || defined(__IBMCPP__)
|
---|
1556 | # define DECLCALLBACKPTR_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (* a_CallConv a_Name) a_Args
|
---|
1557 | #elif RT_CLANG_PREREQ(6,0)
|
---|
1558 | # define DECLCALLBACKPTR_EX(a_RetType, a_CallConv, a_Name, a_Args) __attribute__((__nothrow__)) a_RetType (a_CallConv * a_Name) a_Args
|
---|
1559 | #elif defined(_MSC_VER) && defined(__cplusplus) && defined(_MSC_EXTENSIONS)
|
---|
1560 | # define DECLCALLBACKPTR_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (a_CallConv * a_Name) a_Args throw()
|
---|
1561 | #else
|
---|
1562 | # define DECLCALLBACKPTR_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (a_CallConv * a_Name) a_Args
|
---|
1563 | #endif
|
---|
1564 | /** @def DECLCALLBACKPTR
|
---|
1565 | * How to declare an call back function pointer.
|
---|
1566 | * @param a_RetType The return type of the function declaration.
|
---|
1567 | * @param a_Name The name of the variable member.
|
---|
1568 | * @param a_Args The argument list enclosed in parentheses.
|
---|
1569 | * @note DECL_NOTHROW is implied, but not supported by all compilers yet.
|
---|
1570 | */
|
---|
1571 | #define DECLCALLBACKPTR(a_RetType, a_Name, a_Args) DECLCALLBACKPTR_EX(a_RetType, RT_FAR_CODE RTCALL, a_Name, a_Args)
|
---|
1572 |
|
---|
1573 | /** @def DECLCALLBACKMEMBER_EX
|
---|
1574 | * How to declare an call back function pointer member.
|
---|
1575 | * @param a_RetType The return type of the function declaration.
|
---|
1576 | * @param a_CallConv Calling convention.
|
---|
1577 | * @param a_Name The name of the struct/union/class member.
|
---|
1578 | * @param a_Args The argument list enclosed in parentheses.
|
---|
1579 | * @note DECL_NOTHROW is implied, but not supported by all compilers yet.
|
---|
1580 | */
|
---|
1581 | #if defined(__IBMC__) || defined(__IBMCPP__)
|
---|
1582 | # define DECLCALLBACKMEMBER_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (* a_CallConv a_Name) a_Args
|
---|
1583 | #elif RT_CLANG_PREREQ(6,0)
|
---|
1584 | # define DECLCALLBACKMEMBER_EX(a_RetType, a_CallConv, a_Name, a_Args) __attribute__((__nothrow__)) a_RetType (a_CallConv *a_Name) a_Args
|
---|
1585 | #elif defined(_MSC_VER) && defined(__cplusplus) && defined(_MSC_EXTENSIONS)
|
---|
1586 | # define DECLCALLBACKMEMBER_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (a_CallConv *a_Name) a_Args throw()
|
---|
1587 | #else
|
---|
1588 | # define DECLCALLBACKMEMBER_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (a_CallConv *a_Name) a_Args
|
---|
1589 | #endif
|
---|
1590 | /** @def DECLCALLBACKMEMBER
|
---|
1591 | * How to declare an call back function pointer member.
|
---|
1592 | * @param a_RetType The return type of the function declaration.
|
---|
1593 | * @param a_Name The name of the struct/union/class member.
|
---|
1594 | * @param a_Args The argument list enclosed in parentheses.
|
---|
1595 | * @note DECL_NOTHROW is implied, but not supported by all compilers yet.
|
---|
1596 | */
|
---|
1597 | #define DECLCALLBACKMEMBER(a_RetType, a_Name, a_Args) DECLCALLBACKMEMBER_EX(a_RetType, RT_FAR_CODE RTCALL, a_Name, a_Args)
|
---|
1598 |
|
---|
1599 | /** @def DECLR3CALLBACKMEMBER
|
---|
1600 | * How to declare an call back function pointer member - R3 Ptr.
|
---|
1601 | * @param a_RetType The return type of the function declaration.
|
---|
1602 | * @param a_Name The name of the struct/union/class member.
|
---|
1603 | * @param a_Args The argument list enclosed in parentheses.
|
---|
1604 | * @note DECL_NOTHROW is implied, but not supported by all compilers yet.
|
---|
1605 | */
|
---|
1606 | #if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
|
---|
1607 | # define DECLR3CALLBACKMEMBER(a_RetType, a_Name, a_Args) DECLCALLBACKMEMBER(a_RetType, a_Name, a_Args)
|
---|
1608 | #else
|
---|
1609 | # define DECLR3CALLBACKMEMBER(a_RetType, a_Name, a_Args) RTR3PTR a_Name
|
---|
1610 | #endif
|
---|
1611 |
|
---|
1612 | /** @def DECLRCCALLBACKMEMBER
|
---|
1613 | * How to declare an call back function pointer member - RC Ptr.
|
---|
1614 | * @param a_RetType The return type of the function declaration.
|
---|
1615 | * @param a_Name The name of the struct/union/class member.
|
---|
1616 | * @param a_Args The argument list enclosed in parentheses.
|
---|
1617 | * @note DECL_NOTHROW is implied, but not supported by all compilers yet.
|
---|
1618 | */
|
---|
1619 | #if defined(IN_RC) || defined(DOXYGEN_RUNNING)
|
---|
1620 | # define DECLRCCALLBACKMEMBER(a_RetType, a_Name, a_Args) DECLCALLBACKMEMBER(a_RetType, a_Name, a_Args)
|
---|
1621 | #else
|
---|
1622 | # define DECLRCCALLBACKMEMBER(a_RetType, a_Name, a_Args) RTRCPTR a_Name
|
---|
1623 | #endif
|
---|
1624 | #if defined(IN_RC) || defined(DOXYGEN_RUNNING)
|
---|
1625 | # define DECLRGCALLBACKMEMBER(a_RetType, a_Name, a_Args) DECLCALLBACKMEMBER(a_RetType, a_Name, a_Args)
|
---|
1626 | #else
|
---|
1627 | # define DECLRGCALLBACKMEMBER(a_RetType, a_Name, a_Args) RTRGPTR a_Name
|
---|
1628 | #endif
|
---|
1629 |
|
---|
1630 | /** @def DECLR0CALLBACKMEMBER
|
---|
1631 | * How to declare an call back function pointer member - R0 Ptr.
|
---|
1632 | * @param a_RetType The return type of the function declaration.
|
---|
1633 | * @param a_Name The name of the struct/union/class member.
|
---|
1634 | * @param a_Args The argument list enclosed in parentheses.
|
---|
1635 | * @note DECL_NOTHROW is implied, but not supported by all compilers yet.
|
---|
1636 | */
|
---|
1637 | #if defined(IN_RING0) || defined(DOXYGEN_RUNNING)
|
---|
1638 | # define DECLR0CALLBACKMEMBER(a_RetType, a_Name, a_Args) DECLCALLBACKMEMBER(a_RetType, a_Name, a_Args)
|
---|
1639 | #else
|
---|
1640 | # define DECLR0CALLBACKMEMBER(a_RetType, a_Name, a_Args) RTR0PTR a_Name
|
---|
1641 | #endif
|
---|
1642 |
|
---|
1643 | /** @def DECLINLINE
|
---|
1644 | * How to declare a function as inline that does not throw any C++ exceptions.
|
---|
1645 | * @param a_RetType The return type of the function declaration.
|
---|
1646 | * @remarks Don't use this macro on C++ methods.
|
---|
1647 | * @sa DECL_INLINE_THROW
|
---|
1648 | */
|
---|
1649 | #if defined(__GNUC__) && !defined(DOXYGEN_RUNNING)
|
---|
1650 | # define DECLINLINE(a_RetType) DECL_NOTHROW(static __inline__ a_RetType)
|
---|
1651 | #elif defined(__cplusplus) || defined(DOXYGEN_RUNNING)
|
---|
1652 | # define DECLINLINE(a_RetType) DECL_NOTHROW(static inline a_RetType)
|
---|
1653 | #elif defined(_MSC_VER)
|
---|
1654 | # define DECLINLINE(a_RetType) DECL_NOTHROW(static _inline a_RetType)
|
---|
1655 | #elif defined(__IBMC__)
|
---|
1656 | # define DECLINLINE(a_RetType) DECL_NOTHROW(_Inline a_RetType)
|
---|
1657 | #else
|
---|
1658 | # define DECLINLINE(a_RetType) DECL_NOTHROW(inline a_RetType)
|
---|
1659 | #endif
|
---|
1660 |
|
---|
1661 | /** @def DECL_INLINE_THROW
|
---|
1662 | * How to declare a function as inline that throws C++ exceptions.
|
---|
1663 | * @param a_RetType The return type of the function declaration.
|
---|
1664 | * @remarks Don't use this macro on C++ methods.
|
---|
1665 | */
|
---|
1666 | #if defined(__GNUC__) && !defined(DOXYGEN_RUNNING)
|
---|
1667 | # define DECL_INLINE_THROW(a_RetType) static __inline__ a_RetType
|
---|
1668 | #elif defined(__cplusplus) || defined(DOXYGEN_RUNNING)
|
---|
1669 | # define DECL_INLINE_THROW(a_RetType) static inline a_RetType
|
---|
1670 | #elif defined(_MSC_VER)
|
---|
1671 | # define DECL_INLINE_THROW(a_RetType) static _inline a_RetType
|
---|
1672 | #elif defined(__IBMC__)
|
---|
1673 | # define DECL_INLINE_THROW(a_RetType) _Inline a_RetType
|
---|
1674 | #else
|
---|
1675 | # define DECL_INLINE_THROW(a_RetType) inline a_RetType
|
---|
1676 | #endif
|
---|
1677 |
|
---|
1678 | /** @def DECL_FORCE_INLINE
|
---|
1679 | * How to declare a function that does not throw any C++ exceptions as inline
|
---|
1680 | * and try convince the compiler to always inline it regardless of optimization
|
---|
1681 | * switches.
|
---|
1682 | * @param a_RetType The return type of the function declaration.
|
---|
1683 | * @remarks Use sparsely and with care. Don't use this macro on C++ methods.
|
---|
1684 | * @sa DECL_FORCE_INLINE_THROW
|
---|
1685 | */
|
---|
1686 | #ifdef __GNUC__
|
---|
1687 | # define DECL_FORCE_INLINE(a_RetType) __attribute__((__always_inline__)) DECLINLINE(a_RetType)
|
---|
1688 | #elif defined(_MSC_VER)
|
---|
1689 | # define DECL_FORCE_INLINE(a_RetType) DECL_NOTHROW(__forceinline a_RetType)
|
---|
1690 | #else
|
---|
1691 | # define DECL_FORCE_INLINE(a_RetType) DECLINLINE(a_RetType)
|
---|
1692 | #endif
|
---|
1693 |
|
---|
1694 | /** @def DECL_FORCE_INLINE_THROW
|
---|
1695 | * How to declare a function throwing C++ exceptions as inline and try convince
|
---|
1696 | * the compiler to always inline it regardless of optimization switches.
|
---|
1697 | * @param a_RetType The return type of the function declaration.
|
---|
1698 | * @remarks Use sparsely and with care. Don't use this macro on C++ methods.
|
---|
1699 | */
|
---|
1700 | #ifdef __GNUC__
|
---|
1701 | # define DECL_FORCE_INLINE_THROW(a_RetType) __attribute__((__always_inline__)) DECL_INLINE_THROW(a_RetType)
|
---|
1702 | #elif defined(_MSC_VER)
|
---|
1703 | # define DECL_FORCE_INLINE_THROW(a_RetType) __forceinline a_RetType
|
---|
1704 | #else
|
---|
1705 | # define DECL_FORCE_INLINE_THROW(a_RetType) DECL_INLINE_THROW(a_RetType)
|
---|
1706 | #endif
|
---|
1707 |
|
---|
1708 |
|
---|
1709 | /** @def DECL_NO_INLINE
|
---|
1710 | * How to declare a function telling the compiler not to inline it.
|
---|
1711 | * @param scope The function scope, static or RT_NOTHING.
|
---|
1712 | * @param a_RetType The return type of the function declaration.
|
---|
1713 | * @remarks Don't use this macro on C++ methods.
|
---|
1714 | */
|
---|
1715 | #ifdef __GNUC__
|
---|
1716 | # define DECL_NO_INLINE(scope, a_RetType) __attribute__((__noinline__)) scope a_RetType
|
---|
1717 | #elif defined(_MSC_VER)
|
---|
1718 | # define DECL_NO_INLINE(scope, a_RetType) __declspec(noinline) scope a_RetType
|
---|
1719 | #else
|
---|
1720 | # define DECL_NO_INLINE(scope,a_RetType) scope a_RetType
|
---|
1721 | #endif
|
---|
1722 |
|
---|
1723 |
|
---|
1724 | /** @def IN_RT_STATIC
|
---|
1725 | * Used to indicate whether we're linking against a static IPRT
|
---|
1726 | * or not.
|
---|
1727 | *
|
---|
1728 | * The IPRT symbols will be declared as hidden (if supported). Note that this
|
---|
1729 | * define has no effect without also setting one of the IN_RT_R0, IN_RT_R3 or
|
---|
1730 | * IN_RT_RC indicators.
|
---|
1731 | */
|
---|
1732 |
|
---|
1733 | /** @def IN_RT_R0
|
---|
1734 | * Used to indicate whether we're inside the same link module as the host
|
---|
1735 | * context ring-0 Runtime Library.
|
---|
1736 | */
|
---|
1737 | /** @def RTR0DECL(a_RetType)
|
---|
1738 | * Runtime Library host context ring-0 export or import declaration.
|
---|
1739 | * @param a_RetType The return a_RetType of the function declaration.
|
---|
1740 | * @remarks This is only used inside IPRT. Other APIs need to define their own
|
---|
1741 | * XXXX_DECL macros for dealing with import/export/static visibility.
|
---|
1742 | * @note DECL_NOTHROW is implied.
|
---|
1743 | */
|
---|
1744 | #ifdef IN_RT_R0
|
---|
1745 | # ifdef IN_RT_STATIC
|
---|
1746 | # define RTR0DECL(a_RetType) DECL_HIDDEN_NOTHROW(a_RetType) RTCALL
|
---|
1747 | # else
|
---|
1748 | # define RTR0DECL(a_RetType) DECL_EXPORT_NOTHROW(a_RetType) RTCALL
|
---|
1749 | # endif
|
---|
1750 | #else
|
---|
1751 | # define RTR0DECL(a_RetType) DECL_IMPORT_NOTHROW(a_RetType) RTCALL
|
---|
1752 | #endif
|
---|
1753 |
|
---|
1754 | /** @def IN_RT_R3
|
---|
1755 | * Used to indicate whether we're inside the same link module as the host
|
---|
1756 | * context ring-3 Runtime Library.
|
---|
1757 | */
|
---|
1758 | /** @def RTR3DECL(a_RetType)
|
---|
1759 | * Runtime Library host context ring-3 export or import declaration.
|
---|
1760 | * @param a_RetType The return type of the function declaration.
|
---|
1761 | * @remarks This is only used inside IPRT. Other APIs need to define their own
|
---|
1762 | * XXXX_DECL macros for dealing with import/export/static visibility.
|
---|
1763 | * @note DECL_NOTHROW is implied.
|
---|
1764 | */
|
---|
1765 | #ifdef IN_RT_R3
|
---|
1766 | # ifdef IN_RT_STATIC
|
---|
1767 | # define RTR3DECL(a_RetType) DECL_HIDDEN_NOTHROW(a_RetType) RTCALL
|
---|
1768 | # else
|
---|
1769 | # define RTR3DECL(a_RetType) DECL_EXPORT_NOTHROW(a_RetType) RTCALL
|
---|
1770 | # endif
|
---|
1771 | #else
|
---|
1772 | # define RTR3DECL(a_RetType) DECL_IMPORT_NOTHROW(a_RetType) RTCALL
|
---|
1773 | #endif
|
---|
1774 |
|
---|
1775 | /** @def IN_RT_RC
|
---|
1776 | * Used to indicate whether we're inside the same link module as the raw-mode
|
---|
1777 | * context (RC) runtime library.
|
---|
1778 | */
|
---|
1779 | /** @def RTRCDECL(a_RetType)
|
---|
1780 | * Runtime Library raw-mode context export or import declaration.
|
---|
1781 | * @param a_RetType The return type of the function declaration.
|
---|
1782 | * @remarks This is only used inside IPRT. Other APIs need to define their own
|
---|
1783 | * XXXX_DECL macros for dealing with import/export/static visibility.
|
---|
1784 | * @note DECL_NOTHROW is implied.
|
---|
1785 | */
|
---|
1786 | #ifdef IN_RT_RC
|
---|
1787 | # ifdef IN_RT_STATIC
|
---|
1788 | # define RTRCDECL(a_RetType) DECL_HIDDEN_NOTHROW(a_RetType) RTCALL
|
---|
1789 | # else
|
---|
1790 | # define RTRCDECL(a_RetType) DECL_EXPORT_NOTHROW(a_RetType) RTCALL
|
---|
1791 | # endif
|
---|
1792 | #else
|
---|
1793 | # define RTRCDECL(a_RetType) DECL_IMPORT_NOTHROW(a_RetType) RTCALL
|
---|
1794 | #endif
|
---|
1795 |
|
---|
1796 | /** @def RTDECL(a_RetType)
|
---|
1797 | * Runtime Library export or import declaration.
|
---|
1798 | * Functions declared using this macro exists in all contexts.
|
---|
1799 | * @param a_RetType The return type of the function declaration.
|
---|
1800 | * @remarks This is only used inside IPRT. Other APIs need to define their own
|
---|
1801 | * XXXX_DECL macros for dealing with import/export/static visibility.
|
---|
1802 | * @note DECL_NOTHROW is implied.
|
---|
1803 | */
|
---|
1804 | #if defined(IN_RT_R3) || defined(IN_RT_RC) || defined(IN_RT_R0)
|
---|
1805 | # ifdef IN_RT_STATIC
|
---|
1806 | # define RTDECL(a_RetType) DECL_HIDDEN_NOTHROW(a_RetType) RTCALL
|
---|
1807 | # else
|
---|
1808 | # define RTDECL(a_RetType) DECL_EXPORT_NOTHROW(a_RetType) RTCALL
|
---|
1809 | # endif
|
---|
1810 | #else
|
---|
1811 | # define RTDECL(a_RetType) DECL_IMPORT_NOTHROW(a_RetType) RTCALL
|
---|
1812 | #endif
|
---|
1813 |
|
---|
1814 | /** @def RTDATADECL(a_Type)
|
---|
1815 | * Runtime Library export or import declaration.
|
---|
1816 | * Data declared using this macro exists in all contexts.
|
---|
1817 | * @param a_Type The data type.
|
---|
1818 | * @remarks This is only used inside IPRT. Other APIs need to define their own
|
---|
1819 | * XXXX_DECL macros for dealing with import/export/static visibility.
|
---|
1820 | */
|
---|
1821 | /** @def RT_DECL_DATA_CONST(a_Type)
|
---|
1822 | * Definition of a const variable. See DECL_HIDDEN_CONST.
|
---|
1823 | * @param a_Type The const data type.
|
---|
1824 | * @remarks This is only used inside IPRT. Other APIs need to define their own
|
---|
1825 | * XXXX_DECL macros for dealing with import/export/static visibility.
|
---|
1826 | */
|
---|
1827 | #if defined(IN_RT_R3) || defined(IN_RT_RC) || defined(IN_RT_R0)
|
---|
1828 | # ifdef IN_RT_STATIC
|
---|
1829 | # define RTDATADECL(a_Type) DECL_HIDDEN_DATA(a_Type)
|
---|
1830 | # define RT_DECL_DATA_CONST(a_Type) DECL_HIDDEN_CONST(a_Type)
|
---|
1831 | # else
|
---|
1832 | # define RTDATADECL(a_Type) DECLEXPORT(a_Type)
|
---|
1833 | # if defined(__cplusplus) && defined(__GNUC__)
|
---|
1834 | # define RT_DECL_DATA_CONST(a_Type) a_Type
|
---|
1835 | # else
|
---|
1836 | # define RT_DECL_DATA_CONST(a_Type) DECLEXPORT(a_Type)
|
---|
1837 | # endif
|
---|
1838 | # endif
|
---|
1839 | #else
|
---|
1840 | # define RTDATADECL(a_Type) DECLIMPORT(a_Type)
|
---|
1841 | # define RT_DECL_DATA_CONST(a_Type) DECLIMPORT(a_Type)
|
---|
1842 | #endif
|
---|
1843 |
|
---|
1844 | /** @def RT_DECL_CLASS
|
---|
1845 | * Declares an class living in the runtime.
|
---|
1846 | * @remarks This is only used inside IPRT. Other APIs need to define their own
|
---|
1847 | * XXXX_DECL macros for dealing with import/export/static visibility.
|
---|
1848 | */
|
---|
1849 | #if defined(IN_RT_R3) || defined(IN_RT_RC) || defined(IN_RT_R0)
|
---|
1850 | # ifdef IN_RT_STATIC
|
---|
1851 | # define RT_DECL_CLASS
|
---|
1852 | # else
|
---|
1853 | # define RT_DECL_CLASS DECLEXPORT_CLASS
|
---|
1854 | # endif
|
---|
1855 | #else
|
---|
1856 | # define RT_DECL_CLASS DECLIMPORT_CLASS
|
---|
1857 | #endif
|
---|
1858 |
|
---|
1859 |
|
---|
1860 | /** @def RT_NOCRT
|
---|
1861 | * Symbol name wrapper for the No-CRT bits.
|
---|
1862 | *
|
---|
1863 | * In order to coexist in the same process as other CRTs, we need to
|
---|
1864 | * decorate the symbols such that they don't conflict the ones in the
|
---|
1865 | * other CRTs. The result of such conflicts / duplicate symbols can
|
---|
1866 | * confuse the dynamic loader on Unix like systems.
|
---|
1867 | *
|
---|
1868 | * Define RT_WITHOUT_NOCRT_WRAPPERS to drop the wrapping.
|
---|
1869 | * Define RT_WITHOUT_NOCRT_WRAPPER_ALIASES to drop the aliases to the
|
---|
1870 | * wrapped names.
|
---|
1871 | */
|
---|
1872 | /** @def RT_NOCRT_STR
|
---|
1873 | * Same as RT_NOCRT only it'll return a double quoted string of the result.
|
---|
1874 | */
|
---|
1875 | #ifndef RT_WITHOUT_NOCRT_WRAPPERS
|
---|
1876 | # define RT_NOCRT(name) nocrt_ ## name
|
---|
1877 | # define RT_NOCRT_STR(name) "nocrt_" # name
|
---|
1878 | #else
|
---|
1879 | # define RT_NOCRT(name) name
|
---|
1880 | # define RT_NOCRT_STR(name) #name
|
---|
1881 | #endif
|
---|
1882 |
|
---|
1883 |
|
---|
1884 | /** @name Untrusted data classifications.
|
---|
1885 | * @{ */
|
---|
1886 | /** @def RT_UNTRUSTED_USER
|
---|
1887 | * For marking non-volatile (race free) data from user mode as untrusted.
|
---|
1888 | * This is just for visible documentation. */
|
---|
1889 | #define RT_UNTRUSTED_USER
|
---|
1890 | /** @def RT_UNTRUSTED_VOLATILE_USER
|
---|
1891 | * For marking volatile data shared with user mode as untrusted.
|
---|
1892 | * This is more than just documentation as it specifies the 'volatile' keyword,
|
---|
1893 | * because the guest could modify the data at any time. */
|
---|
1894 | #define RT_UNTRUSTED_VOLATILE_USER volatile
|
---|
1895 |
|
---|
1896 | /** @def RT_UNTRUSTED_GUEST
|
---|
1897 | * For marking non-volatile (race free) data from the guest as untrusted.
|
---|
1898 | * This is just for visible documentation. */
|
---|
1899 | #define RT_UNTRUSTED_GUEST
|
---|
1900 | /** @def RT_UNTRUSTED_VOLATILE_GUEST
|
---|
1901 | * For marking volatile data shared with the guest as untrusted.
|
---|
1902 | * This is more than just documentation as it specifies the 'volatile' keyword,
|
---|
1903 | * because the guest could modify the data at any time. */
|
---|
1904 | #define RT_UNTRUSTED_VOLATILE_GUEST volatile
|
---|
1905 |
|
---|
1906 | /** @def RT_UNTRUSTED_HOST
|
---|
1907 | * For marking non-volatile (race free) data from the host as untrusted.
|
---|
1908 | * This is just for visible documentation. */
|
---|
1909 | #define RT_UNTRUSTED_HOST
|
---|
1910 | /** @def RT_UNTRUSTED_VOLATILE_HOST
|
---|
1911 | * For marking volatile data shared with the host as untrusted.
|
---|
1912 | * This is more than just documentation as it specifies the 'volatile' keyword,
|
---|
1913 | * because the host could modify the data at any time. */
|
---|
1914 | #define RT_UNTRUSTED_VOLATILE_HOST volatile
|
---|
1915 |
|
---|
1916 | /** @def RT_UNTRUSTED_HSTGST
|
---|
1917 | * For marking non-volatile (race free) data from the host/gust as untrusted.
|
---|
1918 | * This is just for visible documentation. */
|
---|
1919 | #define RT_UNTRUSTED_HSTGST
|
---|
1920 | /** @def RT_UNTRUSTED_VOLATILE_HSTGST
|
---|
1921 | * For marking volatile data shared with the host/guest as untrusted.
|
---|
1922 | * This is more than just documentation as it specifies the 'volatile' keyword,
|
---|
1923 | * because the host could modify the data at any time. */
|
---|
1924 | #define RT_UNTRUSTED_VOLATILE_HSTGST volatile
|
---|
1925 | /** @} */
|
---|
1926 |
|
---|
1927 | /** @name Fences for use when handling untrusted data.
|
---|
1928 | * @{ */
|
---|
1929 | /** For use after copying untruated volatile data to a non-volatile location.
|
---|
1930 | * This translates to a compiler memory barrier and will help ensure that the
|
---|
1931 | * compiler uses the non-volatile copy of the data. */
|
---|
1932 | #define RT_UNTRUSTED_NONVOLATILE_COPY_FENCE() ASMCompilerBarrier()
|
---|
1933 | /** For use after finished validating guest input.
|
---|
1934 | * What this translates to is architecture dependent. On intel it will
|
---|
1935 | * translate to a CPU load+store fence as well as a compiler memory barrier. */
|
---|
1936 | #if defined(RT_ARCH_AMD64) || (defined(RT_ARCH_X86) && !defined(RT_WITH_OLD_CPU_SUPPORT))
|
---|
1937 | # define RT_UNTRUSTED_VALIDATED_FENCE() do { ASMCompilerBarrier(); ASMReadFence(); } while (0)
|
---|
1938 | #elif defined(RT_ARCH_X86)
|
---|
1939 | # define RT_UNTRUSTED_VALIDATED_FENCE() do { ASMCompilerBarrier(); ASMMemoryFence(); } while (0)
|
---|
1940 | #else
|
---|
1941 | # define RT_UNTRUSTED_VALIDATED_FENCE() do { ASMCompilerBarrier(); } while (0)
|
---|
1942 | #endif
|
---|
1943 | /** @} */
|
---|
1944 |
|
---|
1945 |
|
---|
1946 | /** @def RT_LIKELY
|
---|
1947 | * Give the compiler a hint that an expression is very likely to hold true.
|
---|
1948 | *
|
---|
1949 | * Some compilers support explicit branch prediction so that the CPU backend
|
---|
1950 | * can hint the processor and also so that code blocks can be reordered such
|
---|
1951 | * that the predicted path sees a more linear flow, thus improving cache
|
---|
1952 | * behaviour, etc.
|
---|
1953 | *
|
---|
1954 | * IPRT provides the macros RT_LIKELY() and RT_UNLIKELY() as a way to utilize
|
---|
1955 | * this compiler feature when present.
|
---|
1956 | *
|
---|
1957 | * A few notes about the usage:
|
---|
1958 | *
|
---|
1959 | * - Generally, order your code use RT_LIKELY() instead of RT_UNLIKELY().
|
---|
1960 | *
|
---|
1961 | * - Generally, use RT_UNLIKELY() with error condition checks (unless you
|
---|
1962 | * have some _strong_ reason to do otherwise, in which case document it),
|
---|
1963 | * and/or RT_LIKELY() with success condition checks, assuming you want
|
---|
1964 | * to optimize for the success path.
|
---|
1965 | *
|
---|
1966 | * - Other than that, if you don't know the likelihood of a test succeeding
|
---|
1967 | * from empirical or other 'hard' evidence, don't make predictions unless
|
---|
1968 | * you happen to be a Dirk Gently character.
|
---|
1969 | *
|
---|
1970 | * - These macros are meant to be used in places that get executed a lot. It
|
---|
1971 | * is wasteful to make predictions in code that is executed rarely (e.g.
|
---|
1972 | * at subsystem initialization time) as the basic block reordering that this
|
---|
1973 | * affects can often generate larger code.
|
---|
1974 | *
|
---|
1975 | * - Note that RT_SUCCESS() and RT_FAILURE() already makes use of RT_LIKELY()
|
---|
1976 | * and RT_UNLIKELY(). Should you wish for prediction free status checks,
|
---|
1977 | * use the RT_SUCCESS_NP() and RT_FAILURE_NP() macros instead.
|
---|
1978 | *
|
---|
1979 | *
|
---|
1980 | * @returns the boolean result of the expression.
|
---|
1981 | * @param expr The expression that's very likely to be true.
|
---|
1982 | * @see RT_UNLIKELY
|
---|
1983 | */
|
---|
1984 | /** @def RT_UNLIKELY
|
---|
1985 | * Give the compiler a hint that an expression is highly unlikely to hold true.
|
---|
1986 | *
|
---|
1987 | * See the usage instructions give in the RT_LIKELY() docs.
|
---|
1988 | *
|
---|
1989 | * @returns the boolean result of the expression.
|
---|
1990 | * @param expr The expression that's very unlikely to be true.
|
---|
1991 | * @see RT_LIKELY
|
---|
1992 | *
|
---|
1993 | * @deprecated Please use RT_LIKELY() instead wherever possible! That gives us
|
---|
1994 | * a better chance of the windows compilers to generate favorable code
|
---|
1995 | * too. The belief is that the compiler will by default assume the
|
---|
1996 | * if-case is more likely than the else-case.
|
---|
1997 | */
|
---|
1998 | #if defined(__GNUC__)
|
---|
1999 | # if __GNUC__ >= 3 && !defined(FORTIFY_RUNNING)
|
---|
2000 | # define RT_LIKELY(expr) __builtin_expect(!!(expr), 1)
|
---|
2001 | # define RT_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
|
---|
2002 | # else
|
---|
2003 | # define RT_LIKELY(expr) (expr)
|
---|
2004 | # define RT_UNLIKELY(expr) (expr)
|
---|
2005 | # endif
|
---|
2006 | #else
|
---|
2007 | # define RT_LIKELY(expr) (expr)
|
---|
2008 | # define RT_UNLIKELY(expr) (expr)
|
---|
2009 | #endif
|
---|
2010 |
|
---|
2011 | /** @def RT_EXPAND_2
|
---|
2012 | * Helper for RT_EXPAND. */
|
---|
2013 | #define RT_EXPAND_2(a_Expr) a_Expr
|
---|
2014 | /** @def RT_EXPAND
|
---|
2015 | * Returns the expanded expression.
|
---|
2016 | * @param a_Expr The expression to expand. */
|
---|
2017 | #define RT_EXPAND(a_Expr) RT_EXPAND_2(a_Expr)
|
---|
2018 |
|
---|
2019 | /** @def RT_STR
|
---|
2020 | * Returns the argument as a string constant.
|
---|
2021 | * @param str Argument to stringify. */
|
---|
2022 | #define RT_STR(str) #str
|
---|
2023 | /** @def RT_XSTR
|
---|
2024 | * Returns the expanded argument as a string.
|
---|
2025 | * @param str Argument to expand and stringify. */
|
---|
2026 | #define RT_XSTR(str) RT_STR(str)
|
---|
2027 |
|
---|
2028 | /** @def RT_LSTR_2
|
---|
2029 | * Helper for RT_WSTR that gets the expanded @a str.
|
---|
2030 | * @param str String litteral to prefix with 'L'. */
|
---|
2031 | #define RT_LSTR_2(str) L##str
|
---|
2032 | /** @def RT_LSTR
|
---|
2033 | * Returns the expanded argument with a L string prefix.
|
---|
2034 | *
|
---|
2035 | * Intended for converting ASCII string \#defines into wide char string
|
---|
2036 | * litterals on Windows.
|
---|
2037 | *
|
---|
2038 | * @param str String litteral to . */
|
---|
2039 | #define RT_LSTR(str) RT_LSTR_2(str)
|
---|
2040 |
|
---|
2041 | /** @def RT_UNPACK_CALL
|
---|
2042 | * Unpacks the an argument list inside an extra set of parenthesis and turns it
|
---|
2043 | * into a call to @a a_Fn.
|
---|
2044 | *
|
---|
2045 | * @param a_Fn Function/macro to call.
|
---|
2046 | * @param a_Args Parameter list in parenthesis.
|
---|
2047 | */
|
---|
2048 | #define RT_UNPACK_CALL(a_Fn, a_Args) a_Fn a_Args
|
---|
2049 |
|
---|
2050 | #if defined(RT_COMPILER_SUPPORTS_VA_ARGS) || defined(DOXYGEN_RUNNING)
|
---|
2051 |
|
---|
2052 | /** @def RT_UNPACK_ARGS
|
---|
2053 | * Returns the arguments without parenthesis.
|
---|
2054 | *
|
---|
2055 | * @param ... Parameter list in parenthesis.
|
---|
2056 | * @remarks Requires RT_COMPILER_SUPPORTS_VA_ARGS.
|
---|
2057 | */
|
---|
2058 | # define RT_UNPACK_ARGS(...) __VA_ARGS__
|
---|
2059 |
|
---|
2060 | /** @def RT_COUNT_VA_ARGS_HLP
|
---|
2061 | * Helper for RT_COUNT_VA_ARGS that picks out the argument count from
|
---|
2062 | * RT_COUNT_VA_ARGS_REV_SEQ. */
|
---|
2063 | # define RT_COUNT_VA_ARGS_HLP( \
|
---|
2064 | c69, c68, c67, c66, c65, c64, c63, c62, c61, c60, \
|
---|
2065 | c59, c58, c57, c56, c55, c54, c53, c52, c51, c50, \
|
---|
2066 | c49, c48, c47, c46, c45, c44, c43, c42, c41, c40, \
|
---|
2067 | c39, c38, c37, c36, c35, c34, c33, c32, c31, c30, \
|
---|
2068 | c29, c28, c27, c26, c25, c24, c23, c22, c21, c20, \
|
---|
2069 | c19, c18, c17, c16, c15, c14, c13, c12, c11, c10, \
|
---|
2070 | c9, c8, c7, c6, c5, c4, c3, c2, c1, cArgs, ...) cArgs
|
---|
2071 | /** Argument count sequence. */
|
---|
2072 | # define RT_COUNT_VA_ARGS_REV_SEQ \
|
---|
2073 | 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, \
|
---|
2074 | 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
|
---|
2075 | 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \
|
---|
2076 | 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \
|
---|
2077 | 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \
|
---|
2078 | 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
|
---|
2079 | 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
|
---|
2080 | /** This is for zero arguments. At least Visual C++ requires it. */
|
---|
2081 | # define RT_COUNT_VA_ARGS_PREFIX_RT_NOTHING RT_COUNT_VA_ARGS_REV_SEQ
|
---|
2082 | /**
|
---|
2083 | * Counts the number of arguments given to the variadic macro.
|
---|
2084 | *
|
---|
2085 | * Max is 69.
|
---|
2086 | *
|
---|
2087 | * @returns Number of arguments in the ellipsis
|
---|
2088 | * @param ... Arguments to count.
|
---|
2089 | * @remarks Requires RT_COMPILER_SUPPORTS_VA_ARGS.
|
---|
2090 | */
|
---|
2091 | # define RT_COUNT_VA_ARGS(...) \
|
---|
2092 | RT_UNPACK_CALL(RT_COUNT_VA_ARGS_HLP, (RT_COUNT_VA_ARGS_PREFIX_ ## __VA_ARGS__ ## RT_NOTHING, \
|
---|
2093 | RT_COUNT_VA_ARGS_REV_SEQ))
|
---|
2094 |
|
---|
2095 | #endif /* RT_COMPILER_SUPPORTS_VA_ARGS */
|
---|
2096 |
|
---|
2097 |
|
---|
2098 | /** @def RT_CONCAT
|
---|
2099 | * Concatenate the expanded arguments without any extra spaces in between.
|
---|
2100 | *
|
---|
2101 | * @param a The first part.
|
---|
2102 | * @param b The second part.
|
---|
2103 | */
|
---|
2104 | #define RT_CONCAT(a,b) RT_CONCAT_HLP(a,b)
|
---|
2105 | /** RT_CONCAT helper, don't use. */
|
---|
2106 | #define RT_CONCAT_HLP(a,b) a##b
|
---|
2107 |
|
---|
2108 | /** @def RT_CONCAT3
|
---|
2109 | * Concatenate the expanded arguments without any extra spaces in between.
|
---|
2110 | *
|
---|
2111 | * @param a The 1st part.
|
---|
2112 | * @param b The 2nd part.
|
---|
2113 | * @param c The 3rd part.
|
---|
2114 | */
|
---|
2115 | #define RT_CONCAT3(a,b,c) RT_CONCAT3_HLP(a,b,c)
|
---|
2116 | /** RT_CONCAT3 helper, don't use. */
|
---|
2117 | #define RT_CONCAT3_HLP(a,b,c) a##b##c
|
---|
2118 |
|
---|
2119 | /** @def RT_CONCAT4
|
---|
2120 | * Concatenate the expanded arguments without any extra spaces in between.
|
---|
2121 | *
|
---|
2122 | * @param a The 1st part.
|
---|
2123 | * @param b The 2nd part.
|
---|
2124 | * @param c The 3rd part.
|
---|
2125 | * @param d The 4th part.
|
---|
2126 | */
|
---|
2127 | #define RT_CONCAT4(a,b,c,d) RT_CONCAT4_HLP(a,b,c,d)
|
---|
2128 | /** RT_CONCAT4 helper, don't use. */
|
---|
2129 | #define RT_CONCAT4_HLP(a,b,c,d) a##b##c##d
|
---|
2130 |
|
---|
2131 | /** @def RT_CONCAT5
|
---|
2132 | * Concatenate the expanded arguments without any extra spaces in between.
|
---|
2133 | *
|
---|
2134 | * @param a The 1st part.
|
---|
2135 | * @param b The 2nd part.
|
---|
2136 | * @param c The 3rd part.
|
---|
2137 | * @param d The 4th part.
|
---|
2138 | * @param e The 5th part.
|
---|
2139 | */
|
---|
2140 | #define RT_CONCAT5(a,b,c,d,e) RT_CONCAT5_HLP(a,b,c,d,e)
|
---|
2141 | /** RT_CONCAT5 helper, don't use. */
|
---|
2142 | #define RT_CONCAT5_HLP(a,b,c,d,e) a##b##c##d##e
|
---|
2143 |
|
---|
2144 | /** @def RT_CONCAT6
|
---|
2145 | * Concatenate the expanded arguments without any extra spaces in between.
|
---|
2146 | *
|
---|
2147 | * @param a The 1st part.
|
---|
2148 | * @param b The 2nd part.
|
---|
2149 | * @param c The 3rd part.
|
---|
2150 | * @param d The 4th part.
|
---|
2151 | * @param e The 5th part.
|
---|
2152 | * @param f The 6th part.
|
---|
2153 | */
|
---|
2154 | #define RT_CONCAT6(a,b,c,d,e,f) RT_CONCAT6_HLP(a,b,c,d,e,f)
|
---|
2155 | /** RT_CONCAT6 helper, don't use. */
|
---|
2156 | #define RT_CONCAT6_HLP(a,b,c,d,e,f) a##b##c##d##e##f
|
---|
2157 |
|
---|
2158 | /** @def RT_CONCAT7
|
---|
2159 | * Concatenate the expanded arguments without any extra spaces in between.
|
---|
2160 | *
|
---|
2161 | * @param a The 1st part.
|
---|
2162 | * @param b The 2nd part.
|
---|
2163 | * @param c The 3rd part.
|
---|
2164 | * @param d The 4th part.
|
---|
2165 | * @param e The 5th part.
|
---|
2166 | * @param f The 6th part.
|
---|
2167 | * @param g The 7th part.
|
---|
2168 | */
|
---|
2169 | #define RT_CONCAT7(a,b,c,d,e,f,g) RT_CONCAT7_HLP(a,b,c,d,e,f,g)
|
---|
2170 | /** RT_CONCAT7 helper, don't use. */
|
---|
2171 | #define RT_CONCAT7_HLP(a,b,c,d,e,f,g) a##b##c##d##e##f##g
|
---|
2172 |
|
---|
2173 | /** @def RT_CONCAT8
|
---|
2174 | * Concatenate the expanded arguments without any extra spaces in between.
|
---|
2175 | *
|
---|
2176 | * @param a The 1st part.
|
---|
2177 | * @param b The 2nd part.
|
---|
2178 | * @param c The 3rd part.
|
---|
2179 | * @param d The 4th part.
|
---|
2180 | * @param e The 5th part.
|
---|
2181 | * @param f The 6th part.
|
---|
2182 | * @param g The 7th part.
|
---|
2183 | * @param h The 8th part.
|
---|
2184 | */
|
---|
2185 | #define RT_CONCAT8(a,b,c,d,e,f,g,h) RT_CONCAT8_HLP(a,b,c,d,e,f,g,h)
|
---|
2186 | /** RT_CONCAT8 helper, don't use. */
|
---|
2187 | #define RT_CONCAT8_HLP(a,b,c,d,e,f,g,h) a##b##c##d##e##f##g##h
|
---|
2188 |
|
---|
2189 | /** @def RT_CONCAT9
|
---|
2190 | * Concatenate the expanded arguments without any extra spaces in between.
|
---|
2191 | *
|
---|
2192 | * @param a The 1st part.
|
---|
2193 | * @param b The 2nd part.
|
---|
2194 | * @param c The 3rd part.
|
---|
2195 | * @param d The 4th part.
|
---|
2196 | * @param e The 5th part.
|
---|
2197 | * @param f The 6th part.
|
---|
2198 | * @param g The 7th part.
|
---|
2199 | * @param h The 8th part.
|
---|
2200 | * @param i The 9th part.
|
---|
2201 | */
|
---|
2202 | #define RT_CONCAT9(a,b,c,d,e,f,g,h,i) RT_CONCAT9_HLP(a,b,c,d,e,f,g,h,i)
|
---|
2203 | /** RT_CONCAT9 helper, don't use. */
|
---|
2204 | #define RT_CONCAT9_HLP(a,b,c,d,e,f,g,h,i) a##b##c##d##e##f##g##h##i
|
---|
2205 |
|
---|
2206 | /**
|
---|
2207 | * String constant tuple - string constant, strlen(string constant).
|
---|
2208 | *
|
---|
2209 | * @param a_szConst String constant.
|
---|
2210 | * @sa RTSTRTUPLE
|
---|
2211 | */
|
---|
2212 | #define RT_STR_TUPLE(a_szConst) a_szConst, (sizeof(a_szConst) - 1)
|
---|
2213 |
|
---|
2214 |
|
---|
2215 | /**
|
---|
2216 | * Macro for using in switch statements that turns constants into strings.
|
---|
2217 | *
|
---|
2218 | * @param a_Const The constant (not string).
|
---|
2219 | */
|
---|
2220 | #define RT_CASE_RET_STR(a_Const) case a_Const: return #a_Const
|
---|
2221 |
|
---|
2222 |
|
---|
2223 | /** @def RT_BIT
|
---|
2224 | * Convert a bit number into an integer bitmask (unsigned).
|
---|
2225 | * @param bit The bit number.
|
---|
2226 | */
|
---|
2227 | #define RT_BIT(bit) ( 1U << (bit) )
|
---|
2228 |
|
---|
2229 | /** @def RT_BIT_32
|
---|
2230 | * Convert a bit number into a 32-bit bitmask (unsigned).
|
---|
2231 | * @param bit The bit number.
|
---|
2232 | */
|
---|
2233 | #define RT_BIT_32(bit) ( UINT32_C(1) << (bit) )
|
---|
2234 |
|
---|
2235 | /** @def RT_BIT_64
|
---|
2236 | * Convert a bit number into a 64-bit bitmask (unsigned).
|
---|
2237 | * @param bit The bit number.
|
---|
2238 | */
|
---|
2239 | #define RT_BIT_64(bit) ( UINT64_C(1) << (bit) )
|
---|
2240 |
|
---|
2241 | /** @def RT_BIT_Z
|
---|
2242 | * Convert a bit number into a size_t bitmask (for avoid MSC warnings).
|
---|
2243 | * @param a_iBit The bit number.
|
---|
2244 | */
|
---|
2245 | #define RT_BIT_Z(a_iBit) ( (size_t)(1) << (a_iBit) )
|
---|
2246 |
|
---|
2247 |
|
---|
2248 | /** @def RT_BF_GET
|
---|
2249 | * Gets the value of a bit field in an integer value.
|
---|
2250 | *
|
---|
2251 | * This requires a couple of macros to be defined for the field:
|
---|
2252 | * - \<a_FieldNm\>_SHIFT: The shift count to get to the field.
|
---|
2253 | * - \<a_FieldNm\>_MASK: The field mask.
|
---|
2254 | *
|
---|
2255 | * @returns The bit field value.
|
---|
2256 | * @param a_uValue The integer value containing the field.
|
---|
2257 | * @param a_FieldNm The field name prefix for getting at the _SHIFT and
|
---|
2258 | * _MASK macros.
|
---|
2259 | * @sa #RT_BF_CLEAR, #RT_BF_SET, #RT_BF_MAKE, #RT_BF_ZMASK
|
---|
2260 | */
|
---|
2261 | #define RT_BF_GET(a_uValue, a_FieldNm) ( ((a_uValue) >> RT_CONCAT(a_FieldNm,_SHIFT)) & RT_BF_ZMASK(a_FieldNm) )
|
---|
2262 |
|
---|
2263 | /** @def RT_BF_SET
|
---|
2264 | * Sets the given bit field in the integer value.
|
---|
2265 | *
|
---|
2266 | * This requires a couple of macros to be defined for the field:
|
---|
2267 | * - \<a_FieldNm\>_SHIFT: The shift count to get to the field.
|
---|
2268 | * - \<a_FieldNm\>_MASK: The field mask. Must have the same type as the
|
---|
2269 | * integer value!!
|
---|
2270 | *
|
---|
2271 | * @returns Integer value with bit field set to @a a_uFieldValue.
|
---|
2272 | * @param a_uValue The integer value containing the field.
|
---|
2273 | * @param a_FieldNm The field name prefix for getting at the _SHIFT and
|
---|
2274 | * _MASK macros.
|
---|
2275 | * @param a_uFieldValue The new field value.
|
---|
2276 | * @sa #RT_BF_GET, #RT_BF_CLEAR, #RT_BF_MAKE, #RT_BF_ZMASK
|
---|
2277 | */
|
---|
2278 | #define RT_BF_SET(a_uValue, a_FieldNm, a_uFieldValue) ( RT_BF_CLEAR(a_uValue, a_FieldNm) | RT_BF_MAKE(a_FieldNm, a_uFieldValue) )
|
---|
2279 |
|
---|
2280 | /** @def RT_BF_CLEAR
|
---|
2281 | * Clears the given bit field in the integer value.
|
---|
2282 | *
|
---|
2283 | * This requires a couple of macros to be defined for the field:
|
---|
2284 | * - \<a_FieldNm\>_SHIFT: The shift count to get to the field.
|
---|
2285 | * - \<a_FieldNm\>_MASK: The field mask. Must have the same type as the
|
---|
2286 | * integer value!!
|
---|
2287 | *
|
---|
2288 | * @returns Integer value with bit field set to zero.
|
---|
2289 | * @param a_uValue The integer value containing the field.
|
---|
2290 | * @param a_FieldNm The field name prefix for getting at the _SHIFT and
|
---|
2291 | * _MASK macros.
|
---|
2292 | * @sa #RT_BF_GET, #RT_BF_SET, #RT_BF_MAKE, #RT_BF_ZMASK
|
---|
2293 | */
|
---|
2294 | #define RT_BF_CLEAR(a_uValue, a_FieldNm) ( (a_uValue) & ~RT_CONCAT(a_FieldNm,_MASK) )
|
---|
2295 |
|
---|
2296 | /** @def RT_BF_MAKE
|
---|
2297 | * Shifts and masks a bit field value into position in the integer value.
|
---|
2298 | *
|
---|
2299 | * This requires a couple of macros to be defined for the field:
|
---|
2300 | * - \<a_FieldNm\>_SHIFT: The shift count to get to the field.
|
---|
2301 | * - \<a_FieldNm\>_MASK: The field mask.
|
---|
2302 | *
|
---|
2303 | * @param a_FieldNm The field name prefix for getting at the _SHIFT and
|
---|
2304 | * _MASK macros.
|
---|
2305 | * @param a_uFieldValue The field value that should be masked and shifted
|
---|
2306 | * into position.
|
---|
2307 | * @sa #RT_BF_GET, #RT_BF_SET, #RT_BF_CLEAR, #RT_BF_ZMASK
|
---|
2308 | */
|
---|
2309 | #define RT_BF_MAKE(a_FieldNm, a_uFieldValue) ( ((a_uFieldValue) & RT_BF_ZMASK(a_FieldNm) ) << RT_CONCAT(a_FieldNm,_SHIFT) )
|
---|
2310 |
|
---|
2311 | /** @def RT_BF_ZMASK
|
---|
2312 | * Helper for getting the field mask shifted to bit position zero.
|
---|
2313 | *
|
---|
2314 | * @param a_FieldNm The field name prefix for getting at the _SHIFT and
|
---|
2315 | * _MASK macros.
|
---|
2316 | * @sa #RT_BF_GET, #RT_BF_SET, #RT_BF_CLEAR, #RT_BF_MAKE
|
---|
2317 | */
|
---|
2318 | #define RT_BF_ZMASK(a_FieldNm) ( RT_CONCAT(a_FieldNm,_MASK) >> RT_CONCAT(a_FieldNm,_SHIFT) )
|
---|
2319 |
|
---|
2320 | /** Bit field compile time check helper
|
---|
2321 | * @internal */
|
---|
2322 | #define RT_BF_CHECK_DO_XOR_MASK(a_uLeft, a_RightPrefix, a_FieldNm) ((a_uLeft) ^ RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK))
|
---|
2323 | /** Bit field compile time check helper
|
---|
2324 | * @internal */
|
---|
2325 | #define RT_BF_CHECK_DO_OR_MASK(a_uLeft, a_RightPrefix, a_FieldNm) ((a_uLeft) | RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK))
|
---|
2326 | /** Bit field compile time check helper
|
---|
2327 | * @internal */
|
---|
2328 | #define RT_BF_CHECK_DO_1ST_MASK_BIT(a_uLeft, a_RightPrefix, a_FieldNm) \
|
---|
2329 | ((a_uLeft) && ( (RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK) >> RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT)) & 1U ) )
|
---|
2330 | /** Used to check that a bit field mask does not start too early.
|
---|
2331 | * @internal */
|
---|
2332 | #define RT_BF_CHECK_DO_MASK_START(a_uLeft, a_RightPrefix, a_FieldNm) \
|
---|
2333 | ( (a_uLeft) \
|
---|
2334 | && ( RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT) == 0 \
|
---|
2335 | || ( ( ( ((RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK) >> RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT)) & 1U) \
|
---|
2336 | << RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT)) /* => single bit mask, correct type */ \
|
---|
2337 | - 1U) /* => mask of all bits below the field */ \
|
---|
2338 | & RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK)) == 0 ) )
|
---|
2339 | /** @name Bit field compile time check recursion workers.
|
---|
2340 | * @internal
|
---|
2341 | * @{ */
|
---|
2342 | #define RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix, f1) \
|
---|
2343 | a_DoThis(a_uLeft, a_RightPrefix, f1)
|
---|
2344 | #define RT_BF_CHECK_DO_2(a_DoThis, a_uLeft, a_RightPrefix, f1, f2) \
|
---|
2345 | RT_BF_CHECK_DO_1(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2)
|
---|
2346 | #define RT_BF_CHECK_DO_3(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3) \
|
---|
2347 | RT_BF_CHECK_DO_2(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3)
|
---|
2348 | #define RT_BF_CHECK_DO_4(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4) \
|
---|
2349 | RT_BF_CHECK_DO_3(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4)
|
---|
2350 | #define RT_BF_CHECK_DO_5(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5) \
|
---|
2351 | RT_BF_CHECK_DO_4(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5)
|
---|
2352 | #define RT_BF_CHECK_DO_6(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6) \
|
---|
2353 | RT_BF_CHECK_DO_5(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6)
|
---|
2354 | #define RT_BF_CHECK_DO_7(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7) \
|
---|
2355 | RT_BF_CHECK_DO_6(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7)
|
---|
2356 | #define RT_BF_CHECK_DO_8(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8) \
|
---|
2357 | RT_BF_CHECK_DO_7(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8)
|
---|
2358 | #define RT_BF_CHECK_DO_9(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9) \
|
---|
2359 | RT_BF_CHECK_DO_8(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9)
|
---|
2360 | #define RT_BF_CHECK_DO_10(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10) \
|
---|
2361 | RT_BF_CHECK_DO_9(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10)
|
---|
2362 | #define RT_BF_CHECK_DO_11(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11) \
|
---|
2363 | RT_BF_CHECK_DO_10(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11)
|
---|
2364 | #define RT_BF_CHECK_DO_12(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12) \
|
---|
2365 | RT_BF_CHECK_DO_11(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12)
|
---|
2366 | #define RT_BF_CHECK_DO_13(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13) \
|
---|
2367 | RT_BF_CHECK_DO_12(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13)
|
---|
2368 | #define RT_BF_CHECK_DO_14(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14) \
|
---|
2369 | RT_BF_CHECK_DO_13(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14)
|
---|
2370 | #define RT_BF_CHECK_DO_15(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15) \
|
---|
2371 | RT_BF_CHECK_DO_14(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15)
|
---|
2372 | #define RT_BF_CHECK_DO_16(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16) \
|
---|
2373 | RT_BF_CHECK_DO_15(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16)
|
---|
2374 | #define RT_BF_CHECK_DO_17(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17) \
|
---|
2375 | RT_BF_CHECK_DO_16(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17)
|
---|
2376 | #define RT_BF_CHECK_DO_18(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18) \
|
---|
2377 | RT_BF_CHECK_DO_17(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18)
|
---|
2378 | #define RT_BF_CHECK_DO_19(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19) \
|
---|
2379 | RT_BF_CHECK_DO_18(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19)
|
---|
2380 | #define RT_BF_CHECK_DO_20(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20) \
|
---|
2381 | RT_BF_CHECK_DO_19(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20)
|
---|
2382 | #define RT_BF_CHECK_DO_21(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21) \
|
---|
2383 | RT_BF_CHECK_DO_20(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21)
|
---|
2384 | #define RT_BF_CHECK_DO_22(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22) \
|
---|
2385 | RT_BF_CHECK_DO_21(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22)
|
---|
2386 | #define RT_BF_CHECK_DO_23(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23) \
|
---|
2387 | RT_BF_CHECK_DO_22(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23)
|
---|
2388 | #define RT_BF_CHECK_DO_24(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24) \
|
---|
2389 | RT_BF_CHECK_DO_23(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24)
|
---|
2390 | #define RT_BF_CHECK_DO_25(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25) \
|
---|
2391 | RT_BF_CHECK_DO_24(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25)
|
---|
2392 | #define RT_BF_CHECK_DO_26(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26) \
|
---|
2393 | RT_BF_CHECK_DO_25(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26)
|
---|
2394 | #define RT_BF_CHECK_DO_27(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27) \
|
---|
2395 | RT_BF_CHECK_DO_26(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27)
|
---|
2396 | #define RT_BF_CHECK_DO_28(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28) \
|
---|
2397 | RT_BF_CHECK_DO_27(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28)
|
---|
2398 | #define RT_BF_CHECK_DO_29(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29) \
|
---|
2399 | RT_BF_CHECK_DO_28(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29)
|
---|
2400 | #define RT_BF_CHECK_DO_30(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30) \
|
---|
2401 | RT_BF_CHECK_DO_29(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30)
|
---|
2402 | #define RT_BF_CHECK_DO_31(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31) \
|
---|
2403 | RT_BF_CHECK_DO_30(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31)
|
---|
2404 | #define RT_BF_CHECK_DO_32(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32) \
|
---|
2405 | RT_BF_CHECK_DO_31(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32)
|
---|
2406 | #define RT_BF_CHECK_DO_33(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33) \
|
---|
2407 | RT_BF_CHECK_DO_32(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33)
|
---|
2408 | #define RT_BF_CHECK_DO_34(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34) \
|
---|
2409 | RT_BF_CHECK_DO_33(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34)
|
---|
2410 | #define RT_BF_CHECK_DO_35(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35) \
|
---|
2411 | RT_BF_CHECK_DO_34(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35)
|
---|
2412 | #define RT_BF_CHECK_DO_36(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36) \
|
---|
2413 | RT_BF_CHECK_DO_35(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36)
|
---|
2414 | #define RT_BF_CHECK_DO_37(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37) \
|
---|
2415 | RT_BF_CHECK_DO_36(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37)
|
---|
2416 | #define RT_BF_CHECK_DO_38(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38) \
|
---|
2417 | RT_BF_CHECK_DO_37(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38)
|
---|
2418 | #define RT_BF_CHECK_DO_39(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39) \
|
---|
2419 | RT_BF_CHECK_DO_38(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39)
|
---|
2420 | #define RT_BF_CHECK_DO_40(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40) \
|
---|
2421 | RT_BF_CHECK_DO_39(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40)
|
---|
2422 | #define RT_BF_CHECK_DO_41(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41) \
|
---|
2423 | RT_BF_CHECK_DO_40(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41)
|
---|
2424 | #define RT_BF_CHECK_DO_42(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42) \
|
---|
2425 | RT_BF_CHECK_DO_41(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42)
|
---|
2426 | #define RT_BF_CHECK_DO_43(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43) \
|
---|
2427 | RT_BF_CHECK_DO_42(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43)
|
---|
2428 | #define RT_BF_CHECK_DO_44(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44) \
|
---|
2429 | RT_BF_CHECK_DO_43(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44)
|
---|
2430 | #define RT_BF_CHECK_DO_45(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45) \
|
---|
2431 | RT_BF_CHECK_DO_44(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45)
|
---|
2432 | #define RT_BF_CHECK_DO_46(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46) \
|
---|
2433 | RT_BF_CHECK_DO_45(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46)
|
---|
2434 | #define RT_BF_CHECK_DO_47(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47) \
|
---|
2435 | RT_BF_CHECK_DO_46(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47)
|
---|
2436 | #define RT_BF_CHECK_DO_48(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48) \
|
---|
2437 | RT_BF_CHECK_DO_47(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48)
|
---|
2438 | #define RT_BF_CHECK_DO_49(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49) \
|
---|
2439 | RT_BF_CHECK_DO_48(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49)
|
---|
2440 | #define RT_BF_CHECK_DO_50(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50) \
|
---|
2441 | RT_BF_CHECK_DO_49(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50)
|
---|
2442 | #define RT_BF_CHECK_DO_51(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51) \
|
---|
2443 | RT_BF_CHECK_DO_40(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51)
|
---|
2444 | #define RT_BF_CHECK_DO_52(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52) \
|
---|
2445 | RT_BF_CHECK_DO_51(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52)
|
---|
2446 | #define RT_BF_CHECK_DO_53(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53) \
|
---|
2447 | RT_BF_CHECK_DO_52(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53)
|
---|
2448 | #define RT_BF_CHECK_DO_54(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54) \
|
---|
2449 | RT_BF_CHECK_DO_53(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54)
|
---|
2450 | #define RT_BF_CHECK_DO_55(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55) \
|
---|
2451 | RT_BF_CHECK_DO_54(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55)
|
---|
2452 | #define RT_BF_CHECK_DO_56(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56) \
|
---|
2453 | RT_BF_CHECK_DO_55(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56)
|
---|
2454 | #define RT_BF_CHECK_DO_57(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57) \
|
---|
2455 | RT_BF_CHECK_DO_56(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57)
|
---|
2456 | #define RT_BF_CHECK_DO_58(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58) \
|
---|
2457 | RT_BF_CHECK_DO_57(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58)
|
---|
2458 | #define RT_BF_CHECK_DO_59(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59) \
|
---|
2459 | RT_BF_CHECK_DO_58(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59)
|
---|
2460 | #define RT_BF_CHECK_DO_60(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60) \
|
---|
2461 | RT_BF_CHECK_DO_59(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60)
|
---|
2462 | #define RT_BF_CHECK_DO_61(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61) \
|
---|
2463 | RT_BF_CHECK_DO_60(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61)
|
---|
2464 | #define RT_BF_CHECK_DO_62(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62) \
|
---|
2465 | RT_BF_CHECK_DO_61(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62)
|
---|
2466 | #define RT_BF_CHECK_DO_63(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62, f63) \
|
---|
2467 | RT_BF_CHECK_DO_62(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62, f63)
|
---|
2468 | #define RT_BF_CHECK_DO_64(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62, f63, f64) \
|
---|
2469 | RT_BF_CHECK_DO_63(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62, f63, f64)
|
---|
2470 | /** @} */
|
---|
2471 |
|
---|
2472 | /** @def RT_BF_ASSERT_COMPILE_CHECKS
|
---|
2473 | * Emits a series of AssertCompile statements checking that the bit-field
|
---|
2474 | * declarations doesn't overlap, has holes, and generally makes some sense.
|
---|
2475 | *
|
---|
2476 | * This requires variadic macros because its too much to type otherwise.
|
---|
2477 | */
|
---|
2478 | #if defined(RT_COMPILER_SUPPORTS_VA_ARGS) || defined(DOXYGEN_RUNNING)
|
---|
2479 | # define RT_BF_ASSERT_COMPILE_CHECKS(a_Prefix, a_uZero, a_uCovered, a_Fields) \
|
---|
2480 | AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_OR_MASK, a_uZero, a_Prefix, RT_UNPACK_ARGS a_Fields ) == a_uCovered); \
|
---|
2481 | AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_XOR_MASK, a_uCovered, a_Prefix, RT_UNPACK_ARGS a_Fields ) == 0); \
|
---|
2482 | AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_1ST_MASK_BIT, true, a_Prefix, RT_UNPACK_ARGS a_Fields ) == true); \
|
---|
2483 | AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_MASK_START, true, a_Prefix, RT_UNPACK_ARGS a_Fields ) == true)
|
---|
2484 | /** Bit field compile time check helper
|
---|
2485 | * @internal */
|
---|
2486 | # define RT_BF_CHECK_DO_N(a_DoThis, a_uLeft, a_RightPrefix, ...) \
|
---|
2487 | RT_UNPACK_CALL(RT_CONCAT(RT_BF_CHECK_DO_, RT_EXPAND(RT_COUNT_VA_ARGS(__VA_ARGS__))), (a_DoThis, a_uLeft, a_RightPrefix, __VA_ARGS__))
|
---|
2488 | #else
|
---|
2489 | # define RT_BF_ASSERT_COMPILE_CHECKS(a_Prefix, a_uZero, a_uCovered, a_Fields) AssertCompile(true)
|
---|
2490 | #endif
|
---|
2491 |
|
---|
2492 |
|
---|
2493 | /** @def RT_ALIGN
|
---|
2494 | * Align macro.
|
---|
2495 | * @param u Value to align.
|
---|
2496 | * @param uAlignment The alignment. Power of two!
|
---|
2497 | *
|
---|
2498 | * @remark Be extremely careful when using this macro with type which sizeof != sizeof int.
|
---|
2499 | * When possible use any of the other RT_ALIGN_* macros. And when that's not
|
---|
2500 | * possible, make 101% sure that uAlignment is specified with a right sized type.
|
---|
2501 | *
|
---|
2502 | * Specifying an unsigned 32-bit alignment constant with a 64-bit value will give
|
---|
2503 | * you a 32-bit return value!
|
---|
2504 | *
|
---|
2505 | * In short: Don't use this macro. Use RT_ALIGN_T() instead.
|
---|
2506 | */
|
---|
2507 | #define RT_ALIGN(u, uAlignment) ( ((u) + ((uAlignment) - 1)) & ~((uAlignment) - 1) )
|
---|
2508 |
|
---|
2509 | /** @def RT_ALIGN_T
|
---|
2510 | * Align macro.
|
---|
2511 | * @param u Value to align.
|
---|
2512 | * @param uAlignment The alignment. Power of two!
|
---|
2513 | * @param type Integer type to use while aligning.
|
---|
2514 | * @remark This macro is the preferred alignment macro, it doesn't have any of the pitfalls RT_ALIGN has.
|
---|
2515 | */
|
---|
2516 | #define RT_ALIGN_T(u, uAlignment, type) ( ((type)(u) + ((uAlignment) - 1)) & ~(type)((uAlignment) - 1) )
|
---|
2517 |
|
---|
2518 | /** @def RT_ALIGN_32
|
---|
2519 | * Align macro for a 32-bit value.
|
---|
2520 | * @param u32 Value to align.
|
---|
2521 | * @param uAlignment The alignment. Power of two!
|
---|
2522 | */
|
---|
2523 | #define RT_ALIGN_32(u32, uAlignment) RT_ALIGN_T(u32, uAlignment, uint32_t)
|
---|
2524 |
|
---|
2525 | /** @def RT_ALIGN_64
|
---|
2526 | * Align macro for a 64-bit value.
|
---|
2527 | * @param u64 Value to align.
|
---|
2528 | * @param uAlignment The alignment. Power of two!
|
---|
2529 | */
|
---|
2530 | #define RT_ALIGN_64(u64, uAlignment) RT_ALIGN_T(u64, uAlignment, uint64_t)
|
---|
2531 |
|
---|
2532 | /** @def RT_ALIGN_Z
|
---|
2533 | * Align macro for size_t.
|
---|
2534 | * @param cb Value to align.
|
---|
2535 | * @param uAlignment The alignment. Power of two!
|
---|
2536 | */
|
---|
2537 | #define RT_ALIGN_Z(cb, uAlignment) RT_ALIGN_T(cb, uAlignment, size_t)
|
---|
2538 |
|
---|
2539 | /** @def RT_ALIGN_P
|
---|
2540 | * Align macro for pointers.
|
---|
2541 | * @param pv Value to align.
|
---|
2542 | * @param uAlignment The alignment. Power of two!
|
---|
2543 | */
|
---|
2544 | #define RT_ALIGN_P(pv, uAlignment) RT_ALIGN_PT(pv, uAlignment, void *)
|
---|
2545 |
|
---|
2546 | /** @def RT_ALIGN_PT
|
---|
2547 | * Align macro for pointers with type cast.
|
---|
2548 | * @param u Value to align.
|
---|
2549 | * @param uAlignment The alignment. Power of two!
|
---|
2550 | * @param CastType The type to cast the result to.
|
---|
2551 | */
|
---|
2552 | #define RT_ALIGN_PT(u, uAlignment, CastType) ( (CastType)RT_ALIGN_T(u, uAlignment, uintptr_t) )
|
---|
2553 |
|
---|
2554 | /** @def RT_ALIGN_R3PT
|
---|
2555 | * Align macro for ring-3 pointers with type cast.
|
---|
2556 | * @param u Value to align.
|
---|
2557 | * @param uAlignment The alignment. Power of two!
|
---|
2558 | * @param CastType The type to cast the result to.
|
---|
2559 | */
|
---|
2560 | #define RT_ALIGN_R3PT(u, uAlignment, CastType) ( (CastType)RT_ALIGN_T(u, uAlignment, RTR3UINTPTR) )
|
---|
2561 |
|
---|
2562 | /** @def RT_ALIGN_R0PT
|
---|
2563 | * Align macro for ring-0 pointers with type cast.
|
---|
2564 | * @param u Value to align.
|
---|
2565 | * @param uAlignment The alignment. Power of two!
|
---|
2566 | * @param CastType The type to cast the result to.
|
---|
2567 | */
|
---|
2568 | #define RT_ALIGN_R0PT(u, uAlignment, CastType) ( (CastType)RT_ALIGN_T(u, uAlignment, RTR0UINTPTR) )
|
---|
2569 |
|
---|
2570 | /** @def RT_ALIGN_GCPT
|
---|
2571 | * Align macro for GC pointers with type cast.
|
---|
2572 | * @param u Value to align.
|
---|
2573 | * @param uAlignment The alignment. Power of two!
|
---|
2574 | * @param CastType The type to cast the result to.
|
---|
2575 | */
|
---|
2576 | #define RT_ALIGN_GCPT(u, uAlignment, CastType) ( (CastType)RT_ALIGN_T(u, uAlignment, RTGCUINTPTR) )
|
---|
2577 |
|
---|
2578 |
|
---|
2579 | /** @def RT_OFFSETOF
|
---|
2580 | * Our own special offsetof() variant, returns a signed result.
|
---|
2581 | *
|
---|
2582 | * @returns offset into the structure of the specified member. signed.
|
---|
2583 | * @param type Structure type.
|
---|
2584 | * @param member Member.
|
---|
2585 | *
|
---|
2586 | * @remarks Only use this for static offset calculations. Please
|
---|
2587 | * use RT_UOFFSETOF_DYN for dynamic ones (i.e. involves
|
---|
2588 | * non-constant array indexing).
|
---|
2589 | *
|
---|
2590 | */
|
---|
2591 | #if RT_GNUC_PREREQ(4, 0)
|
---|
2592 | # define RT_OFFSETOF(type, member) ( (int)__builtin_offsetof(type, member) )
|
---|
2593 | #else
|
---|
2594 | # define RT_OFFSETOF(type, member) ( (int)(intptr_t)&( ((type *)(void *)0)->member) )
|
---|
2595 | #endif
|
---|
2596 |
|
---|
2597 | /** @def RT_UOFFSETOF
|
---|
2598 | * Our own offsetof() variant, returns an unsigned result.
|
---|
2599 | *
|
---|
2600 | * @returns offset into the structure of the specified member. unsigned.
|
---|
2601 | * @param type Structure type.
|
---|
2602 | * @param member Member.
|
---|
2603 | *
|
---|
2604 | * @remarks Only use this for static offset calculations. Please
|
---|
2605 | * use RT_UOFFSETOF_DYN for dynamic ones (i.e. involves
|
---|
2606 | * non-constant array indexing).
|
---|
2607 | */
|
---|
2608 | #if RT_GNUC_PREREQ(4, 0)
|
---|
2609 | # define RT_UOFFSETOF(type, member) ( (uintptr_t)__builtin_offsetof(type, member) )
|
---|
2610 | #else
|
---|
2611 | # define RT_UOFFSETOF(type, member) ( (uintptr_t)&( ((type *)(void *)0)->member) )
|
---|
2612 | #endif
|
---|
2613 |
|
---|
2614 | /** @def RT_OFFSETOF_ADD
|
---|
2615 | * RT_OFFSETOF with an addend.
|
---|
2616 | *
|
---|
2617 | * @returns offset into the structure of the specified member. signed.
|
---|
2618 | * @param type Structure type.
|
---|
2619 | * @param member Member.
|
---|
2620 | * @param addend The addend to add to the offset.
|
---|
2621 | *
|
---|
2622 | * @remarks Only use this for static offset calculations.
|
---|
2623 | */
|
---|
2624 | #define RT_OFFSETOF_ADD(type, member, addend) ( (int)RT_UOFFSETOF_ADD(type, member, addend) )
|
---|
2625 |
|
---|
2626 | /** @def RT_UOFFSETOF_ADD
|
---|
2627 | * RT_UOFFSETOF with an addend.
|
---|
2628 | *
|
---|
2629 | * @returns offset into the structure of the specified member. signed.
|
---|
2630 | * @param type Structure type.
|
---|
2631 | * @param member Member.
|
---|
2632 | * @param addend The addend to add to the offset.
|
---|
2633 | *
|
---|
2634 | * @remarks Only use this for static offset calculations.
|
---|
2635 | */
|
---|
2636 | #if RT_GNUC_PREREQ(4, 0)
|
---|
2637 | # define RT_UOFFSETOF_ADD(type, member, addend) ( (uintptr_t)(__builtin_offsetof(type, member) + (addend)))
|
---|
2638 | #else
|
---|
2639 | # define RT_UOFFSETOF_ADD(type, member, addend) ( (uintptr_t)&( ((type *)(void *)(uintptr_t)(addend))->member) )
|
---|
2640 | #endif
|
---|
2641 |
|
---|
2642 | /** @def RT_UOFFSETOF_DYN
|
---|
2643 | * Dynamic (runtime) structure offset calculations, involving
|
---|
2644 | * indexing of array members via variable.
|
---|
2645 | *
|
---|
2646 | * @returns offset into the structure of the specified member. signed.
|
---|
2647 | * @param type Structure type.
|
---|
2648 | * @param memberarray Member.
|
---|
2649 | */
|
---|
2650 | #if defined(__cplusplus) && RT_GNUC_PREREQ(4, 4)
|
---|
2651 | # define RT_UOFFSETOF_DYN(type, memberarray) ( (uintptr_t)&( ((type *)(void *)0x1000)->memberarray) - 0x1000 )
|
---|
2652 | #else
|
---|
2653 | # define RT_UOFFSETOF_DYN(type, memberarray) ( (uintptr_t)&( ((type *)(void *)0)->memberarray) )
|
---|
2654 | #endif
|
---|
2655 |
|
---|
2656 |
|
---|
2657 | /** @def RT_SIZEOFMEMB
|
---|
2658 | * Get the size of a structure member.
|
---|
2659 | *
|
---|
2660 | * @returns size of the structure member.
|
---|
2661 | * @param type Structure type.
|
---|
2662 | * @param member Member.
|
---|
2663 | */
|
---|
2664 | #define RT_SIZEOFMEMB(type, member) ( sizeof(((type *)(void *)0)->member) )
|
---|
2665 |
|
---|
2666 | /** @def RT_UOFFSET_AFTER
|
---|
2667 | * Returns the offset of the first byte following a structure/union member.
|
---|
2668 | *
|
---|
2669 | * @return byte offset into the struct.
|
---|
2670 | * @param a_Type Structure type.
|
---|
2671 | * @param a_Member The member name.
|
---|
2672 | */
|
---|
2673 | #define RT_UOFFSET_AFTER(a_Type, a_Member) ( RT_UOFFSETOF(a_Type, a_Member) + RT_SIZEOFMEMB(a_Type, a_Member) )
|
---|
2674 |
|
---|
2675 | /** @def RT_FROM_MEMBER
|
---|
2676 | * Convert a pointer to a structure member into a pointer to the structure.
|
---|
2677 | *
|
---|
2678 | * @returns pointer to the structure.
|
---|
2679 | * @param pMem Pointer to the member.
|
---|
2680 | * @param Type Structure type.
|
---|
2681 | * @param Member Member name.
|
---|
2682 | */
|
---|
2683 | #define RT_FROM_MEMBER(pMem, Type, Member) ( (Type *) ((uint8_t *)(void *)(pMem) - RT_UOFFSETOF(Type, Member)) )
|
---|
2684 |
|
---|
2685 | /** @def RT_FROM_CPP_MEMBER
|
---|
2686 | * Same as RT_FROM_MEMBER except it avoids the annoying g++ warnings about
|
---|
2687 | * invalid access to non-static data member of NULL object.
|
---|
2688 | *
|
---|
2689 | * @returns pointer to the structure.
|
---|
2690 | * @param pMem Pointer to the member.
|
---|
2691 | * @param Type Structure type.
|
---|
2692 | * @param Member Member name.
|
---|
2693 | *
|
---|
2694 | * @remarks Using the __builtin_offsetof does not shut up the compiler.
|
---|
2695 | */
|
---|
2696 | #if defined(__GNUC__) && defined(__cplusplus)
|
---|
2697 | # define RT_FROM_CPP_MEMBER(pMem, Type, Member) \
|
---|
2698 | ( (Type *) ((uintptr_t)(pMem) - (uintptr_t)&((Type *)0x1000)->Member + 0x1000U) )
|
---|
2699 | #else
|
---|
2700 | # define RT_FROM_CPP_MEMBER(pMem, Type, Member) RT_FROM_MEMBER(pMem, Type, Member)
|
---|
2701 | #endif
|
---|
2702 |
|
---|
2703 | /** @def RT_FROM_MEMBER_DYN
|
---|
2704 | * Convert a pointer to a structure member into a pointer to the structure.
|
---|
2705 | *
|
---|
2706 | * @returns pointer to the structure.
|
---|
2707 | * @param pMem Pointer to the member.
|
---|
2708 | * @param Type Structure type.
|
---|
2709 | * @param Member Member name dynamic size (some array is index by
|
---|
2710 | * non-constant value).
|
---|
2711 | */
|
---|
2712 | #define RT_FROM_MEMBER_DYN(pMem, Type, Member) ( (Type *) ((uint8_t *)(void *)(pMem) - RT_UOFFSETOF_DYN(Type, Member)) )
|
---|
2713 |
|
---|
2714 | /** @def RT_ELEMENTS
|
---|
2715 | * Calculates the number of elements in a statically sized array.
|
---|
2716 | * @returns Element count.
|
---|
2717 | * @param aArray Array in question.
|
---|
2718 | */
|
---|
2719 | #define RT_ELEMENTS(aArray) ( sizeof(aArray) / sizeof((aArray)[0]) )
|
---|
2720 |
|
---|
2721 | /** @def RT_SAFE_SUBSCRIPT
|
---|
2722 | * Safe array subscript using modulo and size_t cast.
|
---|
2723 | * @param a_Array The array.
|
---|
2724 | * @param a_idx The array index, cast to size_t to ensure unsigned.
|
---|
2725 | */
|
---|
2726 | #define RT_SAFE_SUBSCRIPT(a_Array, a_idx) (a_Array)[(size_t)(a_idx) % RT_ELEMENTS(a_Array)]
|
---|
2727 |
|
---|
2728 | /** @def RT_SAFE_SUBSCRIPT32
|
---|
2729 | * Safe array subscript using modulo and uint32_t cast.
|
---|
2730 | * @param a_Array The array.
|
---|
2731 | * @param a_idx The array index, cast to size_t to ensure unsigned.
|
---|
2732 | * @note Only consider using this if array size is not power of two.
|
---|
2733 | */
|
---|
2734 | #define RT_SAFE_SUBSCRIPT32(a_Array, a_idx) (a_Array)[(uint32_t)(a_idx) % RT_ELEMENTS(a_Array)]
|
---|
2735 |
|
---|
2736 | /** @def RT_SAFE_SUBSCRIPT16
|
---|
2737 | * Safe array subscript using modulo and uint16_t cast.
|
---|
2738 | * @param a_Array The array.
|
---|
2739 | * @param a_idx The array index, cast to size_t to ensure unsigned.
|
---|
2740 | * @note Only consider using this if array size is not power of two.
|
---|
2741 | */
|
---|
2742 | #define RT_SAFE_SUBSCRIPT16(a_Array, a_idx) (a_Array)[(uint16_t)(a_idx) % RT_ELEMENTS(a_Array)]
|
---|
2743 |
|
---|
2744 | /** @def RT_SAFE_SUBSCRIPT8
|
---|
2745 | * Safe array subscript using modulo and uint8_t cast.
|
---|
2746 | * @param a_Array The array.
|
---|
2747 | * @param a_idx The array index, cast to size_t to ensure unsigned.
|
---|
2748 | * @note Only consider using this if array size is not power of two.
|
---|
2749 | */
|
---|
2750 | #define RT_SAFE_SUBSCRIPT8(a_Array, a_idx) (a_Array)[(uint8_t)(a_idx) % RT_ELEMENTS(a_Array)]
|
---|
2751 |
|
---|
2752 | /** @def RT_SAFE_SUBSCRIPT_NC
|
---|
2753 | * Safe array subscript using modulo but no cast.
|
---|
2754 | * @param a_Array The array.
|
---|
2755 | * @param a_idx The array index - assumes unsigned type.
|
---|
2756 | * @note Only consider using this if array size is not power of two.
|
---|
2757 | */
|
---|
2758 | #define RT_SAFE_SUBSCRIPT_NC(a_Array, a_idx) (a_Array)[(a_idx) % RT_ELEMENTS(a_Array)]
|
---|
2759 |
|
---|
2760 | /** @def RT_FLEXIBLE_ARRAY
|
---|
2761 | * What to up inside the square brackets when declaring a structure member
|
---|
2762 | * with a flexible size.
|
---|
2763 | *
|
---|
2764 | * @note RT_FLEXIBLE_ARRAY_EXTENSION must always preceed the type, unless
|
---|
2765 | * it's C-only code.
|
---|
2766 | *
|
---|
2767 | * @note Use RT_UOFFSETOF() to calculate the structure size.
|
---|
2768 | *
|
---|
2769 | * @note Never to a sizeof() on the structure or member!
|
---|
2770 | *
|
---|
2771 | * @note The member must be the last one.
|
---|
2772 | *
|
---|
2773 | * @note GCC does not permit using this in a union. So, for unions you must
|
---|
2774 | * use RT_FLEXIBLE_ARRAY_IN_UNION instead.
|
---|
2775 | *
|
---|
2776 | * @note GCC does not permit using this in nested structures, where as MSC
|
---|
2777 | * does. So, use RT_FLEXIBLE_ARRAY_NESTED for that.
|
---|
2778 | *
|
---|
2779 | * @sa RT_FLEXIBLE_ARRAY_NESTED, RT_FLEXIBLE_ARRAY_IN_UNION
|
---|
2780 | */
|
---|
2781 | #if RT_MSC_PREREQ(RT_MSC_VER_VS2005) /** @todo Probably much much earlier. */ \
|
---|
2782 | || (defined(__cplusplus) && RT_GNUC_PREREQ(6, 1)) /* not tested 7.x, but hope it works with __extension__ too. */ \
|
---|
2783 | || defined(__WATCOMC__) /* openwatcom 1.9 supports it, we don't care about older atm. */ \
|
---|
2784 | || RT_CLANG_PREREQ_EX(3, 4, 0) /* Only tested clang v3.4, support is probably older. */
|
---|
2785 | # define RT_FLEXIBLE_ARRAY
|
---|
2786 | # if defined(__cplusplus) && defined(_MSC_VER)
|
---|
2787 | # pragma warning(disable:4200) /* -wd4200 does not work with VS2010 */
|
---|
2788 | # endif
|
---|
2789 | #elif defined(__STDC_VERSION__)
|
---|
2790 | # if __STDC_VERSION__ >= 1999901L
|
---|
2791 | # define RT_FLEXIBLE_ARRAY
|
---|
2792 | # else
|
---|
2793 | # define RT_FLEXIBLE_ARRAY 1
|
---|
2794 | # endif
|
---|
2795 | #else
|
---|
2796 | # define RT_FLEXIBLE_ARRAY 1
|
---|
2797 | #endif
|
---|
2798 |
|
---|
2799 | /** @def RT_FLEXIBLE_ARRAY_EXTENSION
|
---|
2800 | * A trick to make GNU C++ quietly accept flexible arrays in C++ code when
|
---|
2801 | * pedantic warnings are enabled. Put this on the line before the flexible
|
---|
2802 | * array. */
|
---|
2803 | #if (RT_GNUC_PREREQ(7, 0) && defined(__cplusplus)) || defined(DOXGYEN_RUNNING)
|
---|
2804 | # define RT_FLEXIBLE_ARRAY_EXTENSION RT_GCC_EXTENSION
|
---|
2805 | #else
|
---|
2806 | # define RT_FLEXIBLE_ARRAY_EXTENSION
|
---|
2807 | #endif
|
---|
2808 |
|
---|
2809 | /** @def RT_FLEXIBLE_ARRAY_NESTED
|
---|
2810 | * Variant of RT_FLEXIBLE_ARRAY for use in structures that are nested.
|
---|
2811 | *
|
---|
2812 | * GCC only allow the use of flexible array member in the top structure, whereas
|
---|
2813 | * MSC is less strict and let you do struct { struct { char szName[]; } s; };
|
---|
2814 | *
|
---|
2815 | * @note See notes for RT_FLEXIBLE_ARRAY.
|
---|
2816 | *
|
---|
2817 | * @note GCC does not permit using this in a union. So, for unions you must
|
---|
2818 | * use RT_FLEXIBLE_ARRAY_IN_NESTED_UNION instead.
|
---|
2819 | *
|
---|
2820 | * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION
|
---|
2821 | */
|
---|
2822 | #ifdef _MSC_VER
|
---|
2823 | # define RT_FLEXIBLE_ARRAY_NESTED RT_FLEXIBLE_ARRAY
|
---|
2824 | #else
|
---|
2825 | # define RT_FLEXIBLE_ARRAY_NESTED 1
|
---|
2826 | #endif
|
---|
2827 |
|
---|
2828 | /** @def RT_FLEXIBLE_ARRAY_IN_UNION
|
---|
2829 | * The union version of RT_FLEXIBLE_ARRAY.
|
---|
2830 | *
|
---|
2831 | * @remarks GCC does not support flexible array members in unions, 6.1.x
|
---|
2832 | * actively checks for this. Visual C++ 2010 seems happy with it.
|
---|
2833 | *
|
---|
2834 | * @note See notes for RT_FLEXIBLE_ARRAY.
|
---|
2835 | *
|
---|
2836 | * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION
|
---|
2837 | */
|
---|
2838 | #ifdef _MSC_VER
|
---|
2839 | # define RT_FLEXIBLE_ARRAY_IN_UNION RT_FLEXIBLE_ARRAY
|
---|
2840 | #else
|
---|
2841 | # define RT_FLEXIBLE_ARRAY_IN_UNION 1
|
---|
2842 | #endif
|
---|
2843 |
|
---|
2844 | /** @def RT_FLEXIBLE_ARRAY_IN_NESTED_UNION
|
---|
2845 | * The union version of RT_FLEXIBLE_ARRAY_NESTED.
|
---|
2846 | *
|
---|
2847 | * @note See notes for RT_FLEXIBLE_ARRAY.
|
---|
2848 | *
|
---|
2849 | * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION
|
---|
2850 | */
|
---|
2851 | #ifdef _MSC_VER
|
---|
2852 | # define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION RT_FLEXIBLE_ARRAY_NESTED
|
---|
2853 | #else
|
---|
2854 | # define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION 1
|
---|
2855 | #endif
|
---|
2856 |
|
---|
2857 | /** @def RT_UNION_NM
|
---|
2858 | * For compilers (like DTrace) that does not grok nameless unions, we have a
|
---|
2859 | * little hack to make them palatable.
|
---|
2860 | */
|
---|
2861 | /** @def RT_STRUCT_NM
|
---|
2862 | * For compilers (like DTrace) that does not grok nameless structs (it is
|
---|
2863 | * non-standard C++), we have a little hack to make them palatable.
|
---|
2864 | */
|
---|
2865 | #ifdef IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS
|
---|
2866 | # define RT_UNION_NM(a_Nm) a_Nm
|
---|
2867 | # define RT_STRUCT_NM(a_Nm) a_Nm
|
---|
2868 | #else
|
---|
2869 | # define RT_UNION_NM(a_Nm)
|
---|
2870 | # define RT_STRUCT_NM(a_Nm)
|
---|
2871 | #endif
|
---|
2872 |
|
---|
2873 | /**
|
---|
2874 | * Checks if the value is a power of two.
|
---|
2875 | *
|
---|
2876 | * @returns true if power of two, false if not.
|
---|
2877 | * @param uVal The value to test.
|
---|
2878 | * @remarks 0 is a power of two.
|
---|
2879 | * @see VERR_NOT_POWER_OF_TWO
|
---|
2880 | */
|
---|
2881 | #define RT_IS_POWER_OF_TWO(uVal) ( ((uVal) & ((uVal) - 1)) == 0)
|
---|
2882 |
|
---|
2883 | #ifdef RT_OS_OS2
|
---|
2884 | /* Undefine RT_MAX since there is an unfortunate clash with the max
|
---|
2885 | resource type define in os2.h. */
|
---|
2886 | # undef RT_MAX
|
---|
2887 | #endif
|
---|
2888 |
|
---|
2889 | /** @def RT_MAX
|
---|
2890 | * Finds the maximum value.
|
---|
2891 | * @returns The higher of the two.
|
---|
2892 | * @param Value1 Value 1
|
---|
2893 | * @param Value2 Value 2
|
---|
2894 | */
|
---|
2895 | #define RT_MAX(Value1, Value2) ( (Value1) >= (Value2) ? (Value1) : (Value2) )
|
---|
2896 |
|
---|
2897 | /** @def RT_MIN
|
---|
2898 | * Finds the minimum value.
|
---|
2899 | * @returns The lower of the two.
|
---|
2900 | * @param Value1 Value 1
|
---|
2901 | * @param Value2 Value 2
|
---|
2902 | */
|
---|
2903 | #define RT_MIN(Value1, Value2) ( (Value1) <= (Value2) ? (Value1) : (Value2) )
|
---|
2904 |
|
---|
2905 | /** @def RT_CLAMP
|
---|
2906 | * Clamps the value to minimum and maximum values.
|
---|
2907 | * @returns The clamped value.
|
---|
2908 | * @param Value The value to check.
|
---|
2909 | * @param Min Minimum value.
|
---|
2910 | * @param Max Maximum value.
|
---|
2911 | */
|
---|
2912 | #define RT_CLAMP(Value, Min, Max) ( (Value) > (Max) ? (Max) : (Value) < (Min) ? (Min) : (Value) )
|
---|
2913 |
|
---|
2914 | /** @def RT_ABS
|
---|
2915 | * Get the absolute (non-negative) value.
|
---|
2916 | * @returns The absolute value of Value.
|
---|
2917 | * @param Value The value.
|
---|
2918 | */
|
---|
2919 | #define RT_ABS(Value) ( (Value) >= 0 ? (Value) : -(Value) )
|
---|
2920 |
|
---|
2921 | /** @def RT_BOOL
|
---|
2922 | * Turn non-zero/zero into true/false
|
---|
2923 | * @returns The resulting boolean value.
|
---|
2924 | * @param Value The value.
|
---|
2925 | */
|
---|
2926 | #define RT_BOOL(Value) ( !!(Value) )
|
---|
2927 |
|
---|
2928 | /** @def RT_LO_U8
|
---|
2929 | * Gets the low uint8_t of a uint16_t or something equivalent. */
|
---|
2930 | #ifdef __GNUC__
|
---|
2931 | # define RT_LO_U8(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint16_t)); (uint8_t)(a); })
|
---|
2932 | #elif defined(_MSC_VER) /* shut up cast truncates constant value warnings */
|
---|
2933 | # define RT_LO_U8(a) ( (uint8_t)(UINT8_MAX & (a)) )
|
---|
2934 | #else
|
---|
2935 | # define RT_LO_U8(a) ( (uint8_t)(a) )
|
---|
2936 | #endif
|
---|
2937 | /** @def RT_HI_U8
|
---|
2938 | * Gets the high uint8_t of a uint16_t or something equivalent. */
|
---|
2939 | #ifdef __GNUC__
|
---|
2940 | # define RT_HI_U8(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint16_t)); (uint8_t)((a) >> 8); })
|
---|
2941 | #else
|
---|
2942 | # define RT_HI_U8(a) ( (uint8_t)((a) >> 8) )
|
---|
2943 | #endif
|
---|
2944 |
|
---|
2945 | /** @def RT_LO_U16
|
---|
2946 | * Gets the low uint16_t of a uint32_t or something equivalent. */
|
---|
2947 | #ifdef __GNUC__
|
---|
2948 | # define RT_LO_U16(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint32_t)); (uint16_t)(a); })
|
---|
2949 | #elif defined(_MSC_VER) /* shut up cast truncates constant value warnings */
|
---|
2950 | # define RT_LO_U16(a) ( (uint16_t)(UINT16_MAX & (a)) )
|
---|
2951 | #else
|
---|
2952 | # define RT_LO_U16(a) ( (uint16_t)(a) )
|
---|
2953 | #endif
|
---|
2954 | /** @def RT_HI_U16
|
---|
2955 | * Gets the high uint16_t of a uint32_t or something equivalent. */
|
---|
2956 | #ifdef __GNUC__
|
---|
2957 | # define RT_HI_U16(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint32_t)); (uint16_t)((a) >> 16); })
|
---|
2958 | #else
|
---|
2959 | # define RT_HI_U16(a) ( (uint16_t)((a) >> 16) )
|
---|
2960 | #endif
|
---|
2961 |
|
---|
2962 | /** @def RT_LO_U32
|
---|
2963 | * Gets the low uint32_t of a uint64_t or something equivalent. */
|
---|
2964 | #ifdef __GNUC__
|
---|
2965 | # define RT_LO_U32(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint64_t)); (uint32_t)(a); })
|
---|
2966 | #elif defined(_MSC_VER) /* shut up cast truncates constant value warnings */
|
---|
2967 | # define RT_LO_U32(a) ( (uint32_t)(UINT32_MAX & (a)) )
|
---|
2968 | #else
|
---|
2969 | # define RT_LO_U32(a) ( (uint32_t)(a) )
|
---|
2970 | #endif
|
---|
2971 | /** @def RT_HI_U32
|
---|
2972 | * Gets the high uint32_t of a uint64_t or something equivalent. */
|
---|
2973 | #ifdef __GNUC__
|
---|
2974 | # define RT_HI_U32(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint64_t)); (uint32_t)((a) >> 32); })
|
---|
2975 | #else
|
---|
2976 | # define RT_HI_U32(a) ( (uint32_t)((a) >> 32) )
|
---|
2977 | #endif
|
---|
2978 |
|
---|
2979 | /** @def RT_BYTE1
|
---|
2980 | * Gets the first byte of something. */
|
---|
2981 | #define RT_BYTE1(a) ( (uint8_t)((a) & 0xff) )
|
---|
2982 | /** @def RT_BYTE2
|
---|
2983 | * Gets the second byte of something. */
|
---|
2984 | #define RT_BYTE2(a) ( (uint8_t)(((a) >> 8) & 0xff) )
|
---|
2985 | /** @def RT_BYTE3
|
---|
2986 | * Gets the second byte of something. */
|
---|
2987 | #define RT_BYTE3(a) ( (uint8_t)(((a) >> 16) & 0xff) )
|
---|
2988 | /** @def RT_BYTE4
|
---|
2989 | * Gets the fourth byte of something. */
|
---|
2990 | #define RT_BYTE4(a) ( (uint8_t)(((a) >> 24) & 0xff) )
|
---|
2991 | /** @def RT_BYTE5
|
---|
2992 | * Gets the fifth byte of something. */
|
---|
2993 | #define RT_BYTE5(a) ( (uint8_t)(((a) >> 32) & 0xff) )
|
---|
2994 | /** @def RT_BYTE6
|
---|
2995 | * Gets the sixth byte of something. */
|
---|
2996 | #define RT_BYTE6(a) ( (uint8_t)(((a) >> 40) & 0xff) )
|
---|
2997 | /** @def RT_BYTE7
|
---|
2998 | * Gets the seventh byte of something. */
|
---|
2999 | #define RT_BYTE7(a) ( (uint8_t)(((a) >> 48) & 0xff) )
|
---|
3000 | /** @def RT_BYTE8
|
---|
3001 | * Gets the eight byte of something. */
|
---|
3002 | #define RT_BYTE8(a) ( (uint8_t)(((a) >> 56) & 0xff) )
|
---|
3003 |
|
---|
3004 |
|
---|
3005 | /** @def RT_LODWORD
|
---|
3006 | * Gets the low dword (=uint32_t) of something.
|
---|
3007 | * @deprecated Use RT_LO_U32. */
|
---|
3008 | #define RT_LODWORD(a) ( (uint32_t)(a) )
|
---|
3009 | /** @def RT_HIDWORD
|
---|
3010 | * Gets the high dword (=uint32_t) of a 64-bit of something.
|
---|
3011 | * @deprecated Use RT_HI_U32. */
|
---|
3012 | #define RT_HIDWORD(a) ( (uint32_t)((a) >> 32) )
|
---|
3013 |
|
---|
3014 | /** @def RT_LOWORD
|
---|
3015 | * Gets the low word (=uint16_t) of something.
|
---|
3016 | * @deprecated Use RT_LO_U16. */
|
---|
3017 | #define RT_LOWORD(a) ( (a) & 0xffff )
|
---|
3018 | /** @def RT_HIWORD
|
---|
3019 | * Gets the high word (=uint16_t) of a 32-bit something.
|
---|
3020 | * @deprecated Use RT_HI_U16. */
|
---|
3021 | #define RT_HIWORD(a) ( (a) >> 16 )
|
---|
3022 |
|
---|
3023 | /** @def RT_LOBYTE
|
---|
3024 | * Gets the low byte of something.
|
---|
3025 | * @deprecated Use RT_LO_U8. */
|
---|
3026 | #define RT_LOBYTE(a) ( (a) & 0xff )
|
---|
3027 | /** @def RT_HIBYTE
|
---|
3028 | * Gets the high byte of a 16-bit something.
|
---|
3029 | * @deprecated Use RT_HI_U8. */
|
---|
3030 | #define RT_HIBYTE(a) ( (a) >> 8 )
|
---|
3031 |
|
---|
3032 |
|
---|
3033 | /** @def RT_MAKE_U64
|
---|
3034 | * Constructs a uint64_t value from two uint32_t values.
|
---|
3035 | */
|
---|
3036 | #define RT_MAKE_U64(Lo, Hi) ( (uint64_t)((uint32_t)(Hi)) << 32 | (uint32_t)(Lo) )
|
---|
3037 |
|
---|
3038 | /** @def RT_MAKE_U64_FROM_U16
|
---|
3039 | * Constructs a uint64_t value from four uint16_t values.
|
---|
3040 | */
|
---|
3041 | #define RT_MAKE_U64_FROM_U16(w0, w1, w2, w3) \
|
---|
3042 | ((uint64_t)( (uint64_t)((uint16_t)(w3)) << 48 \
|
---|
3043 | | (uint64_t)((uint16_t)(w2)) << 32 \
|
---|
3044 | | (uint32_t)((uint16_t)(w1)) << 16 \
|
---|
3045 | | (uint16_t)(w0) ))
|
---|
3046 |
|
---|
3047 | /** @def RT_MAKE_U64_FROM_U8
|
---|
3048 | * Constructs a uint64_t value from eight uint8_t values.
|
---|
3049 | */
|
---|
3050 | #define RT_MAKE_U64_FROM_U8(b0, b1, b2, b3, b4, b5, b6, b7) \
|
---|
3051 | ((uint64_t)( (uint64_t)((uint8_t)(b7)) << 56 \
|
---|
3052 | | (uint64_t)((uint8_t)(b6)) << 48 \
|
---|
3053 | | (uint64_t)((uint8_t)(b5)) << 40 \
|
---|
3054 | | (uint64_t)((uint8_t)(b4)) << 32 \
|
---|
3055 | | (uint32_t)((uint8_t)(b3)) << 24 \
|
---|
3056 | | (uint32_t)((uint8_t)(b2)) << 16 \
|
---|
3057 | | (uint16_t)((uint8_t)(b1)) << 8 \
|
---|
3058 | | (uint8_t)(b0) ))
|
---|
3059 |
|
---|
3060 | /** @def RT_MAKE_U32
|
---|
3061 | * Constructs a uint32_t value from two uint16_t values.
|
---|
3062 | */
|
---|
3063 | #define RT_MAKE_U32(Lo, Hi) \
|
---|
3064 | ((uint32_t)( (uint32_t)((uint16_t)(Hi)) << 16 \
|
---|
3065 | | (uint16_t)(Lo) ))
|
---|
3066 |
|
---|
3067 | /** @def RT_MAKE_U32_FROM_U8
|
---|
3068 | * Constructs a uint32_t value from four uint8_t values.
|
---|
3069 | */
|
---|
3070 | #define RT_MAKE_U32_FROM_U8(b0, b1, b2, b3) \
|
---|
3071 | ((uint32_t)( (uint32_t)((uint8_t)(b3)) << 24 \
|
---|
3072 | | (uint32_t)((uint8_t)(b2)) << 16 \
|
---|
3073 | | (uint32_t)((uint8_t)(b1)) << 8 \
|
---|
3074 | | (uint8_t)(b0) ))
|
---|
3075 |
|
---|
3076 | /** @def RT_MAKE_U16
|
---|
3077 | * Constructs a uint16_t value from two uint8_t values.
|
---|
3078 | */
|
---|
3079 | #define RT_MAKE_U16(Lo, Hi) \
|
---|
3080 | ((uint16_t)( (uint16_t)((uint8_t)(Hi)) << 8 \
|
---|
3081 | | (uint8_t)(Lo) ))
|
---|
3082 |
|
---|
3083 |
|
---|
3084 | /** @def RT_BSWAP_U64
|
---|
3085 | * Reverses the byte order of an uint64_t value. */
|
---|
3086 | #if defined(__GNUC__)
|
---|
3087 | # define RT_BSWAP_U64(u64) (__builtin_constant_p((u64)) ? RT_BSWAP_U64_C(u64) : ASMByteSwapU64(u64))
|
---|
3088 | #else
|
---|
3089 | # define RT_BSWAP_U64(u64) ASMByteSwapU64(u64)
|
---|
3090 | #endif
|
---|
3091 |
|
---|
3092 | /** @def RT_BSWAP_U32
|
---|
3093 | * Reverses the byte order of an uint32_t value. */
|
---|
3094 | #if defined(__GNUC__)
|
---|
3095 | # define RT_BSWAP_U32(u32) (__builtin_constant_p((u32)) ? RT_BSWAP_U32_C(u32) : ASMByteSwapU32(u32))
|
---|
3096 | #else
|
---|
3097 | # define RT_BSWAP_U32(u32) ASMByteSwapU32(u32)
|
---|
3098 | #endif
|
---|
3099 |
|
---|
3100 | /** @def RT_BSWAP_U16
|
---|
3101 | * Reverses the byte order of an uint16_t value. */
|
---|
3102 | #if defined(__GNUC__)
|
---|
3103 | # define RT_BSWAP_U16(u16) (__builtin_constant_p((u16)) ? RT_BSWAP_U16_C(u16) : ASMByteSwapU16(u16))
|
---|
3104 | #else
|
---|
3105 | # define RT_BSWAP_U16(u16) ASMByteSwapU16(u16)
|
---|
3106 | #endif
|
---|
3107 |
|
---|
3108 | /** @def RT_BSWAP_S64
|
---|
3109 | * Reverses the byte order of an int64_t value. */
|
---|
3110 | #define RT_BSWAP_S64(i64) ((int64_t)RT_BSWAP_U64((uint64_t)i64))
|
---|
3111 |
|
---|
3112 | /** @def RT_BSWAP_S32
|
---|
3113 | * Reverses the byte order of an int32_t value. */
|
---|
3114 | #define RT_BSWAP_S32(i32) ((int32_t)RT_BSWAP_U32((uint32_t)i32))
|
---|
3115 |
|
---|
3116 | /** @def RT_BSWAP_S16
|
---|
3117 | * Reverses the byte order of an int16_t value. */
|
---|
3118 | #define RT_BSWAP_S16(i16) ((int16_t)RT_BSWAP_U16((uint16_t)i16))
|
---|
3119 |
|
---|
3120 |
|
---|
3121 | /** @def RT_BSWAP_U64_C
|
---|
3122 | * Reverses the byte order of an uint64_t constant. */
|
---|
3123 | #define RT_BSWAP_U64_C(u64) RT_MAKE_U64(RT_BSWAP_U32_C((u64) >> 32), RT_BSWAP_U32_C((u64) & 0xffffffff))
|
---|
3124 |
|
---|
3125 | /** @def RT_BSWAP_U32_C
|
---|
3126 | * Reverses the byte order of an uint32_t constant. */
|
---|
3127 | #define RT_BSWAP_U32_C(u32) RT_MAKE_U32_FROM_U8(RT_BYTE4(u32), RT_BYTE3(u32), RT_BYTE2(u32), RT_BYTE1(u32))
|
---|
3128 |
|
---|
3129 | /** @def RT_BSWAP_U16_C
|
---|
3130 | * Reverses the byte order of an uint16_t constant. */
|
---|
3131 | #define RT_BSWAP_U16_C(u16) RT_MAKE_U16(RT_HIBYTE(u16), RT_LOBYTE(u16))
|
---|
3132 |
|
---|
3133 | /** @def RT_BSWAP_S64_C
|
---|
3134 | * Reverses the byte order of an int64_t constant. */
|
---|
3135 | #define RT_BSWAP_S64_C(i64) ((int64_t)RT_MAKE_U64(RT_BSWAP_U32_C((uint64_t)(i64) >> 32), RT_BSWAP_U32_C((uint32_t)(i64))))
|
---|
3136 |
|
---|
3137 | /** @def RT_BSWAP_S32_C
|
---|
3138 | * Reverses the byte order of an int32_t constant. */
|
---|
3139 | #define RT_BSWAP_S32_C(i32) ((int32_t)RT_MAKE_U32_FROM_U8(RT_BYTE4(i32), RT_BYTE3(i32), RT_BYTE2(i32), RT_BYTE1(i)))
|
---|
3140 |
|
---|
3141 | /** @def RT_BSWAP_S16_C
|
---|
3142 | * Reverses the byte order of an uint16_t constant. */
|
---|
3143 | #define RT_BSWAP_S16_C(i16) ((int16_t)RT_MAKE_U16(RT_HIBYTE(i16), RT_LOBYTE(i16)))
|
---|
3144 |
|
---|
3145 |
|
---|
3146 |
|
---|
3147 | /** @name Host to/from little endian.
|
---|
3148 | * @note Typically requires iprt/asm.h to be included.
|
---|
3149 | * @{ */
|
---|
3150 |
|
---|
3151 | /** @def RT_H2LE_U64
|
---|
3152 | * Converts an uint64_t value from host to little endian byte order. */
|
---|
3153 | #ifdef RT_BIG_ENDIAN
|
---|
3154 | # define RT_H2LE_U64(u64) RT_BSWAP_U64(u64)
|
---|
3155 | #else
|
---|
3156 | # define RT_H2LE_U64(u64) (u64)
|
---|
3157 | #endif
|
---|
3158 |
|
---|
3159 | /** @def RT_H2LE_U64_C
|
---|
3160 | * Converts an uint64_t constant from host to little endian byte order. */
|
---|
3161 | #ifdef RT_BIG_ENDIAN
|
---|
3162 | # define RT_H2LE_U64_C(u64) RT_BSWAP_U64_C(u64)
|
---|
3163 | #else
|
---|
3164 | # define RT_H2LE_U64_C(u64) (u64)
|
---|
3165 | #endif
|
---|
3166 |
|
---|
3167 | /** @def RT_H2LE_U32
|
---|
3168 | * Converts an uint32_t value from host to little endian byte order. */
|
---|
3169 | #ifdef RT_BIG_ENDIAN
|
---|
3170 | # define RT_H2LE_U32(u32) RT_BSWAP_U32(u32)
|
---|
3171 | #else
|
---|
3172 | # define RT_H2LE_U32(u32) (u32)
|
---|
3173 | #endif
|
---|
3174 |
|
---|
3175 | /** @def RT_H2LE_U32_C
|
---|
3176 | * Converts an uint32_t constant from host to little endian byte order. */
|
---|
3177 | #ifdef RT_BIG_ENDIAN
|
---|
3178 | # define RT_H2LE_U32_C(u32) RT_BSWAP_U32_C(u32)
|
---|
3179 | #else
|
---|
3180 | # define RT_H2LE_U32_C(u32) (u32)
|
---|
3181 | #endif
|
---|
3182 |
|
---|
3183 | /** @def RT_H2LE_U16
|
---|
3184 | * Converts an uint16_t value from host to little endian byte order. */
|
---|
3185 | #ifdef RT_BIG_ENDIAN
|
---|
3186 | # define RT_H2LE_U16(u16) RT_BSWAP_U16(u16)
|
---|
3187 | #else
|
---|
3188 | # define RT_H2LE_U16(u16) (u16)
|
---|
3189 | #endif
|
---|
3190 |
|
---|
3191 | /** @def RT_H2LE_U16_C
|
---|
3192 | * Converts an uint16_t constant from host to little endian byte order. */
|
---|
3193 | #ifdef RT_BIG_ENDIAN
|
---|
3194 | # define RT_H2LE_U16_C(u16) RT_BSWAP_U16_C(u16)
|
---|
3195 | #else
|
---|
3196 | # define RT_H2LE_U16_C(u16) (u16)
|
---|
3197 | #endif
|
---|
3198 |
|
---|
3199 |
|
---|
3200 | /** @def RT_LE2H_U64
|
---|
3201 | * Converts an uint64_t value from little endian to host byte order. */
|
---|
3202 | #ifdef RT_BIG_ENDIAN
|
---|
3203 | # define RT_LE2H_U64(u64) RT_BSWAP_U64(u64)
|
---|
3204 | #else
|
---|
3205 | # define RT_LE2H_U64(u64) (u64)
|
---|
3206 | #endif
|
---|
3207 |
|
---|
3208 | /** @def RT_LE2H_U64_C
|
---|
3209 | * Converts an uint64_t constant from little endian to host byte order. */
|
---|
3210 | #ifdef RT_BIG_ENDIAN
|
---|
3211 | # define RT_LE2H_U64_C(u64) RT_BSWAP_U64_C(u64)
|
---|
3212 | #else
|
---|
3213 | # define RT_LE2H_U64_C(u64) (u64)
|
---|
3214 | #endif
|
---|
3215 |
|
---|
3216 | /** @def RT_LE2H_U32
|
---|
3217 | * Converts an uint32_t value from little endian to host byte order. */
|
---|
3218 | #ifdef RT_BIG_ENDIAN
|
---|
3219 | # define RT_LE2H_U32(u32) RT_BSWAP_U32(u32)
|
---|
3220 | #else
|
---|
3221 | # define RT_LE2H_U32(u32) (u32)
|
---|
3222 | #endif
|
---|
3223 |
|
---|
3224 | /** @def RT_LE2H_U32_C
|
---|
3225 | * Converts an uint32_t constant from little endian to host byte order. */
|
---|
3226 | #ifdef RT_BIG_ENDIAN
|
---|
3227 | # define RT_LE2H_U32_C(u32) RT_BSWAP_U32_C(u32)
|
---|
3228 | #else
|
---|
3229 | # define RT_LE2H_U32_C(u32) (u32)
|
---|
3230 | #endif
|
---|
3231 |
|
---|
3232 | /** @def RT_LE2H_U16
|
---|
3233 | * Converts an uint16_t value from little endian to host byte order. */
|
---|
3234 | #ifdef RT_BIG_ENDIAN
|
---|
3235 | # define RT_LE2H_U16(u16) RT_BSWAP_U16(u16)
|
---|
3236 | #else
|
---|
3237 | # define RT_LE2H_U16(u16) (u16)
|
---|
3238 | #endif
|
---|
3239 |
|
---|
3240 | /** @def RT_LE2H_U16_C
|
---|
3241 | * Converts an uint16_t constant from little endian to host byte order. */
|
---|
3242 | #ifdef RT_BIG_ENDIAN
|
---|
3243 | # define RT_LE2H_U16_C(u16) RT_BSWAP_U16_C(u16)
|
---|
3244 | #else
|
---|
3245 | # define RT_LE2H_U16_C(u16) (u16)
|
---|
3246 | #endif
|
---|
3247 |
|
---|
3248 | /** @def RT_H2LE_S64
|
---|
3249 | * Converts an int64_t value from host to little endian byte order. */
|
---|
3250 | #ifdef RT_BIG_ENDIAN
|
---|
3251 | # define RT_H2LE_S64(i64) RT_BSWAP_S64(i64)
|
---|
3252 | #else
|
---|
3253 | # define RT_H2LE_S64(i64) (i64)
|
---|
3254 | #endif
|
---|
3255 |
|
---|
3256 | /** @def RT_H2LE_S64_C
|
---|
3257 | * Converts an int64_t constant from host to little endian byte order. */
|
---|
3258 | #ifdef RT_BIG_ENDIAN
|
---|
3259 | # define RT_H2LE_S64_C(i64) RT_BSWAP_S64_C(i64)
|
---|
3260 | #else
|
---|
3261 | # define RT_H2LE_S64_C(i64) (i64)
|
---|
3262 | #endif
|
---|
3263 |
|
---|
3264 | /** @def RT_H2LE_S32
|
---|
3265 | * Converts an int32_t value from host to little endian byte order. */
|
---|
3266 | #ifdef RT_BIG_ENDIAN
|
---|
3267 | # define RT_H2LE_S32(i32) RT_BSWAP_S32(i32)
|
---|
3268 | #else
|
---|
3269 | # define RT_H2LE_S32(i32) (i32)
|
---|
3270 | #endif
|
---|
3271 |
|
---|
3272 | /** @def RT_H2LE_S32_C
|
---|
3273 | * Converts an int32_t constant from host to little endian byte order. */
|
---|
3274 | #ifdef RT_BIG_ENDIAN
|
---|
3275 | # define RT_H2LE_S32_C(i32) RT_BSWAP_S32_C(i32)
|
---|
3276 | #else
|
---|
3277 | # define RT_H2LE_S32_C(i32) (i32)
|
---|
3278 | #endif
|
---|
3279 |
|
---|
3280 | /** @def RT_H2LE_S16
|
---|
3281 | * Converts an int16_t value from host to little endian byte order. */
|
---|
3282 | #ifdef RT_BIG_ENDIAN
|
---|
3283 | # define RT_H2LE_S16(i16) RT_BSWAP_S16(i16)
|
---|
3284 | #else
|
---|
3285 | # define RT_H2LE_S16(i16) (i16)
|
---|
3286 | #endif
|
---|
3287 |
|
---|
3288 | /** @def RT_H2LE_S16_C
|
---|
3289 | * Converts an int16_t constant from host to little endian byte order. */
|
---|
3290 | #ifdef RT_BIG_ENDIAN
|
---|
3291 | # define RT_H2LE_S16_C(i16) RT_BSWAP_S16_C(i16)
|
---|
3292 | #else
|
---|
3293 | # define RT_H2LE_S16_C(i16) (i16)
|
---|
3294 | #endif
|
---|
3295 |
|
---|
3296 | /** @def RT_LE2H_S64
|
---|
3297 | * Converts an int64_t value from little endian to host byte order. */
|
---|
3298 | #ifdef RT_BIG_ENDIAN
|
---|
3299 | # define RT_LE2H_S64(i64) RT_BSWAP_S64(i64)
|
---|
3300 | #else
|
---|
3301 | # define RT_LE2H_S64(i64) (i64)
|
---|
3302 | #endif
|
---|
3303 |
|
---|
3304 | /** @def RT_LE2H_S64_C
|
---|
3305 | * Converts an int64_t constant from little endian to host byte order. */
|
---|
3306 | #ifdef RT_BIG_ENDIAN
|
---|
3307 | # define RT_LE2H_S64_C(i64) RT_BSWAP_S64_C(i64)
|
---|
3308 | #else
|
---|
3309 | # define RT_LE2H_S64_C(i64) (i64)
|
---|
3310 | #endif
|
---|
3311 |
|
---|
3312 | /** @def RT_LE2H_S32
|
---|
3313 | * Converts an int32_t value from little endian to host byte order. */
|
---|
3314 | #ifdef RT_BIG_ENDIAN
|
---|
3315 | # define RT_LE2H_S32(i32) RT_BSWAP_S32(i32)
|
---|
3316 | #else
|
---|
3317 | # define RT_LE2H_S32(i32) (i32)
|
---|
3318 | #endif
|
---|
3319 |
|
---|
3320 | /** @def RT_LE2H_S32_C
|
---|
3321 | * Converts an int32_t constant from little endian to host byte order. */
|
---|
3322 | #ifdef RT_BIG_ENDIAN
|
---|
3323 | # define RT_LE2H_S32_C(i32) RT_BSWAP_S32_C(i32)
|
---|
3324 | #else
|
---|
3325 | # define RT_LE2H_S32_C(i32) (i32)
|
---|
3326 | #endif
|
---|
3327 |
|
---|
3328 | /** @def RT_LE2H_S16
|
---|
3329 | * Converts an int16_t value from little endian to host byte order. */
|
---|
3330 | #ifdef RT_BIG_ENDIAN
|
---|
3331 | # define RT_LE2H_S16(i16) RT_BSWAP_S16(i16)
|
---|
3332 | #else
|
---|
3333 | # define RT_LE2H_S16(i16) (i16)
|
---|
3334 | #endif
|
---|
3335 |
|
---|
3336 | /** @def RT_LE2H_S16_C
|
---|
3337 | * Converts an int16_t constant from little endian to host byte order. */
|
---|
3338 | #ifdef RT_BIG_ENDIAN
|
---|
3339 | # define RT_LE2H_S16_C(i16) RT_BSWAP_S16_C(i16)
|
---|
3340 | #else
|
---|
3341 | # define RT_LE2H_S16_C(i16) (i16)
|
---|
3342 | #endif
|
---|
3343 |
|
---|
3344 | /** @} */
|
---|
3345 |
|
---|
3346 | /** @name Host to/from big endian.
|
---|
3347 | * @note Typically requires iprt/asm.h to be included.
|
---|
3348 | * @{ */
|
---|
3349 |
|
---|
3350 | /** @def RT_H2BE_U64
|
---|
3351 | * Converts an uint64_t value from host to big endian byte order. */
|
---|
3352 | #ifdef RT_BIG_ENDIAN
|
---|
3353 | # define RT_H2BE_U64(u64) (u64)
|
---|
3354 | #else
|
---|
3355 | # define RT_H2BE_U64(u64) RT_BSWAP_U64(u64)
|
---|
3356 | #endif
|
---|
3357 |
|
---|
3358 | /** @def RT_H2BE_U64_C
|
---|
3359 | * Converts an uint64_t constant from host to big endian byte order. */
|
---|
3360 | #ifdef RT_BIG_ENDIAN
|
---|
3361 | # define RT_H2BE_U64_C(u64) (u64)
|
---|
3362 | #else
|
---|
3363 | # define RT_H2BE_U64_C(u64) RT_BSWAP_U64_C(u64)
|
---|
3364 | #endif
|
---|
3365 |
|
---|
3366 | /** @def RT_H2BE_U32
|
---|
3367 | * Converts an uint32_t value from host to big endian byte order. */
|
---|
3368 | #ifdef RT_BIG_ENDIAN
|
---|
3369 | # define RT_H2BE_U32(u32) (u32)
|
---|
3370 | #else
|
---|
3371 | # define RT_H2BE_U32(u32) RT_BSWAP_U32(u32)
|
---|
3372 | #endif
|
---|
3373 |
|
---|
3374 | /** @def RT_H2BE_U32_C
|
---|
3375 | * Converts an uint32_t constant from host to big endian byte order. */
|
---|
3376 | #ifdef RT_BIG_ENDIAN
|
---|
3377 | # define RT_H2BE_U32_C(u32) (u32)
|
---|
3378 | #else
|
---|
3379 | # define RT_H2BE_U32_C(u32) RT_BSWAP_U32_C(u32)
|
---|
3380 | #endif
|
---|
3381 |
|
---|
3382 | /** @def RT_H2BE_U16
|
---|
3383 | * Converts an uint16_t value from host to big endian byte order. */
|
---|
3384 | #ifdef RT_BIG_ENDIAN
|
---|
3385 | # define RT_H2BE_U16(u16) (u16)
|
---|
3386 | #else
|
---|
3387 | # define RT_H2BE_U16(u16) RT_BSWAP_U16(u16)
|
---|
3388 | #endif
|
---|
3389 |
|
---|
3390 | /** @def RT_H2BE_U16_C
|
---|
3391 | * Converts an uint16_t constant from host to big endian byte order. */
|
---|
3392 | #ifdef RT_BIG_ENDIAN
|
---|
3393 | # define RT_H2BE_U16_C(u16) (u16)
|
---|
3394 | #else
|
---|
3395 | # define RT_H2BE_U16_C(u16) RT_BSWAP_U16_C(u16)
|
---|
3396 | #endif
|
---|
3397 |
|
---|
3398 | /** @def RT_BE2H_U64
|
---|
3399 | * Converts an uint64_t value from big endian to host byte order. */
|
---|
3400 | #ifdef RT_BIG_ENDIAN
|
---|
3401 | # define RT_BE2H_U64(u64) (u64)
|
---|
3402 | #else
|
---|
3403 | # define RT_BE2H_U64(u64) RT_BSWAP_U64(u64)
|
---|
3404 | #endif
|
---|
3405 |
|
---|
3406 | /** @def RT_BE2H_U64
|
---|
3407 | * Converts an uint64_t constant from big endian to host byte order. */
|
---|
3408 | #ifdef RT_BIG_ENDIAN
|
---|
3409 | # define RT_BE2H_U64_C(u64) (u64)
|
---|
3410 | #else
|
---|
3411 | # define RT_BE2H_U64_C(u64) RT_BSWAP_U64_C(u64)
|
---|
3412 | #endif
|
---|
3413 |
|
---|
3414 | /** @def RT_BE2H_U32
|
---|
3415 | * Converts an uint32_t value from big endian to host byte order. */
|
---|
3416 | #ifdef RT_BIG_ENDIAN
|
---|
3417 | # define RT_BE2H_U32(u32) (u32)
|
---|
3418 | #else
|
---|
3419 | # define RT_BE2H_U32(u32) RT_BSWAP_U32(u32)
|
---|
3420 | #endif
|
---|
3421 |
|
---|
3422 | /** @def RT_BE2H_U32_C
|
---|
3423 | * Converts an uint32_t value from big endian to host byte order. */
|
---|
3424 | #ifdef RT_BIG_ENDIAN
|
---|
3425 | # define RT_BE2H_U32_C(u32) (u32)
|
---|
3426 | #else
|
---|
3427 | # define RT_BE2H_U32_C(u32) RT_BSWAP_U32_C(u32)
|
---|
3428 | #endif
|
---|
3429 |
|
---|
3430 | /** @def RT_BE2H_U16
|
---|
3431 | * Converts an uint16_t value from big endian to host byte order. */
|
---|
3432 | #ifdef RT_BIG_ENDIAN
|
---|
3433 | # define RT_BE2H_U16(u16) (u16)
|
---|
3434 | #else
|
---|
3435 | # define RT_BE2H_U16(u16) RT_BSWAP_U16(u16)
|
---|
3436 | #endif
|
---|
3437 |
|
---|
3438 | /** @def RT_BE2H_U16_C
|
---|
3439 | * Converts an uint16_t constant from big endian to host byte order. */
|
---|
3440 | #ifdef RT_BIG_ENDIAN
|
---|
3441 | # define RT_BE2H_U16_C(u16) (u16)
|
---|
3442 | #else
|
---|
3443 | # define RT_BE2H_U16_C(u16) RT_BSWAP_U16_C(u16)
|
---|
3444 | #endif
|
---|
3445 |
|
---|
3446 | /** @def RT_H2BE_S64
|
---|
3447 | * Converts an int64_t value from host to big endian byte order. */
|
---|
3448 | #ifdef RT_BIG_ENDIAN
|
---|
3449 | # define RT_H2BE_S64(i64) (i64)
|
---|
3450 | #else
|
---|
3451 | # define RT_H2BE_S64(i64) RT_BSWAP_S64(i64)
|
---|
3452 | #endif
|
---|
3453 |
|
---|
3454 | /** @def RT_H2BE_S64_C
|
---|
3455 | * Converts an int64_t constant from host to big endian byte order. */
|
---|
3456 | #ifdef RT_BIG_ENDIAN
|
---|
3457 | # define RT_H2BE_S64_C(i64) (i64)
|
---|
3458 | #else
|
---|
3459 | # define RT_H2BE_S64_C(i64) RT_BSWAP_S64_C(i64)
|
---|
3460 | #endif
|
---|
3461 |
|
---|
3462 | /** @def RT_H2BE_S32
|
---|
3463 | * Converts an int32_t value from host to big endian byte order. */
|
---|
3464 | #ifdef RT_BIG_ENDIAN
|
---|
3465 | # define RT_H2BE_S32(i32) (i32)
|
---|
3466 | #else
|
---|
3467 | # define RT_H2BE_S32(i32) RT_BSWAP_S32(i32)
|
---|
3468 | #endif
|
---|
3469 |
|
---|
3470 | /** @def RT_H2BE_S32_C
|
---|
3471 | * Converts an int32_t constant from host to big endian byte order. */
|
---|
3472 | #ifdef RT_BIG_ENDIAN
|
---|
3473 | # define RT_H2BE_S32_C(i32) (i32)
|
---|
3474 | #else
|
---|
3475 | # define RT_H2BE_S32_C(i32) RT_BSWAP_S32_C(i32)
|
---|
3476 | #endif
|
---|
3477 |
|
---|
3478 | /** @def RT_H2BE_S16
|
---|
3479 | * Converts an int16_t value from host to big endian byte order. */
|
---|
3480 | #ifdef RT_BIG_ENDIAN
|
---|
3481 | # define RT_H2BE_S16(i16) (i16)
|
---|
3482 | #else
|
---|
3483 | # define RT_H2BE_S16(i16) RT_BSWAP_S16(i16)
|
---|
3484 | #endif
|
---|
3485 |
|
---|
3486 | /** @def RT_H2BE_S16_C
|
---|
3487 | * Converts an int16_t constant from host to big endian byte order. */
|
---|
3488 | #ifdef RT_BIG_ENDIAN
|
---|
3489 | # define RT_H2BE_S16_C(i16) (i16)
|
---|
3490 | #else
|
---|
3491 | # define RT_H2BE_S16_C(i16) RT_BSWAP_S16_C(i16)
|
---|
3492 | #endif
|
---|
3493 |
|
---|
3494 | /** @def RT_BE2H_S64
|
---|
3495 | * Converts an int64_t value from big endian to host byte order. */
|
---|
3496 | #ifdef RT_BIG_ENDIAN
|
---|
3497 | # define RT_BE2H_S64(i64) (i64)
|
---|
3498 | #else
|
---|
3499 | # define RT_BE2H_S64(i64) RT_BSWAP_S64(i64)
|
---|
3500 | #endif
|
---|
3501 |
|
---|
3502 | /** @def RT_BE2H_S64
|
---|
3503 | * Converts an int64_t constant from big endian to host byte order. */
|
---|
3504 | #ifdef RT_BIG_ENDIAN
|
---|
3505 | # define RT_BE2H_S64_C(i64) (i64)
|
---|
3506 | #else
|
---|
3507 | # define RT_BE2H_S64_C(i64) RT_BSWAP_S64_C(i64)
|
---|
3508 | #endif
|
---|
3509 |
|
---|
3510 | /** @def RT_BE2H_S32
|
---|
3511 | * Converts an int32_t value from big endian to host byte order. */
|
---|
3512 | #ifdef RT_BIG_ENDIAN
|
---|
3513 | # define RT_BE2H_S32(i32) (i32)
|
---|
3514 | #else
|
---|
3515 | # define RT_BE2H_S32(i32) RT_BSWAP_S32(i32)
|
---|
3516 | #endif
|
---|
3517 |
|
---|
3518 | /** @def RT_BE2H_S32_C
|
---|
3519 | * Converts an int32_t value from big endian to host byte order. */
|
---|
3520 | #ifdef RT_BIG_ENDIAN
|
---|
3521 | # define RT_BE2H_S32_C(i32) (i32)
|
---|
3522 | #else
|
---|
3523 | # define RT_BE2H_S32_C(i32) RT_BSWAP_S32_C(i32)
|
---|
3524 | #endif
|
---|
3525 |
|
---|
3526 | /** @def RT_BE2H_S16
|
---|
3527 | * Converts an int16_t value from big endian to host byte order. */
|
---|
3528 | #ifdef RT_BIG_ENDIAN
|
---|
3529 | # define RT_BE2H_S16(i16) (i16)
|
---|
3530 | #else
|
---|
3531 | # define RT_BE2H_S16(i16) RT_BSWAP_S16(i16)
|
---|
3532 | #endif
|
---|
3533 |
|
---|
3534 | /** @def RT_BE2H_S16_C
|
---|
3535 | * Converts an int16_t constant from big endian to host byte order. */
|
---|
3536 | #ifdef RT_BIG_ENDIAN
|
---|
3537 | # define RT_BE2H_S16_C(i16) (i16)
|
---|
3538 | #else
|
---|
3539 | # define RT_BE2H_S16_C(i16) RT_BSWAP_S16_C(i16)
|
---|
3540 | #endif
|
---|
3541 | /** @} */
|
---|
3542 |
|
---|
3543 | /** @name Host to/from network byte order.
|
---|
3544 | * @note Typically requires iprt/asm.h to be included.
|
---|
3545 | * @{ */
|
---|
3546 |
|
---|
3547 | /** @def RT_H2N_U64
|
---|
3548 | * Converts an uint64_t value from host to network byte order. */
|
---|
3549 | #define RT_H2N_U64(u64) RT_H2BE_U64(u64)
|
---|
3550 |
|
---|
3551 | /** @def RT_H2N_U64_C
|
---|
3552 | * Converts an uint64_t constant from host to network byte order. */
|
---|
3553 | #define RT_H2N_U64_C(u64) RT_H2BE_U64_C(u64)
|
---|
3554 |
|
---|
3555 | /** @def RT_H2N_U32
|
---|
3556 | * Converts an uint32_t value from host to network byte order. */
|
---|
3557 | #define RT_H2N_U32(u32) RT_H2BE_U32(u32)
|
---|
3558 |
|
---|
3559 | /** @def RT_H2N_U32_C
|
---|
3560 | * Converts an uint32_t constant from host to network byte order. */
|
---|
3561 | #define RT_H2N_U32_C(u32) RT_H2BE_U32_C(u32)
|
---|
3562 |
|
---|
3563 | /** @def RT_H2N_U16
|
---|
3564 | * Converts an uint16_t value from host to network byte order. */
|
---|
3565 | #define RT_H2N_U16(u16) RT_H2BE_U16(u16)
|
---|
3566 |
|
---|
3567 | /** @def RT_H2N_U16_C
|
---|
3568 | * Converts an uint16_t constant from host to network byte order. */
|
---|
3569 | #define RT_H2N_U16_C(u16) RT_H2BE_U16_C(u16)
|
---|
3570 |
|
---|
3571 | /** @def RT_N2H_U64
|
---|
3572 | * Converts an uint64_t value from network to host byte order. */
|
---|
3573 | #define RT_N2H_U64(u64) RT_BE2H_U64(u64)
|
---|
3574 |
|
---|
3575 | /** @def RT_N2H_U64_C
|
---|
3576 | * Converts an uint64_t constant from network to host byte order. */
|
---|
3577 | #define RT_N2H_U64_C(u64) RT_BE2H_U64_C(u64)
|
---|
3578 |
|
---|
3579 | /** @def RT_N2H_U32
|
---|
3580 | * Converts an uint32_t value from network to host byte order. */
|
---|
3581 | #define RT_N2H_U32(u32) RT_BE2H_U32(u32)
|
---|
3582 |
|
---|
3583 | /** @def RT_N2H_U32_C
|
---|
3584 | * Converts an uint32_t constant from network to host byte order. */
|
---|
3585 | #define RT_N2H_U32_C(u32) RT_BE2H_U32_C(u32)
|
---|
3586 |
|
---|
3587 | /** @def RT_N2H_U16
|
---|
3588 | * Converts an uint16_t value from network to host byte order. */
|
---|
3589 | #define RT_N2H_U16(u16) RT_BE2H_U16(u16)
|
---|
3590 |
|
---|
3591 | /** @def RT_N2H_U16_C
|
---|
3592 | * Converts an uint16_t value from network to host byte order. */
|
---|
3593 | #define RT_N2H_U16_C(u16) RT_BE2H_U16_C(u16)
|
---|
3594 |
|
---|
3595 | /** @def RT_H2N_S64
|
---|
3596 | * Converts an int64_t value from host to network byte order. */
|
---|
3597 | #define RT_H2N_S64(i64) RT_H2BE_S64(i64)
|
---|
3598 |
|
---|
3599 | /** @def RT_H2N_S64_C
|
---|
3600 | * Converts an int64_t constant from host to network byte order. */
|
---|
3601 | #define RT_H2N_S64_C(i64) RT_H2BE_S64_C(i64)
|
---|
3602 |
|
---|
3603 | /** @def RT_H2N_S32
|
---|
3604 | * Converts an int32_t value from host to network byte order. */
|
---|
3605 | #define RT_H2N_S32(i32) RT_H2BE_S32(i32)
|
---|
3606 |
|
---|
3607 | /** @def RT_H2N_S32_C
|
---|
3608 | * Converts an int32_t constant from host to network byte order. */
|
---|
3609 | #define RT_H2N_S32_C(i32) RT_H2BE_S32_C(i32)
|
---|
3610 |
|
---|
3611 | /** @def RT_H2N_S16
|
---|
3612 | * Converts an int16_t value from host to network byte order. */
|
---|
3613 | #define RT_H2N_S16(i16) RT_H2BE_S16(i16)
|
---|
3614 |
|
---|
3615 | /** @def RT_H2N_S16_C
|
---|
3616 | * Converts an int16_t constant from host to network byte order. */
|
---|
3617 | #define RT_H2N_S16_C(i16) RT_H2BE_S16_C(i16)
|
---|
3618 |
|
---|
3619 | /** @def RT_N2H_S64
|
---|
3620 | * Converts an int64_t value from network to host byte order. */
|
---|
3621 | #define RT_N2H_S64(i64) RT_BE2H_S64(i64)
|
---|
3622 |
|
---|
3623 | /** @def RT_N2H_S64_C
|
---|
3624 | * Converts an int64_t constant from network to host byte order. */
|
---|
3625 | #define RT_N2H_S64_C(i64) RT_BE2H_S64_C(i64)
|
---|
3626 |
|
---|
3627 | /** @def RT_N2H_S32
|
---|
3628 | * Converts an int32_t value from network to host byte order. */
|
---|
3629 | #define RT_N2H_S32(i32) RT_BE2H_S32(i32)
|
---|
3630 |
|
---|
3631 | /** @def RT_N2H_S32_C
|
---|
3632 | * Converts an int32_t constant from network to host byte order. */
|
---|
3633 | #define RT_N2H_S32_C(i32) RT_BE2H_S32_C(i32)
|
---|
3634 |
|
---|
3635 | /** @def RT_N2H_S16
|
---|
3636 | * Converts an int16_t value from network to host byte order. */
|
---|
3637 | #define RT_N2H_S16(i16) RT_BE2H_S16(i16)
|
---|
3638 |
|
---|
3639 | /** @def RT_N2H_S16_C
|
---|
3640 | * Converts an int16_t value from network to host byte order. */
|
---|
3641 | #define RT_N2H_S16_C(i16) RT_BE2H_S16_C(i16)
|
---|
3642 |
|
---|
3643 | /** @} */
|
---|
3644 |
|
---|
3645 |
|
---|
3646 | /*
|
---|
3647 | * The BSD sys/param.h + machine/param.h file is a major source of
|
---|
3648 | * namespace pollution. Kill off some of the worse ones unless we're
|
---|
3649 | * compiling kernel code.
|
---|
3650 | */
|
---|
3651 | #if defined(RT_OS_DARWIN) \
|
---|
3652 | && !defined(KERNEL) \
|
---|
3653 | && !defined(RT_NO_BSD_PARAM_H_UNDEFING) \
|
---|
3654 | && ( defined(_SYS_PARAM_H_) || defined(_I386_PARAM_H_) )
|
---|
3655 | /* sys/param.h: */
|
---|
3656 | # undef PSWP
|
---|
3657 | # undef PVM
|
---|
3658 | # undef PINOD
|
---|
3659 | # undef PRIBO
|
---|
3660 | # undef PVFS
|
---|
3661 | # undef PZERO
|
---|
3662 | # undef PSOCK
|
---|
3663 | # undef PWAIT
|
---|
3664 | # undef PLOCK
|
---|
3665 | # undef PPAUSE
|
---|
3666 | # undef PUSER
|
---|
3667 | # undef PRIMASK
|
---|
3668 | # undef MINBUCKET
|
---|
3669 | # undef MAXALLOCSAVE
|
---|
3670 | # undef FSHIFT
|
---|
3671 | # undef FSCALE
|
---|
3672 |
|
---|
3673 | /* i386/machine.h: */
|
---|
3674 | # undef ALIGN
|
---|
3675 | # undef ALIGNBYTES
|
---|
3676 | # undef DELAY
|
---|
3677 | # undef STATUS_WORD
|
---|
3678 | # undef USERMODE
|
---|
3679 | # undef BASEPRI
|
---|
3680 | # undef MSIZE
|
---|
3681 | # undef CLSIZE
|
---|
3682 | # undef CLSIZELOG2
|
---|
3683 | #endif
|
---|
3684 |
|
---|
3685 | /** @def NIL_OFFSET
|
---|
3686 | * NIL offset.
|
---|
3687 | * Whenever we use offsets instead of pointers to save space and relocation effort
|
---|
3688 | * NIL_OFFSET shall be used as the equivalent to NULL.
|
---|
3689 | */
|
---|
3690 | #define NIL_OFFSET (~0U)
|
---|
3691 |
|
---|
3692 |
|
---|
3693 | /** @def NOREF
|
---|
3694 | * Keeps the compiler from bitching about an unused parameter, local variable,
|
---|
3695 | * or other stuff, will never use _Pragma are is thus more flexible.
|
---|
3696 | */
|
---|
3697 | #define NOREF(var) (void)(var)
|
---|
3698 |
|
---|
3699 | /** @def RT_NOREF_PV
|
---|
3700 | * Keeps the compiler from bitching about an unused parameter or local variable.
|
---|
3701 | * This one cannot be used with structure members and such, like for instance
|
---|
3702 | * AssertRC may end up doing due to its generic nature.
|
---|
3703 | */
|
---|
3704 | #if defined(__cplusplus) && RT_CLANG_PREREQ(6, 0)
|
---|
3705 | # define RT_NOREF_PV(var) _Pragma(RT_STR(unused(var)))
|
---|
3706 | #else
|
---|
3707 | # define RT_NOREF_PV(var) (void)(var)
|
---|
3708 | #endif
|
---|
3709 |
|
---|
3710 | /** @def RT_NOREF1
|
---|
3711 | * RT_NOREF_PV shorthand taking on parameter. */
|
---|
3712 | #define RT_NOREF1(var1) RT_NOREF_PV(var1)
|
---|
3713 | /** @def RT_NOREF2
|
---|
3714 | * RT_NOREF_PV shorthand taking two parameters. */
|
---|
3715 | #define RT_NOREF2(var1, var2) RT_NOREF_PV(var1); RT_NOREF1(var2)
|
---|
3716 | /** @def RT_NOREF3
|
---|
3717 | * RT_NOREF_PV shorthand taking three parameters. */
|
---|
3718 | #define RT_NOREF3(var1, var2, var3) RT_NOREF_PV(var1); RT_NOREF2(var2, var3)
|
---|
3719 | /** @def RT_NOREF4
|
---|
3720 | * RT_NOREF_PV shorthand taking four parameters. */
|
---|
3721 | #define RT_NOREF4(var1, var2, var3, var4) RT_NOREF_PV(var1); RT_NOREF3(var2, var3, var4)
|
---|
3722 | /** @def RT_NOREF5
|
---|
3723 | * RT_NOREF_PV shorthand taking five parameters. */
|
---|
3724 | #define RT_NOREF5(var1, var2, var3, var4, var5) RT_NOREF_PV(var1); RT_NOREF4(var2, var3, var4, var5)
|
---|
3725 | /** @def RT_NOREF6
|
---|
3726 | * RT_NOREF_PV shorthand taking six parameters. */
|
---|
3727 | #define RT_NOREF6(var1, var2, var3, var4, var5, var6) RT_NOREF_PV(var1); RT_NOREF5(var2, var3, var4, var5, var6)
|
---|
3728 | /** @def RT_NOREF7
|
---|
3729 | * RT_NOREF_PV shorthand taking seven parameters. */
|
---|
3730 | #define RT_NOREF7(var1, var2, var3, var4, var5, var6, var7) \
|
---|
3731 | RT_NOREF_PV(var1); RT_NOREF6(var2, var3, var4, var5, var6, var7)
|
---|
3732 | /** @def RT_NOREF8
|
---|
3733 | * RT_NOREF_PV shorthand taking eight parameters. */
|
---|
3734 | #define RT_NOREF8(var1, var2, var3, var4, var5, var6, var7, var8) \
|
---|
3735 | RT_NOREF_PV(var1); RT_NOREF7(var2, var3, var4, var5, var6, var7, var8)
|
---|
3736 | /** @def RT_NOREF9
|
---|
3737 | * RT_NOREF_PV shorthand taking nine parameters. */
|
---|
3738 | #define RT_NOREF9(var1, var2, var3, var4, var5, var6, var7, var8, var9) \
|
---|
3739 | RT_NOREF_PV(var1); RT_NOREF8(var2, var3, var4, var5, var6, var7, var8, var9)
|
---|
3740 | /** @def RT_NOREF10
|
---|
3741 | * RT_NOREF_PV shorthand taking ten parameters. */
|
---|
3742 | #define RT_NOREF10(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10) \
|
---|
3743 | RT_NOREF_PV(var1); RT_NOREF_PV(var2); RT_NOREF_PV(var3); RT_NOREF_PV(var4); RT_NOREF_PV(var5); RT_NOREF_PV(var6); \
|
---|
3744 | RT_NOREF_PV(var7); RT_NOREF_PV(var8); RT_NOREF_PV(var9); RT_NOREF_PV(var10)
|
---|
3745 | /** @def RT_NOREF11
|
---|
3746 | * RT_NOREF_PV shorthand taking eleven parameters. */
|
---|
3747 | #define RT_NOREF11(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11) \
|
---|
3748 | RT_NOREF_PV(var1); RT_NOREF10(var2, var3, var4, var5, var6, var7, var8, var9, var10, var11)
|
---|
3749 | /** @def RT_NOREF12
|
---|
3750 | * RT_NOREF_PV shorthand taking twelve parameters. */
|
---|
3751 | #define RT_NOREF12(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12) \
|
---|
3752 | RT_NOREF_PV(var1); RT_NOREF11(var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12)
|
---|
3753 | /** @def RT_NOREF13
|
---|
3754 | * RT_NOREF_PV shorthand taking thirteen parameters. */
|
---|
3755 | #define RT_NOREF13(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13) \
|
---|
3756 | RT_NOREF_PV(var1); RT_NOREF12(var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13)
|
---|
3757 | /** @def RT_NOREF14
|
---|
3758 | * RT_NOREF_PV shorthand taking fourteen parameters. */
|
---|
3759 | #define RT_NOREF14(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13, var14) \
|
---|
3760 | RT_NOREF_PV(var1); RT_NOREF13(var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13, var14)
|
---|
3761 | /** @def RT_NOREF15
|
---|
3762 | * RT_NOREF_PV shorthand taking fifteen parameters. */
|
---|
3763 | #define RT_NOREF15(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13, var14, var15) \
|
---|
3764 | RT_NOREF_PV(var1); RT_NOREF14(var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13, var14, var15)
|
---|
3765 | /** @def RT_NOREF16
|
---|
3766 | * RT_NOREF_PV shorthand taking fifteen parameters. */
|
---|
3767 | #define RT_NOREF16(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13, var14, var15, var16) \
|
---|
3768 | RT_NOREF_PV(var1); RT_NOREF15(var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13, var14, var15, var16)
|
---|
3769 | /** @def RT_NOREF17
|
---|
3770 | * RT_NOREF_PV shorthand taking seventeen parameters. */
|
---|
3771 | #define RT_NOREF17(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) \
|
---|
3772 | RT_NOREF_PV(v1); RT_NOREF16(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17)
|
---|
3773 | /** @def RT_NOREF18
|
---|
3774 | * RT_NOREF_PV shorthand taking eighteen parameters. */
|
---|
3775 | #define RT_NOREF18(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) \
|
---|
3776 | RT_NOREF_PV(v1); RT_NOREF17(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18)
|
---|
3777 | /** @def RT_NOREF19
|
---|
3778 | * RT_NOREF_PV shorthand taking nineteen parameters. */
|
---|
3779 | #define RT_NOREF19(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) \
|
---|
3780 | RT_NOREF_PV(v1); RT_NOREF18(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19)
|
---|
3781 | /** @def RT_NOREF20
|
---|
3782 | * RT_NOREF_PV shorthand taking twenty parameters. */
|
---|
3783 | #define RT_NOREF20(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) \
|
---|
3784 | RT_NOREF_PV(v1); RT_NOREF19(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20)
|
---|
3785 | /** @def RT_NOREF21
|
---|
3786 | * RT_NOREF_PV shorthand taking twentyone parameters. */
|
---|
3787 | #define RT_NOREF21(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) \
|
---|
3788 | RT_NOREF_PV(v1); RT_NOREF20(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21)
|
---|
3789 | /** @def RT_NOREF22
|
---|
3790 | * RT_NOREF_PV shorthand taking twentytwo parameters. */
|
---|
3791 | #define RT_NOREF22(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) \
|
---|
3792 | RT_NOREF_PV(v1); RT_NOREF21(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22)
|
---|
3793 |
|
---|
3794 | /** @def RT_NOREF
|
---|
3795 | * RT_NOREF_PV variant using the variadic macro feature of C99.
|
---|
3796 | * @remarks Only use this in sources */
|
---|
3797 | #ifdef RT_COMPILER_SUPPORTS_VA_ARGS
|
---|
3798 | # define RT_NOREF(...) \
|
---|
3799 | RT_UNPACK_CALL(RT_CONCAT(RT_NOREF, RT_EXPAND(RT_COUNT_VA_ARGS(__VA_ARGS__))),(__VA_ARGS__))
|
---|
3800 | #endif
|
---|
3801 |
|
---|
3802 |
|
---|
3803 | /** @def RT_BREAKPOINT
|
---|
3804 | * Emit a debug breakpoint instruction.
|
---|
3805 | *
|
---|
3806 | * @remarks In the x86/amd64 gnu world we add a nop instruction after the int3
|
---|
3807 | * to force gdb to remain at the int3 source line.
|
---|
3808 | * @remarks The L4 kernel will try make sense of the breakpoint, thus the jmp on
|
---|
3809 | * x86/amd64.
|
---|
3810 | */
|
---|
3811 | #ifdef __GNUC__
|
---|
3812 | # if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
|
---|
3813 | # if !defined(__L4ENV__)
|
---|
3814 | # define RT_BREAKPOINT() __asm__ __volatile__("int $3\n\tnop\n\t")
|
---|
3815 | # else
|
---|
3816 | # define RT_BREAKPOINT() __asm__ __volatile__("int3; jmp 1f; 1:\n\t")
|
---|
3817 | # endif
|
---|
3818 | # elif defined(RT_ARCH_SPARC64)
|
---|
3819 | # define RT_BREAKPOINT() __asm__ __volatile__("illtrap 0\n\t") /** @todo Sparc64: this is just a wild guess. */
|
---|
3820 | # elif defined(RT_ARCH_SPARC)
|
---|
3821 | # define RT_BREAKPOINT() __asm__ __volatile__("unimp 0\n\t") /** @todo Sparc: this is just a wild guess (same as Sparc64, just different name). */
|
---|
3822 | # endif
|
---|
3823 | #endif
|
---|
3824 | #ifdef _MSC_VER
|
---|
3825 | # define RT_BREAKPOINT() __debugbreak()
|
---|
3826 | #endif
|
---|
3827 | #if defined(__IBMC__) || defined(__IBMCPP__)
|
---|
3828 | # define RT_BREAKPOINT() __interrupt(3)
|
---|
3829 | #endif
|
---|
3830 | #if defined(__WATCOMC__)
|
---|
3831 | # define RT_BREAKPOINT() _asm { int 3 }
|
---|
3832 | #endif
|
---|
3833 | #ifndef RT_BREAKPOINT
|
---|
3834 | # error "This compiler/arch is not supported!"
|
---|
3835 | #endif
|
---|
3836 |
|
---|
3837 |
|
---|
3838 | /** @defgroup grp_rt_cdefs_size Size Constants
|
---|
3839 | * (Of course, these are binary computer terms, not SI.)
|
---|
3840 | * @{
|
---|
3841 | */
|
---|
3842 | /** 1 K (Kilo) (1 024). */
|
---|
3843 | #define _1K 0x00000400
|
---|
3844 | /** 2 K (Kilo) (2 048). */
|
---|
3845 | #define _2K 0x00000800
|
---|
3846 | /** 4 K (Kilo) (4 096). */
|
---|
3847 | #define _4K 0x00001000
|
---|
3848 | /** 8 K (Kilo) (8 192). */
|
---|
3849 | #define _8K 0x00002000
|
---|
3850 | /** 16 K (Kilo) (16 384). */
|
---|
3851 | #define _16K 0x00004000
|
---|
3852 | /** 32 K (Kilo) (32 768). */
|
---|
3853 | #define _32K 0x00008000
|
---|
3854 | /** 64 K (Kilo) (65 536). */
|
---|
3855 | #if ARCH_BITS != 16
|
---|
3856 | # define _64K 0x00010000
|
---|
3857 | #else
|
---|
3858 | # define _64K UINT32_C(0x00010000)
|
---|
3859 | #endif
|
---|
3860 | /** 128 K (Kilo) (131 072). */
|
---|
3861 | #if ARCH_BITS != 16
|
---|
3862 | # define _128K 0x00020000
|
---|
3863 | #else
|
---|
3864 | # define _128K UINT32_C(0x00020000)
|
---|
3865 | #endif
|
---|
3866 | /** 256 K (Kilo) (262 144). */
|
---|
3867 | #if ARCH_BITS != 16
|
---|
3868 | # define _256K 0x00040000
|
---|
3869 | #else
|
---|
3870 | # define _256K UINT32_C(0x00040000)
|
---|
3871 | #endif
|
---|
3872 | /** 512 K (Kilo) (524 288). */
|
---|
3873 | #if ARCH_BITS != 16
|
---|
3874 | # define _512K 0x00080000
|
---|
3875 | #else
|
---|
3876 | # define _512K UINT32_C(0x00080000)
|
---|
3877 | #endif
|
---|
3878 | /** 1 M (Mega) (1 048 576). */
|
---|
3879 | #if ARCH_BITS != 16
|
---|
3880 | # define _1M 0x00100000
|
---|
3881 | #else
|
---|
3882 | # define _1M UINT32_C(0x00100000)
|
---|
3883 | #endif
|
---|
3884 | /** 2 M (Mega) (2 097 152). */
|
---|
3885 | #if ARCH_BITS != 16
|
---|
3886 | # define _2M 0x00200000
|
---|
3887 | #else
|
---|
3888 | # define _2M UINT32_C(0x00200000)
|
---|
3889 | #endif
|
---|
3890 | /** 4 M (Mega) (4 194 304). */
|
---|
3891 | #if ARCH_BITS != 16
|
---|
3892 | # define _4M 0x00400000
|
---|
3893 | #else
|
---|
3894 | # define _4M UINT32_C(0x00400000)
|
---|
3895 | #endif
|
---|
3896 | /** 8 M (Mega) (8 388 608). */
|
---|
3897 | #define _8M UINT32_C(0x00800000)
|
---|
3898 | /** 16 M (Mega) (16 777 216). */
|
---|
3899 | #define _16M UINT32_C(0x01000000)
|
---|
3900 | /** 32 M (Mega) (33 554 432). */
|
---|
3901 | #define _32M UINT32_C(0x02000000)
|
---|
3902 | /** 64 M (Mega) (67 108 864). */
|
---|
3903 | #define _64M UINT32_C(0x04000000)
|
---|
3904 | /** 128 M (Mega) (134 217 728). */
|
---|
3905 | #define _128M UINT32_C(0x08000000)
|
---|
3906 | /** 256 M (Mega) (268 435 456). */
|
---|
3907 | #define _256M UINT32_C(0x10000000)
|
---|
3908 | /** 512 M (Mega) (536 870 912). */
|
---|
3909 | #define _512M UINT32_C(0x20000000)
|
---|
3910 | /** 1 G (Giga) (1 073 741 824). (32-bit) */
|
---|
3911 | #if ARCH_BITS != 16
|
---|
3912 | # define _1G 0x40000000
|
---|
3913 | #else
|
---|
3914 | # define _1G UINT32_C(0x40000000)
|
---|
3915 | #endif
|
---|
3916 | /** 1 G (Giga) (1 073 741 824). (64-bit) */
|
---|
3917 | #if ARCH_BITS != 16
|
---|
3918 | # define _1G64 0x40000000LL
|
---|
3919 | #else
|
---|
3920 | # define _1G64 UINT64_C(0x40000000)
|
---|
3921 | #endif
|
---|
3922 | /** 2 G (Giga) (2 147 483 648). (32-bit) */
|
---|
3923 | #define _2G32 UINT32_C(0x80000000)
|
---|
3924 | /** 2 G (Giga) (2 147 483 648). (64-bit) */
|
---|
3925 | #if ARCH_BITS != 16
|
---|
3926 | # define _2G 0x0000000080000000LL
|
---|
3927 | #else
|
---|
3928 | # define _2G UINT64_C(0x0000000080000000)
|
---|
3929 | #endif
|
---|
3930 | /** 4 G (Giga) (4 294 967 296). */
|
---|
3931 | #if ARCH_BITS != 16
|
---|
3932 | # define _4G 0x0000000100000000LL
|
---|
3933 | #else
|
---|
3934 | # define _4G UINT64_C(0x0000000100000000)
|
---|
3935 | #endif
|
---|
3936 | /** 1 T (Tera) (1 099 511 627 776). */
|
---|
3937 | #if ARCH_BITS != 16
|
---|
3938 | # define _1T 0x0000010000000000LL
|
---|
3939 | #else
|
---|
3940 | # define _1T UINT64_C(0x0000010000000000)
|
---|
3941 | #endif
|
---|
3942 | /** 1 P (Peta) (1 125 899 906 842 624). */
|
---|
3943 | #if ARCH_BITS != 16
|
---|
3944 | # define _1P 0x0004000000000000LL
|
---|
3945 | #else
|
---|
3946 | # define _1P UINT64_C(0x0004000000000000)
|
---|
3947 | #endif
|
---|
3948 | /** 1 E (Exa) (1 152 921 504 606 846 976). */
|
---|
3949 | #if ARCH_BITS != 16
|
---|
3950 | # define _1E 0x1000000000000000LL
|
---|
3951 | #else
|
---|
3952 | # define _1E UINT64_C(0x1000000000000000)
|
---|
3953 | #endif
|
---|
3954 | /** 2 E (Exa) (2 305 843 009 213 693 952). */
|
---|
3955 | #if ARCH_BITS != 16
|
---|
3956 | # define _2E 0x2000000000000000ULL
|
---|
3957 | #else
|
---|
3958 | # define _2E UINT64_C(0x2000000000000000)
|
---|
3959 | #endif
|
---|
3960 | /** @} */
|
---|
3961 |
|
---|
3962 | /** @defgroup grp_rt_cdefs_decimal_grouping Decimal Constant Grouping Macros
|
---|
3963 | * @{ */
|
---|
3964 | #define RT_D1(g1) g1
|
---|
3965 | #define RT_D2(g1, g2) g1#g2
|
---|
3966 | #define RT_D3(g1, g2, g3) g1#g2#g3
|
---|
3967 | #define RT_D4(g1, g2, g3, g4) g1#g2#g3#g4
|
---|
3968 | #define RT_D5(g1, g2, g3, g4, g5) g1#g2#g3#g4#g5
|
---|
3969 | #define RT_D6(g1, g2, g3, g4, g5, g6) g1#g2#g3#g4#g5#g6
|
---|
3970 | #define RT_D7(g1, g2, g3, g4, g5, g6, g7) g1#g2#g3#g4#g5#g6#g7
|
---|
3971 |
|
---|
3972 | #define RT_D1_U(g1) UINT32_C(g1)
|
---|
3973 | #define RT_D2_U(g1, g2) UINT32_C(g1#g2)
|
---|
3974 | #define RT_D3_U(g1, g2, g3) UINT32_C(g1#g2#g3)
|
---|
3975 | #define RT_D4_U(g1, g2, g3, g4) UINT64_C(g1#g2#g3#g4)
|
---|
3976 | #define RT_D5_U(g1, g2, g3, g4, g5) UINT64_C(g1#g2#g3#g4#g5)
|
---|
3977 | #define RT_D6_U(g1, g2, g3, g4, g5, g6) UINT64_C(g1#g2#g3#g4#g5#g6)
|
---|
3978 | #define RT_D7_U(g1, g2, g3, g4, g5, g6, g7) UINT64_C(g1#g2#g3#g4#g5#g6#g7)
|
---|
3979 |
|
---|
3980 | #define RT_D1_S(g1) INT32_C(g1)
|
---|
3981 | #define RT_D2_S(g1, g2) INT32_C(g1#g2)
|
---|
3982 | #define RT_D3_S(g1, g2, g3) INT32_C(g1#g2#g3)
|
---|
3983 | #define RT_D4_S(g1, g2, g3, g4) INT64_C(g1#g2#g3#g4)
|
---|
3984 | #define RT_D5_S(g1, g2, g3, g4, g5) INT64_C(g1#g2#g3#g4#g5)
|
---|
3985 | #define RT_D6_S(g1, g2, g3, g4, g5, g6) INT64_C(g1#g2#g3#g4#g5#g6)
|
---|
3986 | #define RT_D7_S(g1, g2, g3, g4, g5, g6, g7) INT64_C(g1#g2#g3#g4#g5#g6#g7)
|
---|
3987 |
|
---|
3988 | #define RT_D1_U32(g1) UINT32_C(g1)
|
---|
3989 | #define RT_D2_U32(g1, g2) UINT32_C(g1#g2)
|
---|
3990 | #define RT_D3_U32(g1, g2, g3) UINT32_C(g1#g2#g3)
|
---|
3991 | #define RT_D4_U32(g1, g2, g3, g4) UINT32_C(g1#g2#g3#g4)
|
---|
3992 |
|
---|
3993 | #define RT_D1_S32(g1) INT32_C(g1)
|
---|
3994 | #define RT_D2_S32(g1, g2) INT32_C(g1#g2)
|
---|
3995 | #define RT_D3_S32(g1, g2, g3) INT32_C(g1#g2#g3)
|
---|
3996 | #define RT_D4_S32(g1, g2, g3, g4) INT32_C(g1#g2#g3#g4)
|
---|
3997 |
|
---|
3998 | #define RT_D1_U64(g1) UINT64_C(g1)
|
---|
3999 | #define RT_D2_U64(g1, g2) UINT64_C(g1#g2)
|
---|
4000 | #define RT_D3_U64(g1, g2, g3) UINT64_C(g1#g2#g3)
|
---|
4001 | #define RT_D4_U64(g1, g2, g3, g4) UINT64_C(g1#g2#g3#g4)
|
---|
4002 | #define RT_D5_U64(g1, g2, g3, g4, g5) UINT64_C(g1#g2#g3#g4#g5)
|
---|
4003 | #define RT_D6_U64(g1, g2, g3, g4, g5, g6) UINT64_C(g1#g2#g3#g4#g5#g6)
|
---|
4004 | #define RT_D7_U64(g1, g2, g3, g4, g5, g6, g7) UINT64_C(g1#g2#g3#g4#g5#g6#g7)
|
---|
4005 |
|
---|
4006 | #define RT_D1_S64(g1) INT64_C(g1)
|
---|
4007 | #define RT_D2_S64(g1, g2) INT64_C(g1#g2)
|
---|
4008 | #define RT_D3_S64(g1, g2, g3) INT64_C(g1#g2#g3)
|
---|
4009 | #define RT_D4_S64(g1, g2, g3, g4) INT64_C(g1#g2#g3#g4)
|
---|
4010 | #define RT_D5_S64(g1, g2, g3, g4, g5) INT64_C(g1#g2#g3#g4#g5)
|
---|
4011 | #define RT_D6_S64(g1, g2, g3, g4, g5, g6) INT64_C(g1#g2#g3#g4#g5#g6)
|
---|
4012 | #define RT_D7_S64(g1, g2, g3, g4, g5, g6, g7) INT64_C(g1#g2#g3#g4#g5#g6#g7)
|
---|
4013 | /** @} */
|
---|
4014 |
|
---|
4015 |
|
---|
4016 | /** @defgroup grp_rt_cdefs_time Time Constants
|
---|
4017 | * @{
|
---|
4018 | */
|
---|
4019 | /** 1 hour expressed in nanoseconds (64-bit). */
|
---|
4020 | #define RT_NS_1HOUR UINT64_C(3600000000000)
|
---|
4021 | /** 30 minutes expressed in nanoseconds (64-bit). */
|
---|
4022 | #define RT_NS_30MIN UINT64_C(1800000000000)
|
---|
4023 | /** 5 minutes expressed in nanoseconds (64-bit). */
|
---|
4024 | #define RT_NS_5MIN UINT64_C(300000000000)
|
---|
4025 | /** 1 minute expressed in nanoseconds (64-bit). */
|
---|
4026 | #define RT_NS_1MIN UINT64_C(60000000000)
|
---|
4027 | /** 45 seconds expressed in nanoseconds (64-bit). */
|
---|
4028 | #define RT_NS_45SEC UINT64_C(45000000000)
|
---|
4029 | /** 30 seconds expressed in nanoseconds (64-bit). */
|
---|
4030 | #define RT_NS_30SEC UINT64_C(30000000000)
|
---|
4031 | /** 20 seconds expressed in nanoseconds (64-bit). */
|
---|
4032 | #define RT_NS_20SEC UINT64_C(20000000000)
|
---|
4033 | /** 15 seconds expressed in nanoseconds (64-bit). */
|
---|
4034 | #define RT_NS_15SEC UINT64_C(15000000000)
|
---|
4035 | /** 10 seconds expressed in nanoseconds (64-bit). */
|
---|
4036 | #define RT_NS_10SEC UINT64_C(10000000000)
|
---|
4037 | /** 1 second expressed in nanoseconds. */
|
---|
4038 | #define RT_NS_1SEC UINT32_C(1000000000)
|
---|
4039 | /** 100 millsecond expressed in nanoseconds. */
|
---|
4040 | #define RT_NS_100MS UINT32_C(100000000)
|
---|
4041 | /** 10 millsecond expressed in nanoseconds. */
|
---|
4042 | #define RT_NS_10MS UINT32_C(10000000)
|
---|
4043 | /** 8 millsecond expressed in nanoseconds. */
|
---|
4044 | #define RT_NS_8MS UINT32_C(8000000)
|
---|
4045 | /** 2 millsecond expressed in nanoseconds. */
|
---|
4046 | #define RT_NS_2MS UINT32_C(2000000)
|
---|
4047 | /** 1 millsecond expressed in nanoseconds. */
|
---|
4048 | #define RT_NS_1MS UINT32_C(1000000)
|
---|
4049 | /** 100 microseconds expressed in nanoseconds. */
|
---|
4050 | #define RT_NS_100US UINT32_C(100000)
|
---|
4051 | /** 10 microseconds expressed in nanoseconds. */
|
---|
4052 | #define RT_NS_10US UINT32_C(10000)
|
---|
4053 | /** 1 microsecond expressed in nanoseconds. */
|
---|
4054 | #define RT_NS_1US UINT32_C(1000)
|
---|
4055 |
|
---|
4056 | /** 1 second expressed in nanoseconds - 64-bit type. */
|
---|
4057 | #define RT_NS_1SEC_64 UINT64_C(1000000000)
|
---|
4058 | /** 100 millsecond expressed in nanoseconds - 64-bit type. */
|
---|
4059 | #define RT_NS_100MS_64 UINT64_C(100000000)
|
---|
4060 | /** 10 millsecond expressed in nanoseconds - 64-bit type. */
|
---|
4061 | #define RT_NS_10MS_64 UINT64_C(10000000)
|
---|
4062 | /** 1 millsecond expressed in nanoseconds - 64-bit type. */
|
---|
4063 | #define RT_NS_1MS_64 UINT64_C(1000000)
|
---|
4064 | /** 100 microseconds expressed in nanoseconds - 64-bit type. */
|
---|
4065 | #define RT_NS_100US_64 UINT64_C(100000)
|
---|
4066 | /** 10 microseconds expressed in nanoseconds - 64-bit type. */
|
---|
4067 | #define RT_NS_10US_64 UINT64_C(10000)
|
---|
4068 | /** 1 microsecond expressed in nanoseconds - 64-bit type. */
|
---|
4069 | #define RT_NS_1US_64 UINT64_C(1000)
|
---|
4070 |
|
---|
4071 | /** 1 hour expressed in microseconds. */
|
---|
4072 | #define RT_US_1HOUR UINT32_C(3600000000)
|
---|
4073 | /** 30 minutes expressed in microseconds. */
|
---|
4074 | #define RT_US_30MIN UINT32_C(1800000000)
|
---|
4075 | /** 5 minutes expressed in microseconds. */
|
---|
4076 | #define RT_US_5MIN UINT32_C(300000000)
|
---|
4077 | /** 1 minute expressed in microseconds. */
|
---|
4078 | #define RT_US_1MIN UINT32_C(60000000)
|
---|
4079 | /** 45 seconds expressed in microseconds. */
|
---|
4080 | #define RT_US_45SEC UINT32_C(45000000)
|
---|
4081 | /** 30 seconds expressed in microseconds. */
|
---|
4082 | #define RT_US_30SEC UINT32_C(30000000)
|
---|
4083 | /** 20 seconds expressed in microseconds. */
|
---|
4084 | #define RT_US_20SEC UINT32_C(20000000)
|
---|
4085 | /** 15 seconds expressed in microseconds. */
|
---|
4086 | #define RT_US_15SEC UINT32_C(15000000)
|
---|
4087 | /** 10 seconds expressed in microseconds. */
|
---|
4088 | #define RT_US_10SEC UINT32_C(10000000)
|
---|
4089 | /** 5 seconds expressed in microseconds. */
|
---|
4090 | #define RT_US_5SEC UINT32_C(5000000)
|
---|
4091 | /** 1 second expressed in microseconds. */
|
---|
4092 | #define RT_US_1SEC UINT32_C(1000000)
|
---|
4093 | /** 100 millsecond expressed in microseconds. */
|
---|
4094 | #define RT_US_100MS UINT32_C(100000)
|
---|
4095 | /** 10 millsecond expressed in microseconds. */
|
---|
4096 | #define RT_US_10MS UINT32_C(10000)
|
---|
4097 | /** 1 millsecond expressed in microseconds. */
|
---|
4098 | #define RT_US_1MS UINT32_C(1000)
|
---|
4099 |
|
---|
4100 | /** 1 hour expressed in microseconds - 64-bit type. */
|
---|
4101 | #define RT_US_1HOUR_64 UINT64_C(3600000000)
|
---|
4102 | /** 30 minutes expressed in microseconds - 64-bit type. */
|
---|
4103 | #define RT_US_30MIN_64 UINT64_C(1800000000)
|
---|
4104 | /** 5 minutes expressed in microseconds - 64-bit type. */
|
---|
4105 | #define RT_US_5MIN_64 UINT64_C(300000000)
|
---|
4106 | /** 1 minute expressed in microseconds - 64-bit type. */
|
---|
4107 | #define RT_US_1MIN_64 UINT64_C(60000000)
|
---|
4108 | /** 45 seconds expressed in microseconds - 64-bit type. */
|
---|
4109 | #define RT_US_45SEC_64 UINT64_C(45000000)
|
---|
4110 | /** 30 seconds expressed in microseconds - 64-bit type. */
|
---|
4111 | #define RT_US_30SEC_64 UINT64_C(30000000)
|
---|
4112 | /** 20 seconds expressed in microseconds - 64-bit type. */
|
---|
4113 | #define RT_US_20SEC_64 UINT64_C(20000000)
|
---|
4114 | /** 15 seconds expressed in microseconds - 64-bit type. */
|
---|
4115 | #define RT_US_15SEC_64 UINT64_C(15000000)
|
---|
4116 | /** 10 seconds expressed in microseconds - 64-bit type. */
|
---|
4117 | #define RT_US_10SEC_64 UINT64_C(10000000)
|
---|
4118 | /** 5 seconds expressed in microseconds - 64-bit type. */
|
---|
4119 | #define RT_US_5SEC_64 UINT64_C(5000000)
|
---|
4120 | /** 1 second expressed in microseconds - 64-bit type. */
|
---|
4121 | #define RT_US_1SEC_64 UINT64_C(1000000)
|
---|
4122 | /** 100 millsecond expressed in microseconds - 64-bit type. */
|
---|
4123 | #define RT_US_100MS_64 UINT64_C(100000)
|
---|
4124 | /** 10 millsecond expressed in microseconds - 64-bit type. */
|
---|
4125 | #define RT_US_10MS_64 UINT64_C(10000)
|
---|
4126 | /** 1 millsecond expressed in microseconds - 64-bit type. */
|
---|
4127 | #define RT_US_1MS_64 UINT64_C(1000)
|
---|
4128 |
|
---|
4129 | /** 1 hour expressed in milliseconds. */
|
---|
4130 | #define RT_MS_1HOUR UINT32_C(3600000)
|
---|
4131 | /** 30 minutes expressed in milliseconds. */
|
---|
4132 | #define RT_MS_30MIN UINT32_C(1800000)
|
---|
4133 | /** 5 minutes expressed in milliseconds. */
|
---|
4134 | #define RT_MS_5MIN UINT32_C(300000)
|
---|
4135 | /** 1 minute expressed in milliseconds. */
|
---|
4136 | #define RT_MS_1MIN UINT32_C(60000)
|
---|
4137 | /** 45 seconds expressed in milliseconds. */
|
---|
4138 | #define RT_MS_45SEC UINT32_C(45000)
|
---|
4139 | /** 30 seconds expressed in milliseconds. */
|
---|
4140 | #define RT_MS_30SEC UINT32_C(30000)
|
---|
4141 | /** 20 seconds expressed in milliseconds. */
|
---|
4142 | #define RT_MS_20SEC UINT32_C(20000)
|
---|
4143 | /** 15 seconds expressed in milliseconds. */
|
---|
4144 | #define RT_MS_15SEC UINT32_C(15000)
|
---|
4145 | /** 10 seconds expressed in milliseconds. */
|
---|
4146 | #define RT_MS_10SEC UINT32_C(10000)
|
---|
4147 | /** 5 seconds expressed in milliseconds. */
|
---|
4148 | #define RT_MS_5SEC UINT32_C(5000)
|
---|
4149 | /** 1 second expressed in milliseconds. */
|
---|
4150 | #define RT_MS_1SEC UINT32_C(1000)
|
---|
4151 |
|
---|
4152 | /** 1 hour expressed in milliseconds - 64-bit type. */
|
---|
4153 | #define RT_MS_1HOUR_64 UINT64_C(3600000)
|
---|
4154 | /** 30 minutes expressed in milliseconds - 64-bit type. */
|
---|
4155 | #define RT_MS_30MIN_64 UINT64_C(1800000)
|
---|
4156 | /** 5 minutes expressed in milliseconds - 64-bit type. */
|
---|
4157 | #define RT_MS_5MIN_64 UINT64_C(300000)
|
---|
4158 | /** 1 minute expressed in milliseconds - 64-bit type. */
|
---|
4159 | #define RT_MS_1MIN_64 UINT64_C(60000)
|
---|
4160 | /** 45 seconds expressed in milliseconds - 64-bit type. */
|
---|
4161 | #define RT_MS_45SEC_64 UINT64_C(45000)
|
---|
4162 | /** 30 seconds expressed in milliseconds - 64-bit type. */
|
---|
4163 | #define RT_MS_30SEC_64 UINT64_C(30000)
|
---|
4164 | /** 20 seconds expressed in milliseconds - 64-bit type. */
|
---|
4165 | #define RT_MS_20SEC_64 UINT64_C(20000)
|
---|
4166 | /** 15 seconds expressed in milliseconds - 64-bit type. */
|
---|
4167 | #define RT_MS_15SEC_64 UINT64_C(15000)
|
---|
4168 | /** 10 seconds expressed in milliseconds - 64-bit type. */
|
---|
4169 | #define RT_MS_10SEC_64 UINT64_C(10000)
|
---|
4170 | /** 5 seconds expressed in milliseconds - 64-bit type. */
|
---|
4171 | #define RT_MS_5SEC_64 UINT64_C(5000)
|
---|
4172 | /** 1 second expressed in milliseconds - 64-bit type. */
|
---|
4173 | #define RT_MS_1SEC_64 UINT64_C(1000)
|
---|
4174 |
|
---|
4175 | /** The number of seconds per week. */
|
---|
4176 | #define RT_SEC_1WEEK UINT32_C(604800)
|
---|
4177 | /** The number of seconds per day. */
|
---|
4178 | #define RT_SEC_1DAY UINT32_C(86400)
|
---|
4179 | /** The number of seconds per hour. */
|
---|
4180 | #define RT_SEC_1HOUR UINT32_C(3600)
|
---|
4181 |
|
---|
4182 | /** The number of seconds per week - 64-bit type. */
|
---|
4183 | #define RT_SEC_1WEEK_64 UINT64_C(604800)
|
---|
4184 | /** The number of seconds per day - 64-bit type. */
|
---|
4185 | #define RT_SEC_1DAY_64 UINT64_C(86400)
|
---|
4186 | /** The number of seconds per hour - 64-bit type. */
|
---|
4187 | #define RT_SEC_1HOUR_64 UINT64_C(3600)
|
---|
4188 | /** @} */
|
---|
4189 |
|
---|
4190 |
|
---|
4191 | /** @defgroup grp_rt_cdefs_dbgtype Debug Info Types
|
---|
4192 | * @{ */
|
---|
4193 | /** Other format. */
|
---|
4194 | #define RT_DBGTYPE_OTHER RT_BIT_32(0)
|
---|
4195 | /** Stabs. */
|
---|
4196 | #define RT_DBGTYPE_STABS RT_BIT_32(1)
|
---|
4197 | /** Debug With Arbitrary Record Format (DWARF). */
|
---|
4198 | #define RT_DBGTYPE_DWARF RT_BIT_32(2)
|
---|
4199 | /** Microsoft Codeview debug info. */
|
---|
4200 | #define RT_DBGTYPE_CODEVIEW RT_BIT_32(3)
|
---|
4201 | /** Watcom debug info. */
|
---|
4202 | #define RT_DBGTYPE_WATCOM RT_BIT_32(4)
|
---|
4203 | /** IBM High Level Language debug info. */
|
---|
4204 | #define RT_DBGTYPE_HLL RT_BIT_32(5)
|
---|
4205 | /** Old OS/2 and Windows symbol file. */
|
---|
4206 | #define RT_DBGTYPE_SYM RT_BIT_32(6)
|
---|
4207 | /** Map file. */
|
---|
4208 | #define RT_DBGTYPE_MAP RT_BIT_32(7)
|
---|
4209 | /** @} */
|
---|
4210 |
|
---|
4211 |
|
---|
4212 | /** @defgroup grp_rt_cdefs_exetype Executable Image Types
|
---|
4213 | * @{ */
|
---|
4214 | /** Some other format. */
|
---|
4215 | #define RT_EXETYPE_OTHER RT_BIT_32(0)
|
---|
4216 | /** Portable Executable. */
|
---|
4217 | #define RT_EXETYPE_PE RT_BIT_32(1)
|
---|
4218 | /** Linear eXecutable. */
|
---|
4219 | #define RT_EXETYPE_LX RT_BIT_32(2)
|
---|
4220 | /** Linear Executable. */
|
---|
4221 | #define RT_EXETYPE_LE RT_BIT_32(3)
|
---|
4222 | /** New Executable. */
|
---|
4223 | #define RT_EXETYPE_NE RT_BIT_32(4)
|
---|
4224 | /** DOS Executable (Mark Zbikowski). */
|
---|
4225 | #define RT_EXETYPE_MZ RT_BIT_32(5)
|
---|
4226 | /** COM Executable. */
|
---|
4227 | #define RT_EXETYPE_COM RT_BIT_32(6)
|
---|
4228 | /** a.out Executable. */
|
---|
4229 | #define RT_EXETYPE_AOUT RT_BIT_32(7)
|
---|
4230 | /** Executable and Linkable Format. */
|
---|
4231 | #define RT_EXETYPE_ELF RT_BIT_32(8)
|
---|
4232 | /** Mach-O Executable (including FAT ones). */
|
---|
4233 | #define RT_EXETYPE_MACHO RT_BIT_32(9)
|
---|
4234 | /** TE from UEFI. */
|
---|
4235 | #define RT_EXETYPE_TE RT_BIT_32(9)
|
---|
4236 | /** @} */
|
---|
4237 |
|
---|
4238 |
|
---|
4239 | /** @def VALID_PTR
|
---|
4240 | * Pointer validation macro.
|
---|
4241 | * @param ptr The pointer.
|
---|
4242 | */
|
---|
4243 | #if defined(RT_ARCH_AMD64)
|
---|
4244 | # ifdef IN_RING3
|
---|
4245 | # if defined(RT_OS_DARWIN) /* first 4GB is reserved for legacy kernel. */
|
---|
4246 | # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) >= _4G \
|
---|
4247 | && !((uintptr_t)(ptr) & 0xffff800000000000ULL) )
|
---|
4248 | # elif defined(RT_OS_SOLARIS) /* The kernel only used the top 2TB, but keep it simple. */
|
---|
4249 | # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
|
---|
4250 | && ( ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0xffff800000000000ULL \
|
---|
4251 | || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) )
|
---|
4252 | # else
|
---|
4253 | # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
|
---|
4254 | && !((uintptr_t)(ptr) & 0xffff800000000000ULL) )
|
---|
4255 | # endif
|
---|
4256 | # else /* !IN_RING3 */
|
---|
4257 | # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
|
---|
4258 | && ( ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0xffff800000000000ULL \
|
---|
4259 | || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) )
|
---|
4260 | # endif /* !IN_RING3 */
|
---|
4261 |
|
---|
4262 | #elif defined(RT_ARCH_X86)
|
---|
4263 | # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U )
|
---|
4264 |
|
---|
4265 | #elif defined(RT_ARCH_SPARC64)
|
---|
4266 | # ifdef IN_RING3
|
---|
4267 | # if defined(RT_OS_SOLARIS)
|
---|
4268 | /** Sparc64 user mode: According to Figure 9.4 in solaris internals */
|
---|
4269 | /** @todo # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x80004000U >= 0x80004000U + 0x100000000ULL ) - figure this. */
|
---|
4270 | # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x80000000U >= 0x80000000U + 0x100000000ULL )
|
---|
4271 | # else
|
---|
4272 | # error "Port me"
|
---|
4273 | # endif
|
---|
4274 | # else /* !IN_RING3 */
|
---|
4275 | # if defined(RT_OS_SOLARIS)
|
---|
4276 | /** @todo Sparc64 kernel mode: This is according to Figure 11.1 in solaris
|
---|
4277 | * internals. Verify in sources. */
|
---|
4278 | # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) >= 0x01000000U )
|
---|
4279 | # else
|
---|
4280 | # error "Port me"
|
---|
4281 | # endif
|
---|
4282 | # endif /* !IN_RING3 */
|
---|
4283 |
|
---|
4284 | #elif defined(RT_ARCH_SPARC)
|
---|
4285 | # ifdef IN_RING3
|
---|
4286 | # ifdef RT_OS_SOLARIS
|
---|
4287 | /** Sparc user mode: According to
|
---|
4288 | * http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/sun4/os/startup.c#510 */
|
---|
4289 | # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x400000U >= 0x400000U + 0x2000U )
|
---|
4290 |
|
---|
4291 | # else
|
---|
4292 | # error "Port me"
|
---|
4293 | # endif
|
---|
4294 | # else /* !IN_RING3 */
|
---|
4295 | # ifdef RT_OS_SOLARIS
|
---|
4296 | /** @todo Sparc kernel mode: Check the sources! */
|
---|
4297 | # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U )
|
---|
4298 | # else
|
---|
4299 | # error "Port me"
|
---|
4300 | # endif
|
---|
4301 | # endif /* !IN_RING3 */
|
---|
4302 |
|
---|
4303 | #elif defined(RT_ARCH_ARM)
|
---|
4304 | /* ASSUMES that at least the last and first 4K are out of bounds. */
|
---|
4305 | # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U )
|
---|
4306 |
|
---|
4307 | #else
|
---|
4308 | # error "Architecture identifier missing / not implemented."
|
---|
4309 | #endif
|
---|
4310 |
|
---|
4311 | /** Old name for RT_VALID_PTR. */
|
---|
4312 | #define VALID_PTR(ptr) RT_VALID_PTR(ptr)
|
---|
4313 |
|
---|
4314 | /** @def RT_VALID_ALIGNED_PTR
|
---|
4315 | * Pointer validation macro that also checks the alignment.
|
---|
4316 | * @param ptr The pointer.
|
---|
4317 | * @param align The alignment, must be a power of two.
|
---|
4318 | */
|
---|
4319 | #define RT_VALID_ALIGNED_PTR(ptr, align) \
|
---|
4320 | ( !((uintptr_t)(ptr) & (uintptr_t)((align) - 1)) \
|
---|
4321 | && VALID_PTR(ptr) )
|
---|
4322 |
|
---|
4323 |
|
---|
4324 | /** @def VALID_PHYS32
|
---|
4325 | * 32 bits physical address validation macro.
|
---|
4326 | * @param Phys The RTGCPHYS address.
|
---|
4327 | */
|
---|
4328 | #define VALID_PHYS32(Phys) ( (uint64_t)(Phys) < (uint64_t)_4G )
|
---|
4329 |
|
---|
4330 | /** @def N_
|
---|
4331 | * The \#define N_ is used to mark a string for translation. This is usable in
|
---|
4332 | * any part of the code, as it is only used by the tools that create message
|
---|
4333 | * catalogs. This macro is a no-op as far as the compiler and code generation
|
---|
4334 | * is concerned.
|
---|
4335 | *
|
---|
4336 | * If you want to both mark a string for translation and translate it, use _().
|
---|
4337 | */
|
---|
4338 | #define N_(s) (s)
|
---|
4339 |
|
---|
4340 | /** @def _
|
---|
4341 | * The \#define _ is used to mark a string for translation and to translate it
|
---|
4342 | * in one step.
|
---|
4343 | *
|
---|
4344 | * If you want to only mark a string for translation, use N_().
|
---|
4345 | */
|
---|
4346 | #define _(s) gettext(s)
|
---|
4347 |
|
---|
4348 |
|
---|
4349 | #if (!defined(__GNUC__) && !defined(__PRETTY_FUNCTION__)) || defined(DOXYGEN_RUNNING)
|
---|
4350 | # if defined(_MSC_VER) || defined(DOXYGEN_RUNNING)
|
---|
4351 | /** With GNU C we'd like to use the builtin __PRETTY_FUNCTION__, so define that
|
---|
4352 | * for the other compilers. */
|
---|
4353 | # define __PRETTY_FUNCTION__ __FUNCSIG__
|
---|
4354 | # else
|
---|
4355 | # define __PRETTY_FUNCTION__ __FUNCTION__
|
---|
4356 | # endif
|
---|
4357 | #endif
|
---|
4358 |
|
---|
4359 |
|
---|
4360 | /** @def RT_STRICT
|
---|
4361 | * The \#define RT_STRICT controls whether or not assertions and other runtime
|
---|
4362 | * checks should be compiled in or not. This is defined when DEBUG is defined.
|
---|
4363 | * If RT_NO_STRICT is defined, it will unconditionally be undefined.
|
---|
4364 | *
|
---|
4365 | * If you want assertions which are not subject to compile time options use
|
---|
4366 | * the AssertRelease*() flavors.
|
---|
4367 | */
|
---|
4368 | #if !defined(RT_STRICT) && defined(DEBUG)
|
---|
4369 | # define RT_STRICT
|
---|
4370 | #endif
|
---|
4371 | #ifdef RT_NO_STRICT
|
---|
4372 | # undef RT_STRICT
|
---|
4373 | #endif
|
---|
4374 |
|
---|
4375 | /** @todo remove this: */
|
---|
4376 | #if !defined(RT_LOCK_STRICT) && !defined(DEBUG_bird)
|
---|
4377 | # define RT_LOCK_NO_STRICT
|
---|
4378 | #endif
|
---|
4379 | #if !defined(RT_LOCK_STRICT_ORDER) && !defined(DEBUG_bird)
|
---|
4380 | # define RT_LOCK_NO_STRICT_ORDER
|
---|
4381 | #endif
|
---|
4382 |
|
---|
4383 | /** @def RT_LOCK_STRICT
|
---|
4384 | * The \#define RT_LOCK_STRICT controls whether deadlock detection and related
|
---|
4385 | * checks are done in the lock and semaphore code. It is by default enabled in
|
---|
4386 | * RT_STRICT builds, but this behavior can be overridden by defining
|
---|
4387 | * RT_LOCK_NO_STRICT. */
|
---|
4388 | #if !defined(RT_LOCK_STRICT) && !defined(RT_LOCK_NO_STRICT) && defined(RT_STRICT)
|
---|
4389 | # define RT_LOCK_STRICT
|
---|
4390 | #endif
|
---|
4391 | /** @def RT_LOCK_NO_STRICT
|
---|
4392 | * The \#define RT_LOCK_NO_STRICT disables RT_LOCK_STRICT. */
|
---|
4393 | #if defined(RT_LOCK_NO_STRICT) && defined(RT_LOCK_STRICT)
|
---|
4394 | # undef RT_LOCK_STRICT
|
---|
4395 | #endif
|
---|
4396 |
|
---|
4397 | /** @def RT_LOCK_STRICT_ORDER
|
---|
4398 | * The \#define RT_LOCK_STRICT_ORDER controls whether locking order is checked
|
---|
4399 | * by the lock and semaphore code. It is by default enabled in RT_STRICT
|
---|
4400 | * builds, but this behavior can be overridden by defining
|
---|
4401 | * RT_LOCK_NO_STRICT_ORDER. */
|
---|
4402 | #if !defined(RT_LOCK_STRICT_ORDER) && !defined(RT_LOCK_NO_STRICT_ORDER) && defined(RT_STRICT)
|
---|
4403 | # define RT_LOCK_STRICT_ORDER
|
---|
4404 | #endif
|
---|
4405 | /** @def RT_LOCK_NO_STRICT_ORDER
|
---|
4406 | * The \#define RT_LOCK_NO_STRICT_ORDER disables RT_LOCK_STRICT_ORDER. */
|
---|
4407 | #if defined(RT_LOCK_NO_STRICT_ORDER) && defined(RT_LOCK_STRICT_ORDER)
|
---|
4408 | # undef RT_LOCK_STRICT_ORDER
|
---|
4409 | #endif
|
---|
4410 |
|
---|
4411 |
|
---|
4412 | /** Source position. */
|
---|
4413 | #define RT_SRC_POS __FILE__, __LINE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__
|
---|
4414 |
|
---|
4415 | /** Source position declaration. */
|
---|
4416 | #define RT_SRC_POS_DECL const char *pszFile, unsigned iLine, const char *pszFunction
|
---|
4417 |
|
---|
4418 | /** Source position arguments. */
|
---|
4419 | #define RT_SRC_POS_ARGS pszFile, iLine, pszFunction
|
---|
4420 |
|
---|
4421 | /** Applies NOREF() to the source position arguments. */
|
---|
4422 | #define RT_SRC_POS_NOREF() do { NOREF(pszFile); NOREF(iLine); NOREF(pszFunction); } while (0)
|
---|
4423 |
|
---|
4424 |
|
---|
4425 | /** @def RT_INLINE_ASM_EXTERNAL
|
---|
4426 | * Defined as 1 if the compiler does not support inline assembly.
|
---|
4427 | * The ASM* functions will then be implemented in external .asm files.
|
---|
4428 | */
|
---|
4429 | #if (defined(_MSC_VER) && defined(RT_ARCH_AMD64)) \
|
---|
4430 | || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86)) \
|
---|
4431 | || defined(__WATCOMC__)
|
---|
4432 | # define RT_INLINE_ASM_EXTERNAL 1
|
---|
4433 | #else
|
---|
4434 | # define RT_INLINE_ASM_EXTERNAL 0
|
---|
4435 | #endif
|
---|
4436 |
|
---|
4437 | /** @def RT_INLINE_ASM_GNU_STYLE
|
---|
4438 | * Defined as 1 if the compiler understands GNU style inline assembly.
|
---|
4439 | */
|
---|
4440 | #if defined(_MSC_VER) || defined(__WATCOMC__)
|
---|
4441 | # define RT_INLINE_ASM_GNU_STYLE 0
|
---|
4442 | #else
|
---|
4443 | # define RT_INLINE_ASM_GNU_STYLE 1
|
---|
4444 | #endif
|
---|
4445 |
|
---|
4446 | /** @def RT_INLINE_ASM_USES_INTRIN
|
---|
4447 | * Defined as the major MSC version if the compiler have and uses intrin.h.
|
---|
4448 | * Otherwise it is 0. */
|
---|
4449 | #ifdef _MSC_VER
|
---|
4450 | # if _MSC_VER >= 1700 /* Visual C++ v11.0 / 2012 */
|
---|
4451 | # define RT_INLINE_ASM_USES_INTRIN 17
|
---|
4452 | # elif _MSC_VER >= 1600 /* Visual C++ v10.0 / 2010 */
|
---|
4453 | # define RT_INLINE_ASM_USES_INTRIN 16
|
---|
4454 | # elif _MSC_VER >= 1500 /* Visual C++ v9.0 / 2008 */
|
---|
4455 | # define RT_INLINE_ASM_USES_INTRIN 15
|
---|
4456 | # elif _MSC_VER >= 1400 /* Visual C++ v8.0 / 2005 */
|
---|
4457 | # define RT_INLINE_ASM_USES_INTRIN 14
|
---|
4458 | # endif
|
---|
4459 | #endif
|
---|
4460 | #ifndef RT_INLINE_ASM_USES_INTRIN
|
---|
4461 | # define RT_INLINE_ASM_USES_INTRIN 0
|
---|
4462 | #endif
|
---|
4463 |
|
---|
4464 | /** @def RT_COMPILER_SUPPORTS_LAMBDA
|
---|
4465 | * If the defined, the compiler supports lambda expressions. These expressions
|
---|
4466 | * are useful for embedding assertions and type checks into macros. */
|
---|
4467 | #if defined(_MSC_VER) && defined(__cplusplus)
|
---|
4468 | # if _MSC_VER >= 1600 /* Visual C++ v10.0 / 2010 */
|
---|
4469 | # define RT_COMPILER_SUPPORTS_LAMBDA
|
---|
4470 | # endif
|
---|
4471 | #elif defined(__GNUC__) && defined(__cplusplus)
|
---|
4472 | /* 4.5 or later, I think, if in ++11 mode... */
|
---|
4473 | #endif
|
---|
4474 |
|
---|
4475 | /** @def RT_DATA_IS_FAR
|
---|
4476 | * Set to 1 if we're in 16-bit mode and use far pointers.
|
---|
4477 | */
|
---|
4478 | #if ARCH_BITS == 16 && defined(__WATCOMC__) \
|
---|
4479 | && (defined(__COMPACT__) || defined(__LARGE__))
|
---|
4480 | # define RT_DATA_IS_FAR 1
|
---|
4481 | #else
|
---|
4482 | # define RT_DATA_IS_FAR 0
|
---|
4483 | #endif
|
---|
4484 |
|
---|
4485 | /** @def RT_FAR
|
---|
4486 | * For indicating far pointers in 16-bit code.
|
---|
4487 | * Does nothing in 32-bit and 64-bit code. */
|
---|
4488 | /** @def RT_NEAR
|
---|
4489 | * For indicating near pointers in 16-bit code.
|
---|
4490 | * Does nothing in 32-bit and 64-bit code. */
|
---|
4491 | /** @def RT_FAR_CODE
|
---|
4492 | * For indicating far 16-bit functions.
|
---|
4493 | * Does nothing in 32-bit and 64-bit code. */
|
---|
4494 | /** @def RT_NEAR_CODE
|
---|
4495 | * For indicating near 16-bit functions.
|
---|
4496 | * Does nothing in 32-bit and 64-bit code. */
|
---|
4497 | /** @def RT_FAR_DATA
|
---|
4498 | * For indicating far 16-bit external data, i.e. in a segment other than DATA16.
|
---|
4499 | * Does nothing in 32-bit and 64-bit code. */
|
---|
4500 | #if ARCH_BITS == 16
|
---|
4501 | # define RT_FAR __far
|
---|
4502 | # define RT_NEAR __near
|
---|
4503 | # define RT_FAR_CODE __far
|
---|
4504 | # define RT_NEAR_CODE __near
|
---|
4505 | # define RT_FAR_DATA __far
|
---|
4506 | #else
|
---|
4507 | # define RT_FAR
|
---|
4508 | # define RT_NEAR
|
---|
4509 | # define RT_FAR_CODE
|
---|
4510 | # define RT_NEAR_CODE
|
---|
4511 | # define RT_FAR_DATA
|
---|
4512 | #endif
|
---|
4513 |
|
---|
4514 |
|
---|
4515 | /** @} */
|
---|
4516 |
|
---|
4517 |
|
---|
4518 | /** @defgroup grp_rt_cdefs_cpp Special Macros for C++
|
---|
4519 | * @ingroup grp_rt_cdefs
|
---|
4520 | * @{
|
---|
4521 | */
|
---|
4522 |
|
---|
4523 | #ifdef __cplusplus
|
---|
4524 |
|
---|
4525 | /** @def DECLEXPORT_CLASS
|
---|
4526 | * How to declare an exported class. Place this macro after the 'class'
|
---|
4527 | * keyword in the declaration of every class you want to export.
|
---|
4528 | *
|
---|
4529 | * @note It is necessary to use this macro even for inner classes declared
|
---|
4530 | * inside the already exported classes. This is a GCC specific requirement,
|
---|
4531 | * but it seems not to harm other compilers.
|
---|
4532 | */
|
---|
4533 | #if defined(_MSC_VER) || defined(RT_OS_OS2)
|
---|
4534 | # define DECLEXPORT_CLASS __declspec(dllexport)
|
---|
4535 | #elif defined(RT_USE_VISIBILITY_DEFAULT)
|
---|
4536 | # define DECLEXPORT_CLASS __attribute__((visibility("default")))
|
---|
4537 | #else
|
---|
4538 | # define DECLEXPORT_CLASS
|
---|
4539 | #endif
|
---|
4540 |
|
---|
4541 | /** @def DECLIMPORT_CLASS
|
---|
4542 | * How to declare an imported class Place this macro after the 'class'
|
---|
4543 | * keyword in the declaration of every class you want to export.
|
---|
4544 | *
|
---|
4545 | * @note It is necessary to use this macro even for inner classes declared
|
---|
4546 | * inside the already exported classes. This is a GCC specific requirement,
|
---|
4547 | * but it seems not to harm other compilers.
|
---|
4548 | */
|
---|
4549 | #if defined(_MSC_VER) || (defined(RT_OS_OS2) && !defined(__IBMC__) && !defined(__IBMCPP__))
|
---|
4550 | # define DECLIMPORT_CLASS __declspec(dllimport)
|
---|
4551 | #elif defined(RT_USE_VISIBILITY_DEFAULT)
|
---|
4552 | # define DECLIMPORT_CLASS __attribute__((visibility("default")))
|
---|
4553 | #else
|
---|
4554 | # define DECLIMPORT_CLASS
|
---|
4555 | #endif
|
---|
4556 |
|
---|
4557 | /** @def WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP
|
---|
4558 | * Macro to work around error C2593 of the not-so-smart MSVC 7.x ambiguity
|
---|
4559 | * resolver. The following snippet clearly demonstrates the code causing this
|
---|
4560 | * error:
|
---|
4561 | * @code
|
---|
4562 | * class A
|
---|
4563 | * {
|
---|
4564 | * public:
|
---|
4565 | * operator bool() const { return false; }
|
---|
4566 | * operator int*() const { return NULL; }
|
---|
4567 | * };
|
---|
4568 | * int main()
|
---|
4569 | * {
|
---|
4570 | * A a;
|
---|
4571 | * if (!a);
|
---|
4572 | * if (a && 0);
|
---|
4573 | * return 0;
|
---|
4574 | * }
|
---|
4575 | * @endcode
|
---|
4576 | * The code itself seems pretty valid to me and GCC thinks the same.
|
---|
4577 | *
|
---|
4578 | * This macro fixes the compiler error by explicitly overloading implicit
|
---|
4579 | * global operators !, && and || that take the given class instance as one of
|
---|
4580 | * their arguments.
|
---|
4581 | *
|
---|
4582 | * The best is to use this macro right after the class declaration.
|
---|
4583 | *
|
---|
4584 | * @note The macro expands to nothing for compilers other than MSVC.
|
---|
4585 | *
|
---|
4586 | * @param Cls Class to apply the workaround to
|
---|
4587 | */
|
---|
4588 | #if defined(_MSC_VER)
|
---|
4589 | # define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Cls) \
|
---|
4590 | inline bool operator! (const Cls &that) { return !bool (that); } \
|
---|
4591 | inline bool operator&& (const Cls &that, bool b) { return bool (that) && b; } \
|
---|
4592 | inline bool operator|| (const Cls &that, bool b) { return bool (that) || b; } \
|
---|
4593 | inline bool operator&& (bool b, const Cls &that) { return b && bool (that); } \
|
---|
4594 | inline bool operator|| (bool b, const Cls &that) { return b || bool (that); }
|
---|
4595 | #else
|
---|
4596 | # define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Cls)
|
---|
4597 | #endif
|
---|
4598 |
|
---|
4599 | /** @def WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP_TPL
|
---|
4600 | * Version of WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP for template classes.
|
---|
4601 | *
|
---|
4602 | * @param Tpl Name of the template class to apply the workaround to
|
---|
4603 | * @param ArgsDecl arguments of the template, as declared in |<>| after the
|
---|
4604 | * |template| keyword, including |<>|
|
---|
4605 | * @param Args arguments of the template, as specified in |<>| after the
|
---|
4606 | * template class name when using the, including |<>|
|
---|
4607 | *
|
---|
4608 | * Example:
|
---|
4609 | * @code
|
---|
4610 | * // template class declaration
|
---|
4611 | * template <class C>
|
---|
4612 | * class Foo { ... };
|
---|
4613 | * // applied workaround
|
---|
4614 | * WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP_TPL (Foo, <class C>, <C>)
|
---|
4615 | * @endcode
|
---|
4616 | */
|
---|
4617 | #if defined(_MSC_VER)
|
---|
4618 | # define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP_TPL(Tpl, ArgsDecl, Args) \
|
---|
4619 | template ArgsDecl \
|
---|
4620 | inline bool operator! (const Tpl Args &that) { return !bool (that); } \
|
---|
4621 | template ArgsDecl \
|
---|
4622 | inline bool operator&& (const Tpl Args &that, bool b) { return bool (that) && b; } \
|
---|
4623 | template ArgsDecl \
|
---|
4624 | inline bool operator|| (const Tpl Args &that, bool b) { return bool (that) || b; } \
|
---|
4625 | template ArgsDecl \
|
---|
4626 | inline bool operator&& (bool b, const Tpl Args &that) { return b && bool (that); } \
|
---|
4627 | template ArgsDecl \
|
---|
4628 | inline bool operator|| (bool b, const Tpl Args &that) { return b || bool (that); }
|
---|
4629 | #else
|
---|
4630 | # define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP_TPL(Tpl, ArgsDecl, Args)
|
---|
4631 | #endif
|
---|
4632 |
|
---|
4633 |
|
---|
4634 | /** @def DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP
|
---|
4635 | * Declares the copy constructor and the assignment operation as inlined no-ops
|
---|
4636 | * (non-existent functions) for the given class. Use this macro inside the
|
---|
4637 | * private section if you want to effectively disable these operations for your
|
---|
4638 | * class.
|
---|
4639 | *
|
---|
4640 | * @param Cls class name to declare for
|
---|
4641 | */
|
---|
4642 | #define DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(Cls) \
|
---|
4643 | inline Cls(const Cls &); \
|
---|
4644 | inline Cls &operator= (const Cls &)
|
---|
4645 |
|
---|
4646 |
|
---|
4647 | /** @def DECLARE_CLS_NEW_DELETE_NOOP
|
---|
4648 | * Declares the new and delete operations as no-ops (non-existent functions)
|
---|
4649 | * for the given class. Use this macro inside the private section if you want
|
---|
4650 | * to effectively limit creating class instances on the stack only.
|
---|
4651 | *
|
---|
4652 | * @note The destructor of the given class must not be virtual, otherwise a
|
---|
4653 | * compile time error will occur. Note that this is not a drawback: having
|
---|
4654 | * the virtual destructor for a stack-based class is absolutely useless
|
---|
4655 | * (the real class of the stack-based instance is always known to the compiler
|
---|
4656 | * at compile time, so it will always call the correct destructor).
|
---|
4657 | *
|
---|
4658 | * @param Cls class name to declare for
|
---|
4659 | */
|
---|
4660 | #define DECLARE_CLS_NEW_DELETE_NOOP(Cls) \
|
---|
4661 | inline static void *operator new (size_t); \
|
---|
4662 | inline static void operator delete (void *)
|
---|
4663 |
|
---|
4664 | #endif /* __cplusplus */
|
---|
4665 |
|
---|
4666 | /** @} */
|
---|
4667 |
|
---|
4668 | #endif /* !IPRT_INCLUDED_cdefs_h */
|
---|
4669 |
|
---|