1 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3 * Contains preprocessor stuff. This should be the first included header.
4 * \file IcePreprocessor.h
5 * \author Pierre Terdiman
8 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
12 #ifndef ICEPREPROCESSOR_H
13 #define ICEPREPROCESSOR_H
16 #if defined( _WIN32 ) || defined( WIN32 )
17 #pragma message("Compiling on Windows...")
18 #define PLATFORM_WINDOWS
20 #pragma message("Compiling on unknown platform...")
25 #pragma message("Compiling with VC++...")
26 #define COMPILER_VISUAL_CPP
29 #pragma message("Compiling with VC7")
32 #pragma message("Compiling with VC6")
36 #pragma message("Compiling with unknown compiler...")
39 // Check compiler options. If this file is included in user-apps, this
40 // shouldn't be needed, so that they can use what they like best.
41 #ifndef ICE_DONT_CHECK_COMPILER_OPTIONS
42 #ifdef COMPILER_VISUAL_CPP
43 #if defined(_CHAR_UNSIGNED)
47 #error Please disable RTTI...
50 #if defined(_CPPUNWIND)
51 #error Please disable exceptions...
61 #ifdef DEBUG // May be defined instead of _DEBUG. Let's fix it.
68 // Here you may define items for debug builds
72 #define THIS_FILE __FILE__
76 #ifdef ICECORE_EXPORTS
77 #define ICECORE_API __declspec(dllexport)
79 #define ICECORE_API __declspec(dllimport)
85 #define FUNCTION extern "C"
87 // Cosmetic stuff [mainly useful with multiple inheritance]
88 #define override(base_class) virtual
90 // Our own inline keyword, so that:
91 // - we can switch to __forceinline to check it's really better or not
92 // - we can remove __forceinline if the compiler doesn't support it
93 // #define inline_ __forceinline
94 // #define inline_ inline
96 // Contributed by Bruce Mitchener
97 #if defined(COMPILER_VISUAL_CPP)
98 #define inline_ __forceinline
99 // #define inline_ inline
100 #elif defined(__GNUC__) && __GNUC__ < 3
101 #define inline_ inline
102 #elif defined(__GNUC__)
103 #define inline_ inline __attribute__ ((always_inline))
105 #define inline_ inline
109 #pragma inline_depth( 255 )
111 #ifdef COMPILER_VISUAL_CPP
112 #pragma intrinsic(memcmp)
113 #pragma intrinsic(memcpy)
114 #pragma intrinsic(memset)
115 #pragma intrinsic(strcat)
116 #pragma intrinsic(strcmp)
117 #pragma intrinsic(strcpy)
118 #pragma intrinsic(strlen)
119 #pragma intrinsic(abs)
120 #pragma intrinsic(labs)
125 // Remove painful warning in debug
126 inline_ bool ReturnsFalse(){ return false; }
127 #define for if(ReturnsFalse()){} else for
129 #define for if(0){} else for
132 // Don't override new/delete
133 #define DEFAULT_NEWDELETE
134 #define DONT_TRACK_MEMORY_LEAKS
136 //! Macro used to give me a clue when it crashes in release and only the assembly is available
137 #define INCLUDE_GUARDIANS
138 #ifdef INCLUDE_GUARDIANS
141 static const char guard_text[] = x; \
147 _asm lea eax, guard_text \
158 #endif // ICEPREPROCESSOR_H