summaryrefslogtreecommitdiff
path: root/src/stdafx.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-10-18 20:26:29 +0000
committerfrosch <frosch@openttd.org>2009-10-18 20:26:29 +0000
commitb8f8c60839ac0451ae83333fd2df9b87a1219534 (patch)
treec16983ed493cd0c6047ba3a7f3d5df1878461058 /src/stdafx.h
parentfea06c575532d1070dc67e49453872601f97f84a (diff)
downloadopenttd-b8f8c60839ac0451ae83333fd2df9b87a1219534.tar.xz
(svn r17810) -Codechange/Fix: Add assert_tcompile() and use it.
OTTD's traditional assert_compile() does not work inside templates for gcc compilers, static_assert() does though. The new assert_tcompile() resolves into static_assert() if present, or into a runtime assert() else.
Diffstat (limited to 'src/stdafx.h')
-rw-r--r--src/stdafx.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/stdafx.h b/src/stdafx.h
index 36dd3602c..bac0a6c46 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -301,11 +301,14 @@ typedef unsigned char byte;
#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 */
#define assert_compile(expr) static_assert(expr, #expr )
+ #define assert_tcompile(expr) assert_compile(expr)
#elif defined(__OS2__) || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ < 4)
/* Disabled for OS/2 or GCC < 3.4 (GCC < 3 isn't supported anymore) */
#define assert_compile(expr)
+ #define assert_tcompile(expr) assert(expr)
#else
#define assert_compile(expr) extern const int __ct_assert__[1 - 2 * !(expr)] UNUSED
+ #define assert_tcompile(expr) assert(expr)
#endif
/* Check if the types have the bitsizes like we are using them */