Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / Extras / CDTestFramework / Opcode / Ice / IcePreprocessor.h
1 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 /**
3  *      Contains preprocessor stuff. This should be the first included header.
4  *      \file           IcePreprocessor.h
5  *      \author         Pierre Terdiman
6  *      \date           April, 4, 2000
7  */
8 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9
10 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
11 // Include Guard
12 #ifndef ICEPREPROCESSOR_H
13 #define ICEPREPROCESSOR_H
14
15         // Check platform
16         #if defined( _WIN32 ) || defined( WIN32 )
17                 #pragma message("Compiling on Windows...")
18                 #define PLATFORM_WINDOWS
19         #else
20                 #pragma message("Compiling on unknown platform...")
21         #endif
22
23         // Check compiler
24         #if defined(_MSC_VER)
25                 #pragma message("Compiling with VC++...")
26                 #define COMPILER_VISUAL_CPP
27
28                 #if _MSC_VER > 1300
29                         #pragma message("Compiling with VC7")
30                         #define COMPILER_VC7
31                 #else
32                         #pragma message("Compiling with VC6")
33                         #define COMPILER_VC6
34                 #endif
35         #else
36                 #pragma message("Compiling with unknown compiler...")
37         #endif
38
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)
44                         #endif
45
46                         #if defined(_CPPRTTI)
47                                 #error Please disable RTTI...
48                         #endif
49
50                         #if defined(_CPPUNWIND)
51                                 #error Please disable exceptions...
52                         #endif
53
54                         #if defined(_MT)
55                                 // Multithreading
56                         #endif
57                 #endif
58         #endif
59
60         // Check debug mode
61         #ifdef  DEBUG                   // May be defined instead of _DEBUG. Let's fix it.
62                 #ifndef _DEBUG
63                         #define _DEBUG
64                 #endif
65         #endif
66
67         #ifdef  _DEBUG
68                 // Here you may define items for debug builds
69         #endif
70
71         #ifndef THIS_FILE
72                 #define THIS_FILE                       __FILE__
73         #endif
74
75         #ifndef ICE_NO_DLL
76                 #ifdef ICECORE_EXPORTS
77                         #define ICECORE_API             __declspec(dllexport)
78                 #else
79                         #define ICECORE_API             __declspec(dllimport)
80                 #endif
81         #else
82                         #define ICECORE_API
83         #endif
84
85         #define FUNCTION                                extern "C"
86
87         // Cosmetic stuff [mainly useful with multiple inheritance]
88         #define override(base_class)    virtual
89
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
95
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))
104         #else
105                 #define inline_ inline
106         #endif
107
108         // Down the hatch
109         #pragma inline_depth( 255 )
110
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)
121         #endif
122
123         // ANSI compliance
124         #ifdef  _DEBUG
125                 // Remove painful warning in debug
126                 inline_ bool ReturnsFalse(){ return false; }
127                 #define for if(ReturnsFalse()){}        else for
128         #else
129                 #define for if(0){}     else for
130         #endif
131
132         // Don't override new/delete
133         #define DEFAULT_NEWDELETE
134         #define DONT_TRACK_MEMORY_LEAKS
135
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
139                 #define GUARD(x)                                                \
140                         {                                                                       \
141                         static const char guard_text[] = x;     \
142                         _asm    push    eax                                     \
143                         _asm    nop                                                     \
144                         _asm    nop                                                     \
145                         _asm    nop                                                     \
146                         _asm    nop                                                     \
147                         _asm    lea             eax, guard_text         \
148                         _asm    nop                                                     \
149                         _asm    nop                                                     \
150                         _asm    nop                                                     \
151                         _asm    nop                                                     \
152                         _asm    pop             eax                                     \
153                         }
154         #else
155                 #define GUARD(x)
156         #endif
157
158 #endif // ICEPREPROCESSOR_H