types.gcc.h
Engine/source/platform/types.gcc.h
Public Defines
define
Offset(x, cls) (x, cls)
Offset macro: Calculates the location in memory of a given member x of class cls from the start of the class.
define
OffsetNonConst(x, cls) (x, cls)
define
TORQUE_COMPILER_GCC() (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
define
TORQUE_COMPILER_STRING() "GCC "
Public Typedefs
signed long
S64
unsigned long
U64
Detailed Description
Public Defines
Offset(x, cls) (x, cls)
Offset macro: Calculates the location in memory of a given member x of class cls from the start of the class.
Need several definitions to account for various flavors of GCC.
OffsetNonConst(x, cls) (x, cls)
TORQUE_COMPILER_GCC() (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
TORQUE_COMPILER_STRING() "GCC "
Public Typedefs
typedef signed long S64
typedef unsigned long U64
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _TYPESGCC_H 25#define _TYPESGCC_H 26 27 28// For additional information on GCC predefined macros 29// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/cpp.html 30 31 32//-------------------------------------- 33// Types 34#if defined(TORQUE_X86) 35typedef signed long long S64; 36typedef unsigned long long U64; 37#else 38typedef signed long S64; 39typedef unsigned long U64; 40#endif 41 42 43//-------------------------------------- 44// Compiler Version 45#define TORQUE_COMPILER_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 46 47 48//-------------------------------------- 49// Identify the compiler string 50 51#if defined(__MINGW32__) 52# define TORQUE_COMPILER_STRING "GCC (MinGW)" 53# define TORQUE_COMPILER_MINGW 54#elif defined(__CYGWIN__) 55# define TORQUE_COMPILER_STRING "GCC (Cygwin)" 56# define TORQUE_COMPILER_MINGW 57#else 58# define TORQUE_COMPILER_STRING "GCC " 59#endif 60 61 62//-------------------------------------- 63// Identify the Operating System 64#if defined(_WIN64) 65# define TORQUE_OS_STRING "Win64" 66# define TORQUE_OS_WIN 67# define TORQUE_OS_WIN64 68# include "platform/types.win.h" 69#elif defined(__WIN32__) || defined(_WIN32) 70# define TORQUE_OS_STRING "Win32" 71# define TORQUE_OS_WIN 72# define TORQUE_OS_WIN32 73# define TORQUE_SUPPORTS_NASM 74# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM 75# include "platform/types.win.h" 76 77#elif defined(linux) || defined(LINUX) 78# define TORQUE_OS_STRING "Linux" 79# define TORQUE_OS_LINUX 80//# define TORQUE_SUPPORTS_NASM 81//# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM 82# include "platform/types.posix.h" 83 84#elif defined(__OpenBSD__) 85# define TORQUE_OS_STRING "OpenBSD" 86# define TORQUE_OS_OPENBSD 87# define TORQUE_SUPPORTS_NASM 88# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM 89# include "platform/types.posix.h" 90 91#elif defined(__FreeBSD__) 92# define TORQUE_OS_STRING "FreeBSD" 93# define TORQUE_OS_FREEBSD 94# define TORQUE_SUPPORTS_NASM 95# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM 96# include "platform/types.posix.h" 97 98#elif defined(__APPLE__) 99# define TORQUE_OS_STRING "MacOS X" 100# define TORQUE_OS_MAC 101# include "platform/types.mac.h" 102# if defined(i386) 103// Disabling ASM on XCode for shared library build code relocation issues 104// This could be reconfigured for static builds, though minimal impact 105//# define TORQUE_SUPPORTS_NASM 106# endif 107#else 108# error "GCC: Unsupported Operating System" 109#endif 110 111 112//-------------------------------------- 113// Identify the CPU 114#if defined(i386) || defined(__i386) || defined(__i386__) 115# define TORQUE_CPU_STRING "Intel x86" 116# define TORQUE_CPU_X86 117# define TORQUE_LITTLE_ENDIAN 118 119#elif defined(__x86_64__) 120# define TORQUE_CPU_STRING "Intel x64" 121# define TORQUE_CPU_X64 122# define TORQUE_LITTLE_ENDIAN 123 124#else 125# error "GCC: Unsupported Target CPU" 126#endif 127 128#ifndef Offset 129/// Offset macro: 130/// Calculates the location in memory of a given member x of class cls from the 131/// start of the class. Need several definitions to account for various 132/// flavors of GCC. 133 134// now, for each compiler type, define the Offset macros that should be used. 135// The Engine code usually uses the Offset macro, but OffsetNonConst is needed 136// when a variable is used in the indexing of the member field (see 137// TSShapeConstructor::initPersistFields for an example) 138 139// compiler is non-GCC, or gcc < 3 140#if (__GNUC__ < 3) 141#define Offset(x, cls) _Offset_Normal(x, cls) 142#define OffsetNonConst(x, cls) _Offset_Normal(x, cls) 143 144// compiler is GCC 3 with minor version less than 4 145#elif defined(TORQUE_COMPILER_GCC) && (__GNUC__ == 3) && (__GNUC_MINOR__ < 4) 146#define Offset(x, cls) _Offset_Variant_1(x, cls) 147#define OffsetNonConst(x, cls) _Offset_Variant_1(x, cls) 148 149// compiler is GCC 3 with minor version greater than 4 150#elif defined(TORQUE_COMPILER_GCC) && (__GNUC__ == 3) && (__GNUC_MINOR__ >= 4) 151#include <stddef.h> 152#define Offset(x, cls) _Offset_Variant_2(x, cls) 153#define OffsetNonConst(x, cls) _Offset_Variant_1(x, cls) 154 155// compiler is GCC 4 156#elif defined(TORQUE_COMPILER_GCC) && (__GNUC__ == 4) 157#include <stddef.h> 158#define Offset(x, cls) _Offset_Normal(x, cls) 159#define OffsetNonConst(x, cls) _Offset_Variant_1(x, cls) 160 161#endif 162#endif 163 164#endif // INCLUDED_TYPES_GCC_H 165 166