37 #if defined(SIMPLE_DISABLE_ASSERTS)
39 # define SIMPLE_ASSERT(expr) ((void)0)
41 #elif defined(SIMPLE_ENABLE_ASSERT_HANDLER)
44 #include <stringstream>
48 void assertion_failed(
char const * expr,
49 char const *
function,
char const * file,
long line);
52 #define SIMPLE_ASSERT(expr) ((expr) \
54 : ::moose::assertion_failed(#expr, SIMPLE_CURRENT_FUNCTION, __FILE__, __LINE__))
58 # define SIMPLE_ASSERT(expr) assert(expr)
65 # undef SIMPLE_ASSERT_MSG
67 #if defined(SIMPLE_DISABLE_ASSERTS) || defined(NDEBUG)
69 #define SIMPLE_ASSERT_MSG(expr, msg) ((void)0)
71 #elif defined(SIMPLE_ENABLE_ASSERT_HANDLER)
78 char const *
function,
char const * file,
long line);
81 #define SIMPLE_ASSERT_MSG(expr, msg) ((expr) \
83 : ::moose::assertion_failed_msg(#expr, msg, SIMPLE_CURRENT_FUNCTION, __FILE__, __LINE__))
86 #ifndef SIMPLE_ASSERT_HPP
87 #define SIMPLE_ASSERT_HPP
94 #ifndef SIMPLE_ASSERT_MSG_OSTREAM
95 # define SIMPLE_ASSERT_MSG_OSTREAM std::cerr
105 char const * file,
long line)
108 <<
"***** Internal Program Error - assertion (" << expr <<
") failed in "
110 << file <<
'(' << line <<
"): " << msg << std::endl;
123 #define SIMPLE_ASSERT_MSG(expr, msg) ((expr) \
125 : ::moose::assertion::detail::assertion_failed_msg(#expr, msg, \
126 SIMPLE_CURRENT_FUNCTION, __FILE__, __LINE__))
135 #if defined(SIMPLE_DISABLE_ASSERTS) || ( !defined(MOOSE_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
137 # define SIMPLE_VERIFY(expr) ((void)(expr))
141 # define SIMPLE_VERIFY(expr) MOOSE_ASSERT(expr)
149 #define SIMPLE_WARN(condition, msg) \
150 if(! (condition) ) { \
151 std::ostringstream ss; \
152 ss << endl << "[WARN] " << msg; \
153 std::cout << ss.str() \
155 std::cout << "\n\t|- " << "In function: " << SIMPLE_CURRENT_FUNCTION \
156 << "\n\t+ In file: " << __FILE__ << ":" << __LINE__ << std::endl; \
void assertion_failed_msg(char const *expr, char const *msg, char const *function, char const *file, long line)
#define SIMPLE_ASSERT_MSG_OSTREAM