25 #ifndef __CCL_ASSERT_H__
26 # define __CCL_ASSERT_H__
51 # define ccl_assert(_cond_) \
52 CCL_CHECK_CONDITION ("assertion", _cond_, __FILE__, __LINE__)
57 # define ccl_pre(_cond_) \
58 CCL_CHECK_CONDITION ("pre-condition", _cond_, __FILE__, __LINE__)
63 # define ccl_post(_cond_) \
64 CCL_CHECK_CONDITION ("post-condition", _cond_, __FILE__, __LINE__)
66 # if CCL_ENABLE_ASSERTIONS
68 # define CCL_CHECK_CONDITION(_t, _c, _f, _l) \
69 ccl_check_condition (_c, _f, _l, "failed " _t " " #_c)
71 # define ccl_unreachable() \
72 ccl_throw (unreachable_code_error, "unreachable code access")
75 # define CCL_CHECK_CONDITION(_t,_c,_f,_l) CCL_NOP ()
77 # define ccl_unreachable() CCL_NOP ()
84 # define ccl_imply(_a, _b) ((!(_a)) || (_b))
86 #define ccl_check_condition(cond_,file_, line_,msg_) \
87 ((cond_) ? 1 : (ccl_raise_assertion (file_,line_, msg_), 0))
90 ccl_raise_assertion (
const char *file,
int line,
const char *msg);
Some useful and common macros.
#define CCL_DECLARE_EXCEPTION(exc, super)
Macro-function used to declare an exception exc.