IcePreprocessor.h 3.6 KB

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