1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-21 18:41:29 +03:00
kakoune/src/assert.hh

30 lines
582 B
C++
Raw Normal View History

2011-09-09 23:24:18 +04:00
#ifndef assert_hh_INCLUDED
#define assert_hh_INCLUDED
namespace Kakoune
{
2016-03-01 01:15:36 +03:00
class StringView;
// return true if user asked to ignore the error
2016-03-01 01:15:36 +03:00
bool notify_fatal_error(StringView message);
2012-10-17 19:01:08 +04:00
void on_assert_failed(const char* message);
2011-09-09 23:24:18 +04:00
}
#define STRINGIFY(X) #X
#define TOSTRING(X) STRINGIFY(X)
#ifdef KAK_DEBUG
#define kak_assert(...) \
if (not (__VA_ARGS__)) \
on_assert_failed("assert failed \"" #__VA_ARGS__ \
"\" at " __FILE__ ":" TOSTRING(__LINE__))
#else
#define kak_assert(...)
#endif
2011-09-09 23:24:18 +04:00
#endif // assert_hh_INCLUDED