Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AssertMsg.h
Go to the documentation of this file.
1 
20 #ifndef LIMBO_PREPROCESSOR_ASSERTMSG_H
21 #define LIMBO_PREPROCESSOR_ASSERTMSG_H
22 
23 #include <iostream>
24 #include <limbo/preprocessor/Msg.h>
25 
33 #ifndef NO_LIMBO_ASSERTION
34 #define assert_msg(condition, message) \
35  do { \
36  if (! (condition)) { \
37  std::cerr << __FILE__ << ":" << __LINE__ << ": " << __PRETTY_FUNCTION__ << ": Assertion `" << #condition << "' failed: " << message << std::endl; \
38  abort(); \
39  } \
40  } while (false)
41 #else
42 #define assert_msg(condition, message) \
43  do { \
44  assert(condition); \
45  } while (false)
46 #endif
47 
52 #define limboAssertMsg(condition, args...) do {\
53  if (!(condition)) \
54  {\
55  ::limbo::limboPrintAssertMsg(#condition, __FILE__, __LINE__, __PRETTY_FUNCTION__, args); \
56  abort(); \
57  }\
58 } while (false)
59 
64 #define limboAssert(condition) do {\
65  if (!(condition)) \
66  {\
67  ::limbo::limboPrintAssertMsg(#condition, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
68  abort(); \
69  }\
70 } while (false)
71 
73 namespace limbo
74 {
75 
77 template <bool>
78 struct StaticAssert;
80 template <>
81 struct StaticAssert<true> {};
82 
83 } // namespace limbo
84 
87 #define limboStaticAssert(condition) {\
88  limbo::StaticAssert<(condition) != 0>(); \
89 }
90 
91 #endif
header to include PrintMsg.h and AssertMsg.h
static assertion
Definition: AssertMsg.h:78
namespace for Limbo
Definition: GraphUtility.h:22