2011-09-09 23:24:18 +04:00
|
|
|
#ifndef assert_hh_INCLUDED
|
|
|
|
#define assert_hh_INCLUDED
|
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
2012-10-17 19:01:08 +04:00
|
|
|
void on_assert_failed(const char* message);
|
2012-10-16 18:16:32 +04:00
|
|
|
|
2011-09-09 23:24:18 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#define STRINGIFY(X) #X
|
|
|
|
#define TOSTRING(X) STRINGIFY(X)
|
2012-03-26 00:15:54 +04:00
|
|
|
#define COMMA ,
|
2011-09-09 23:24:18 +04:00
|
|
|
|
|
|
|
#ifdef assert
|
|
|
|
#undef assert
|
|
|
|
#endif
|
|
|
|
|
2013-02-27 22:02:01 +04:00
|
|
|
#ifdef KAK_DEBUG
|
|
|
|
#define assert(condition) \
|
|
|
|
if (not (condition)) \
|
|
|
|
on_assert_failed("assert failed \"" #condition \
|
|
|
|
"\" at " __FILE__ ":" TOSTRING(__LINE__))
|
|
|
|
#else
|
|
|
|
#define assert(condition)
|
|
|
|
#endif
|
|
|
|
|
2011-09-09 23:24:18 +04:00
|
|
|
|
|
|
|
#endif // assert_hh_INCLUDED
|