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