mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r19604) -Codechange: Reintroduce assert_tcompile().
This commit is contained in:
parent
ea7aececf8
commit
19e26fcb12
@ -313,15 +313,20 @@ typedef unsigned char byte;
|
|||||||
#define PERSONAL_DIR ""
|
#define PERSONAL_DIR ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Compile time assertions. Prefer c++0x static_assert() */
|
/* Compile time assertions. Prefer c++0x static_assert().
|
||||||
|
* Older compilers cannot evaluate some expressions at compile time,
|
||||||
|
* typically when templates are involved, try assert_tcompile() in those cases. */
|
||||||
#if defined(__STDCXX_VERSION__) || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__GXX_EXPERIMENTAL_CPP0X__) || defined(static_assert)
|
#if defined(__STDCXX_VERSION__) || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__GXX_EXPERIMENTAL_CPP0X__) || defined(static_assert)
|
||||||
/* __STDCXX_VERSION__ is c++0x feature macro, __GXX_EXPERIMENTAL_CXX0X__ is used by gcc, __GXX_EXPERIMENTAL_CPP0X__ by icc */
|
/* __STDCXX_VERSION__ is c++0x feature macro, __GXX_EXPERIMENTAL_CXX0X__ is used by gcc, __GXX_EXPERIMENTAL_CPP0X__ by icc */
|
||||||
#define assert_compile(expr) static_assert(expr, #expr )
|
#define assert_compile(expr) static_assert(expr, #expr )
|
||||||
|
#define assert_tcompile(expr) assert_compile(expr)
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
/* Disabled for OS/2 */
|
/* Disabled for OS/2 */
|
||||||
#define assert_compile(expr)
|
#define assert_compile(expr)
|
||||||
|
#define assert_tcompile(expr) assert_compile(expr)
|
||||||
#else
|
#else
|
||||||
#define assert_compile(expr) typedef int __ct_assert__[1 - 2 * !(expr)]
|
#define assert_compile(expr) typedef int __ct_assert__[1 - 2 * !(expr)]
|
||||||
|
#define assert_tcompile(expr) assert(expr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check if the types have the bitsizes like we are using them */
|
/* Check if the types have the bitsizes like we are using them */
|
||||||
|
Loading…
Reference in New Issue
Block a user