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