HexAssert.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #ifndef HEXASSERT_HPP
00007 #define HEXASSERT_HPP
00008
00009
00010
00011 #define __HEX_ASSERT_VOID_CAST static_cast<void>
00012
00013 extern void HexAssertShutdown(const char* assertion,
00014 const char* file, int line,
00015 const char* function)
00016 __attribute__ ((__noreturn__));
00017
00018
00019 #ifdef NDEBUG
00020
00021 #define HexAssert(expr) __HEX_ASSERT_VOID_CAST(0)
00022
00023 #else
00024
00025 #define HexAssert(expr) \
00026 (__HEX_ASSERT_VOID_CAST ((expr) ? 0 : \
00027 (HexAssertShutdown(#expr, \
00028 __FILE__, __LINE__, \
00029 __PRETTY_FUNCTION__), 0)))
00030
00031 #endif // NDEBUG
00032
00033
00034
00035 #endif // HEXASSERT_HPP
00036