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(SN_TARGET_PS3) 78# define TORQUE_OS_STRING "PS3" 79# define TORQUE_OS_PS3 80# include "platform/types.posix.h" 81 82#elif defined(linux) || defined(LINUX) 83# define TORQUE_OS_STRING "Linux" 84# define TORQUE_OS_LINUX 85//# define TORQUE_SUPPORTS_NASM 86//# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM 87# include "platform/types.posix.h" 88 89#elif defined(__OpenBSD__) 90# define TORQUE_OS_STRING "OpenBSD" 91# define TORQUE_OS_OPENBSD 92# define TORQUE_SUPPORTS_NASM 93# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM 94# include "platform/types.posix.h" 95 96#elif defined(__FreeBSD__) 97# define TORQUE_OS_STRING "FreeBSD" 98# define TORQUE_OS_FREEBSD 99# define TORQUE_SUPPORTS_NASM 100# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM 101# include "platform/types.posix.h" 102 103#elif defined(__APPLE__) 104# define TORQUE_OS_STRING "MacOS X" 105# define TORQUE_OS_MAC 106# include "platform/types.mac.h" 107# if defined(i386) 108// Disabling ASM on XCode for shared library build code relocation issues 109// This could be reconfigured for static builds, though minimal impact 110//# define TORQUE_SUPPORTS_NASM 111# endif 112#else 113# error "GCC: Unsupported Operating System" 114#endif 115 116 117//-------------------------------------- 118// Identify the CPU 119#if defined(i386) || defined(__i386) || defined(__i386__) 120# define TORQUE_CPU_STRING "Intel x86" 121# define TORQUE_CPU_X86 122# define TORQUE_LITTLE_ENDIAN 123 124#elif defined(__x86_64__) 125# define TORQUE_CPU_STRING "Intel x64" 126# define TORQUE_CPU_X64 127# define TORQUE_LITTLE_ENDIAN 128 129#else 130# error "GCC: Unsupported Target CPU" 131#endif 132 133#ifndef Offset 134/// Offset macro: 135/// Calculates the location in memory of a given member x of class cls from the 136/// start of the class. Need several definitions to account for various 137/// flavors of GCC. 138 139// now, for each compiler type, define the Offset macros that should be used. 140// The Engine code usually uses the Offset macro, but OffsetNonConst is needed 141// when a variable is used in the indexing of the member field (see 142// TSShapeConstructor::initPersistFields for an example) 143 144// compiler is non-GCC, or gcc < 3 145#if (__GNUC__ < 3) 146#define Offset(x, cls) _Offset_Normal(x, cls) 147#define OffsetNonConst(x, cls) _Offset_Normal(x, cls) 148 149// compiler is GCC 3 with minor version less than 4 150#elif defined(TORQUE_COMPILER_GCC) && (__GNUC__ == 3) && (__GNUC_MINOR__ < 4) 151#define Offset(x, cls) _Offset_Variant_1(x, cls) 152#define OffsetNonConst(x, cls) _Offset_Variant_1(x, cls) 153 154// compiler is GCC 3 with minor version greater than 4 155#elif defined(TORQUE_COMPILER_GCC) && (__GNUC__ == 3) && (__GNUC_MINOR__ >= 4) 156#include <stddef.h> 157#define Offset(x, cls) _Offset_Variant_2(x, cls) 158#define OffsetNonConst(x, cls) _Offset_Variant_1(x, cls) 159 160// compiler is GCC 4 161#elif defined(TORQUE_COMPILER_GCC) && (__GNUC__ == 4) 162#include <stddef.h> 163#define Offset(x, cls) _Offset_Normal(x, cls) 164#define OffsetNonConst(x, cls) _Offset_Variant_1(x, cls) 165 166#endif 167#endif 168 169#endif // INCLUDED_TYPES_GCC_H 170 171
