cdefs.h revision 56ad5023f941d62bfe36474eef1fff3291e61cf4
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * IPRT - Common C and C++ definitions.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Copyright (C) 2006-2012 Oracle Corporation
c97989161fbe75bc14cea477a5443bbf474dd3advboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * available from http://www.virtualbox.org. This file is free software;
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * you can redistribute it and/or modify it under the terms of the GNU
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * General Public License (GPL) as published by the Free Software
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * The contents of this file may alternatively be used under the terms
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * of the Common Development and Distribution License Version 1.0
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * VirtualBox OSE distribution, in which case the provisions of the
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * CDDL are applicable instead of those of the GPL.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * You may elect to license modified versions of this file under the
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * terms and conditions of either the GPL or the CDDL or both.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @defgroup grp_rt_cdefs IPRT Common Definitions and Macros
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync/** @def RT_C_DECLS_BEGIN
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Used to start a block of function declarations which are shared
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * between C and C++ program.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def RT_C_DECLS_END
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Used to end a block of function declarations which are shared
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * between C and C++ program.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Shut up DOXYGEN warnings and guide it properly thru the code.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#endif /* DOXYGEN_RUNNING */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def RT_ARCH_X86
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Indicates that we're compiling for the X86 architecture.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def RT_ARCH_AMD64
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Indicates that we're compiling for the AMD64 architecture.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def RT_ARCH_SPARC
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Indicates that we're compiling for the SPARC V8 architecture (32-bit).
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def RT_ARCH_SPARC64
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Indicates that we're compiling for the SPARC V9 architecture (64-bit).
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if !defined(RT_ARCH_X86) \
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync && !defined(RT_ARCH_AMD64) \
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync && !defined(RT_ARCH_SPARC) \
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync && !defined(RT_ARCH_SPARC64) \
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# if defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || defined(__AMD64__)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# elif defined(__i386__) || defined(_M_IX86) || defined(__X86__)
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync# else /* PORTME: append test for new archs. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# error "Check what predefined macros your compiler uses to indicate architecture."
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync/* PORTME: append new archs checks. */
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync#elif defined(RT_ARCH_X86) && defined(RT_ARCH_AMD64)
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync# error "Both RT_ARCH_X86 and RT_ARCH_AMD64 cannot be defined at the same time!"
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync#elif defined(RT_ARCH_X86) && defined(RT_ARCH_SPARC)
fe96bc0e43d9c137304462ef8c2d79cbff22446fvboxsync# error "Both RT_ARCH_X86 and RT_ARCH_SPARC cannot be defined at the same time!"
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync#elif defined(RT_ARCH_X86) && defined(RT_ARCH_SPARC64)
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync# error "Both RT_ARCH_X86 and RT_ARCH_SPARC64 cannot be defined at the same time!"
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync#elif defined(RT_ARCH_AMD64) && defined(RT_ARCH_SPARC)
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync# error "Both RT_ARCH_AMD64 and RT_ARCH_SPARC cannot be defined at the same time!"
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync#elif defined(RT_ARCH_AMD64) && defined(RT_ARCH_SPARC64)
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync# error "Both RT_ARCH_AMD64 and RT_ARCH_SPARC64 cannot be defined at the same time!"
aa32d4906f2f685992091893d5abdf27a2352a85vboxsync#elif defined(RT_ARCH_SPARC) && defined(RT_ARCH_SPARC64)
aa32d4906f2f685992091893d5abdf27a2352a85vboxsync# error "Both RT_ARCH_SPARC and RT_ARCH_SPARC64 cannot be defined at the same time!"
aa32d4906f2f685992091893d5abdf27a2352a85vboxsync#elif defined(RT_ARCH_ARM) && defined(RT_ARCH_AMD64)
aa32d4906f2f685992091893d5abdf27a2352a85vboxsync# error "Both RT_ARCH_ARM and RT_ARCH_AMD64 cannot be defined at the same time!"
aa32d4906f2f685992091893d5abdf27a2352a85vboxsync# error "Both RT_ARCH_ARM and RT_ARCH_X86 cannot be defined at the same time!"
aa32d4906f2f685992091893d5abdf27a2352a85vboxsync#elif defined(RT_ARCH_ARM) && defined(RT_ARCH_SPARC64)
aa32d4906f2f685992091893d5abdf27a2352a85vboxsync# error "Both RT_ARCH_ARM and RT_ARCH_SPARC64 cannot be defined at the same time!"
aa32d4906f2f685992091893d5abdf27a2352a85vboxsync#elif defined(RT_ARCH_ARM) && defined(RT_ARCH_SPARC)
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync# error "Both RT_ARCH_ARM and RT_ARCH_SPARC cannot be defined at the same time!"
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync/** @def __X86__
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Indicates that we're compiling for the X86 architecture.
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * @deprecated
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync/** @def __AMD64__
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Indicates that we're compiling for the AMD64 architecture.
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * @deprecated
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync#if !defined(__X86__) && !defined(__AMD64__) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync# error "Check what predefined macros your compiler uses to indicate architecture."
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync# error "Both __X86__ and __AMD64__ cannot be defined at the same time!"
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync/** @def RT_BIG_ENDIAN
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Defined if the architecture is big endian. */
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync/** @def RT_LITTLE_ENDIAN
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Defined if the architecture is little endian. */
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) || defined(RT_ARCH_ARM)
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync#elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync#if defined(RT_BIG_ENDIAN) && defined(RT_LITTLE_ENDIAN)
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync# error "Both RT_BIG_ENDIAN and RT_LITTLE_ENDIAN are defined"
6a84b239fa9107dd2fd98a0baafca598a05a2c15vboxsync/** @def IN_RING0
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Used to indicate that we're compiling code which is running
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * in Ring-0 Host Context.
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync/** @def IN_RING3
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Used to indicate that we're compiling code which is running
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * in Ring-3 Host Context.
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync/** @def IN_RC
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Used to indicate that we're compiling code which is running
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * in the Raw-mode Context (implies R0).
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if !defined(IN_RING3) && !defined(IN_RING0) && !defined(IN_RC) && !defined(IN_RC)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# error "You must define which context the compiled code should run in; IN_RING3, IN_RING0 or IN_RC"
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if (defined(IN_RING3) && (defined(IN_RING0) || defined(IN_RC)) ) \
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync || (defined(IN_RING0) && (defined(IN_RING3) || defined(IN_RC)) ) \
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync || (defined(IN_RC) && (defined(IN_RING3) || defined(IN_RING0)) )
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# error "Only one of the IN_RING3, IN_RING0, IN_RC defines should be defined."
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def ARCH_BITS
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Defines the bit count of the current context.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def HC_ARCH_BITS
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Defines the host architecture bit count.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if !defined(HC_ARCH_BITS) || defined(DOXYGEN_RUNNING)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def GC_ARCH_BITS
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Defines the guest architecture bit count.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if !defined(GC_ARCH_BITS) && !defined(DOXYGEN_RUNNING)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def R3_ARCH_BITS
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Defines the host ring-3 architecture bit count.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if !defined(R3_ARCH_BITS) || defined(DOXYGEN_RUNNING)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def R0_ARCH_BITS
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Defines the host ring-0 architecture bit count.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if !defined(R0_ARCH_BITS) || defined(DOXYGEN_RUNNING)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @def GC_ARCH_BITS
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * Defines the guest architecture bit count.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if !defined(GC_ARCH_BITS) || defined(DOXYGEN_RUNNING)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** @name RT_OPSYS_XXX - Operative System Identifiers.
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync * These are the value that the RT_OPSYS \#define can take. @{
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** Unknown OS. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** OS Agnostic. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** Darwin - aka Mac OS X. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** DragonFly BSD. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** FreeBSD. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** Haiku. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** Linux. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** Minix. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** NetBSD. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** Netware. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** NT (native). */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** OpenBSD. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** OS/2. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** Plan 9. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** Solaris. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** UEFI. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** Windows. */
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync/** The max RT_OPSYS_XXX value (exclusive). */
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync/** @def RT_OPSYS
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Indicates which OS we're targetting. It's a \#define with is
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * assigned one of the RT_OPSYS_XXX defines above.
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * So to test if we're on FreeBSD do the following:
fe96bc0e43d9c137304462ef8c2d79cbff22446fvboxsync * #if RT_OPSYS == RT_OPSYS_FREEBSD
fe96bc0e43d9c137304462ef8c2d79cbff22446fvboxsync * some_funky_freebsd_specific_stuff();
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# elif defined(__DragonFly__) || defined(RT_OS_DRAGONFLY)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# elif defined(__FreeBSD__) /*??*/ || defined(RT_OS_FREEBSD)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# elif defined(__gnu_linux__) || defined(RT_OS_LINUX)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# elif defined(__NetBSD__) /*??*/ || defined(RT_OS_NETBSD)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# elif defined(__OpenBSD__) /*??*/ || defined(RT_OS_OPENBSD)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# elif defined(__sun__) || defined(__SunOS__) || defined(__sun) || defined(__SunOS) || defined(RT_OS_SOLARIS)
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync# elif defined(_WIN32) || defined(_WIN64) || defined(RT_OS_WINDOWS)
97dc0e92bcc0cddf896cbf620b689b095c7346davboxsync#if RT_OPSYS < RT_OPSYS_UNKNOWN || RT_OPSYS >= RT_OPSYS_MAX
574bc38df445ce8595342c92f4341545b5277048vboxsync * Do some consistency checks.
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Search: #define RT_OPSYS_([A-Z0-9]+) .*
914d33aebb63d8c288dfd1b7e74f8e2acf3eaa66vboxsync * Replace: #if defined(RT_OS_\1) && RT_OPSYS != RT_OPSYS_\1\n# error RT_OPSYS vs RT_OS_\1\n#endif
97dc0e92bcc0cddf896cbf620b689b095c7346davboxsync#if defined(RT_OS_UNKNOWN) && RT_OPSYS != RT_OPSYS_UNKNOWN
97dc0e92bcc0cddf896cbf620b689b095c7346davboxsync#if defined(RT_OS_AGNOSTIC) && RT_OPSYS != RT_OPSYS_AGNOSTIC
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if defined(RT_OS_DARWIN) && RT_OPSYS != RT_OPSYS_DARWIN
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if defined(RT_OS_DRAGONFLY) && RT_OPSYS != RT_OPSYS_DRAGONFLY
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if defined(RT_OS_FREEBSD) && RT_OPSYS != RT_OPSYS_FREEBSD
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if defined(RT_OS_HAIKU) && RT_OPSYS != RT_OPSYS_HAIKU
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if defined(RT_OS_LINUX) && RT_OPSYS != RT_OPSYS_LINUX
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if defined(RT_OS_MINIX) && RT_OPSYS != RT_OPSYS_MINIX
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if defined(RT_OS_NETBSD) && RT_OPSYS != RT_OPSYS_NETBSD
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if defined(RT_OS_NETWARE) && RT_OPSYS != RT_OPSYS_NETWARE
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if defined(RT_OS_OPENBSD) && RT_OPSYS != RT_OPSYS_OPENBSD
5b1d6bab9f4cf5dacf1883e7c4a40c84349f597fvboxsync#if defined(RT_OS_PLAN9) && RT_OPSYS != RT_OPSYS_PLAN9
# ifndef RT_OS_UNKNOWN
# define RT_OS_UNKNOWN
# ifndef RT_OS_AGNOSTIC
# define RT_OS_AGNOSTIC
# ifndef RT_OS_DARWIN
# define RT_OS_DARWIN
# ifndef RT_OS_DRAGONFLY
# define RT_OS_DRAGONFLY
# ifndef RT_OS_DOS
# define RT_OS_DOS
# ifndef RT_OS_FREEBSD
# define RT_OS_FREEBSD
# ifndef RT_OS_HAIKU
# define RT_OS_HAIKU
# ifndef RT_OS_LINUX
# define RT_OS_LINUX
# ifndef RT_OS_L4
# define RT_OS_L4
# ifndef RT_OS_MINIX
# define RT_OS_MINIX
# ifndef RT_OS_NETBSD
# define RT_OS_NETBSD
# ifndef RT_OS_NETWARE
# define RT_OS_NETWARE
# ifndef RT_OS_NT
# define RT_OS_NT
# ifndef RT_OS_OPENBSD
# define RT_OS_OPENBSD
# ifndef RT_OS_OS2
# define RT_OS_OS2
# ifndef RT_OS_PLAN9
# define RT_OS_PLAN9
# ifndef RT_OS_QNX
# define RT_OS_QNX
# ifndef RT_OS_SOLARIS
# define RT_OS_SOLARIS
# ifndef RT_OS_UEFI
# define RT_OS_UEFI
# ifndef RT_OS_WINDOWS
# define RT_OS_WINDOWS
* @remark For pointers used only in one context use RCPTRTYPE(), R3R0PTRTYPE(), R3PTRTYPE() or R0PTRTYPE().
#ifdef IN_RC
#ifdef IN_RC
#ifdef IN_RC
#ifdef IN_RC
#ifdef IN_RING3
#ifdef IN_RC
#ifdef IN_RC
#ifdef IN_RC
#ifdef IN_RING3
#ifdef IN_RING3
#ifdef IN_RING0
#ifdef IN_RC
#define RT_NOTHING
#ifdef __GNUC__
# define RT_GCC_EXTENSION
# define RT_COMPILER_GROKS_64BIT_BITFIELDS
# define RT_COMPILER_WITH_80BIT_LONG_DOUBLE
#if !defined(RT_EXCEPTIONS_ENABLED) \
&& defined(__cplusplus) \
# define RT_EXCEPTIONS_ENABLED
#ifdef RT_EXCEPTIONS_ENABLED
# define RT_NO_THROW
#ifdef RT_EXCEPTIONS_ENABLED
# ifdef _MSC_VER
#if defined(__GNUC__)
# define RT_GCC_SUPPORTS_VISIBILITY_HIDDEN
#ifdef _MSC_VER
#elif defined(__GNUC__) && defined(IN_RING0) && defined(RT_ARCH_X86) /** @todo consider dropping IN_RING0 here. */
# define RTCALL __attribute__((cdecl,regparm(0))) /* regparm(0) deals with -mregparm=x use in the linux kernel. */
# define RTCALL
#if defined(_MSC_VER)
#ifdef __cplusplus
#ifdef _MSC_VER
#if defined(__GNUC__)
#ifdef IN_RING3
#ifdef IN_RC
#ifdef IN_RING0
#ifdef __GNUC__
#ifdef __GNUC__
#ifdef __GNUC__
#ifdef IN_RT_R0
# ifdef IN_RT_STATIC
#ifdef IN_RT_R3
# ifdef IN_RT_STATIC
#ifdef IN_RT_RC
# ifdef IN_RT_STATIC
# ifdef IN_RT_STATIC
# ifdef IN_RT_STATIC
# ifdef IN_RT_STATIC
# define RT_DECL_CLASS
#ifndef RT_WITHOUT_NOCRT_WRAPPERS
#if defined(__GNUC__)
#define RT_CONCAT_HLP(a,b) a##b
#define RT_CONCAT3_HLP(a,b,c) a##b##c
#define RT_CONCAT4_HLP(a,b,c,d) a##b##c##d
* @remark This macro is the preferred alignment macro, it doesn't have any of the pitfalls RT_ALIGN has.
#define RT_ALIGN_T(u, uAlignment, type) ( ((type)(u) + ((uAlignment) - 1)) & ~(type)((uAlignment) - 1) )
#define RT_UOFFSETOF_ADD(type, member, addend) ( (uintptr_t)&( ((type *)(void *)(uintptr_t)(addend))->member) )
#define RT_FROM_MEMBER(pMem, Type, Member) ( (Type *) ((uint8_t *)(void *)(pMem) - RT_UOFFSETOF(Type, Member)) )
#ifdef RT_OS_OS2
resource type define in os2.h. */
#ifdef __GNUC__
# define RT_LO_U8(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint16_t)); (uint8_t)(a); })
#ifdef __GNUC__
# define RT_HI_U8(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint16_t)); (uint8_t)((a) >> 8); })
#ifdef __GNUC__
# define RT_LO_U16(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint64_t)); (uint32_t)(a); })
#ifdef __GNUC__
# define RT_HI_U16(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint32_t)); (uint16_t)((a) >> 16); })
#ifdef __GNUC__
# define RT_LO_U32(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint64_t)); (uint32_t)(a); })
#ifdef __GNUC__
# define RT_HI_U32(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint64_t)); (uint32_t)((a) >> 32); })
#define RT_BSWAP_U64_C(u64) RT_MAKE_U64(RT_BSWAP_U32_C((u64) >> 32), RT_BSWAP_U32_C((u64) & 0xffffffff))
#define RT_BSWAP_U32_C(u32) RT_MAKE_U32_FROM_U8(RT_BYTE4(u32), RT_BYTE3(u32), RT_BYTE2(u32), RT_BYTE1(u32))
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#ifdef RT_BIG_ENDIAN
#if defined(RT_OS_DARWIN) \
&& !defined(KERNEL) \
&& !defined(RT_NO_BSD_PARAM_H_UNDEFING) \
#define NIL_OFFSET (~0U)
#ifdef __GNUC__
# if !defined(__L4ENV__)
# define RT_BREAKPOINT() __asm__ __volatile__("illtrap 0\n\t") /** @todo Sparc64: this is just a wild guess. */
# define RT_BREAKPOINT() __asm__ __volatile__("unimp 0\n\t") /** @todo Sparc: this is just a wild guess (same as Sparc64, just different name). */
#ifdef _MSC_VER
#ifndef RT_BREAKPOINT
#if defined(RT_ARCH_AMD64)
# ifdef IN_RING3
# ifdef IN_RING3
# if defined(RT_OS_SOLARIS)
/** @todo # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x80004000U >= 0x80004000U + 0x100000000ULL ) - figure this. */
# if defined(RT_OS_SOLARIS)
# ifdef IN_RING3
# ifdef RT_OS_SOLARIS
# ifdef RT_OS_SOLARIS
#define N_(s) (s)
#define _(s) gettext(s)
# ifdef _MSC_VER
# define RT_STRICT
#ifdef RT_NO_STRICT
# define RT_LOCK_NO_STRICT
# define RT_LOCK_NO_STRICT_ORDER
# define RT_LOCK_STRICT
# define RT_LOCK_STRICT_ORDER
# define RT_INLINE_ASM_EXTERNAL 0
#if defined(_MSC_VER)
# define RT_INLINE_ASM_GNU_STYLE 0
* Defined as 1 if the compiler have and uses intrin.h. Otherwise it is 0. */
#ifdef _MSC_VER
#ifndef RT_INLINE_ASM_USES_INTRIN
# define RT_INLINE_ASM_USES_INTRIN 0
#ifdef __cplusplus
# define DECLEXPORT_CLASS
# define DECLIMPORT_CLASS
#if defined(_MSC_VER)
#if defined(_MSC_VER)