IcePreprocessor.h 3.7 KB

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