00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00050 #ifndef TOPPERS_ASSERT_HPP_
00051 #define TOPPERS_ASSERT_HPP_
00052
00053 #include <toppers/config.hpp>
00054
00055 #define TOPPERS_JOIN(a, b) TOPPERS_JOIN_(a, b)
00056 #define TOPPERS_JOIN_(a, b) a ## b
00057
00058 #define TOPPERS_STRINGIFY(a) TOPPERS_STRINGIFY_(a)
00059 #define TOPPERS_STRINGIFY_(a) # a
00060
00061 namespace toppers
00062 {
00063
00064 template <bool> struct static_assertion
00065 {
00066 enum { okay = 1 };
00067 };
00068
00069 template <> struct static_assertion<false> {};
00070
00071 namespace detail
00072 {
00073 int assertion_failed(const char* expr, const char* file, int line) throw();
00074 }
00075
00076 }
00077
00096 #if TKERNEL_MAKER == 0x0118 || defined(assert)
00097 #define TOPPERS_ASSERT assert
00098 #elif !defined(NDEBUG)
00099 #define TOPPERS_ASSERT(expr) ((void)((expr) ? 0 : ::toppers::detail::assertion_failed(#expr, __FILE__, __LINE__)))
00100 #else
00101 #define TOPPERS_ASSERT(expr) ((void)0)
00102 #endif
00103
00116 #define TOPPERS_STATIC_ASSERT(expr) typedef int TOPPERS_JOIN(toppers_diagnostics_, __LINE__)[toppers::static_assertion<!!(expr)>::okay]
00117
00118 #endif // ! TOPPERS_ASSERT_HPP_