| 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 |
// don't issue pragmas on unknown platforms |
| 21 |
// #pragma message("Compiling on unknown platform...") |
| 22 |
#endif |
| 23 |
|
| 24 |
// Check compiler |
| 25 |
#if defined(_MSC_VER) |
| 26 |
// #pragma message("Compiling with VC++...") |
| 27 |
#define COMPILER_VISUAL_CPP |
| 28 |
#else |
| 29 |
// don't issue pragmas on unknown platforms |
| 30 |
// #pragma message("Compiling with unknown compiler...") |
| 31 |
#endif |
| 32 |
|
| 33 |
// Check compiler options. If this file is included in user-apps, this |
| 34 |
// shouldn't be needed, so that they can use what they like best. |
| 35 |
#ifndef ICE_DONT_CHECK_COMPILER_OPTIONS |
| 36 |
#ifdef COMPILER_VISUAL_CPP |
| 37 |
#if defined(_CHAR_UNSIGNED) |
| 38 |
#endif |
| 39 |
|
| 40 |
#if defined(_CPPRTTI) |
| 41 |
#error Please disable RTTI... |
| 42 |
#endif |
| 43 |
|
| 44 |
#if defined(_CPPUNWIND) |
| 45 |
#error Please disable exceptions... |
| 46 |
#endif |
| 47 |
|
| 48 |
#if defined(_MT) |
| 49 |
// Multithreading |
| 50 |
#endif |
| 51 |
#endif |
| 52 |
#endif |
| 53 |
|
| 54 |
// Check debug mode |
| 55 |
#ifdef DEBUG // May be defined instead of _DEBUG. Let's fix it. |
| 56 |
#ifndef _DEBUG |
| 57 |
#define _DEBUG |
| 58 |
#endif |
| 59 |
#endif |
| 60 |
|
| 61 |
#ifdef _DEBUG |
| 62 |
// Here you may define items for debug builds |
| 63 |
#endif |
| 64 |
|
| 65 |
#ifndef THIS_FILE |
| 66 |
#define THIS_FILE __FILE__ |
| 67 |
#endif |
| 68 |
|
| 69 |
#ifndef ICE_NO_DLL |
| 70 |
#ifdef ICECORE_EXPORTS |
| 71 |
#define ICECORE_API __declspec(dllexport) |
| 72 |
#else |
| 73 |
#define ICECORE_API __declspec(dllimport) |
| 74 |
#endif |
| 75 |
#else |
| 76 |
#define ICECORE_API |
| 77 |
#endif |
| 78 |
|
| 79 |
// Don't override new/delete |
| 80 |
// #define DEFAULT_NEWDELETE |
| 81 |
#define DONT_TRACK_MEMORY_LEAKS |
| 82 |
|
| 83 |
#define FUNCTION extern "C" |
| 84 |
|
| 85 |
// Cosmetic stuff [mainly useful with multiple inheritance] |
| 86 |
#define override(base_class) virtual |
| 87 |
|
| 88 |
// Our own inline keyword, so that: |
| 89 |
// - we can switch to __forceinline to check it's really better or not |
| 90 |
// - we can remove __forceinline if the compiler doesn't support it |
| 91 |
// #define inline_ __forceinline |
| 92 |
// #define inline_ inline |
| 93 |
|
| 94 |
// Contributed by Bruce Mitchener |
| 95 |
#if defined(COMPILER_VISUAL_CPP) |
| 96 |
#define inline_ __forceinline |
| 97 |
// #define inline_ inline |
| 98 |
#elif defined(__GNUC__) && __GNUC__ < 3 |
| 99 |
#define inline_ inline |
| 100 |
#elif defined(__GNUC__) |
| 101 |
#define inline_ inline __attribute__ ((always_inline)) |
| 102 |
#else |
| 103 |
#define inline_ inline |
| 104 |
#endif |
| 105 |
|
| 106 |
// Down the hatch |
| 107 |
#ifdef _MSC_VER |
| 108 |
#pragma inline_depth( 255 ) |
| 109 |
#endif |
| 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 __False__(){ return false; } |
| 127 |
#define for if(__False__()){} else for |
| 128 |
#else |
| 129 |
#define for if(0){} else for |
| 130 |
#endif |
| 131 |
|
| 132 |
#endif // __ICEPREPROCESSOR_H__ |