summaryrefslogtreecommitdiff
path: root/src/assert.hh
blob: f178e1ada5b81207ea7c0caf8a19ca7d30bcf81a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef assert_hh_INCLUDED
#define assert_hh_INCLUDED

namespace Kakoune
{

class String;

// return true if user asked to ignore the error
bool notify_fatal_error(const String& message);

void on_assert_failed(const char* message);

}

#define STRINGIFY(X) #X
#define TOSTRING(X) STRINGIFY(X)
#define COMMA ,

#ifdef KAK_DEBUG
    #define kak_assert(condition) \
        if (not (condition)) \
            on_assert_failed("assert failed \"" #condition \
                             "\" at " __FILE__ ":" TOSTRING(__LINE__))
#else
    #define kak_assert(condition)
#endif


#endif // assert_hh_INCLUDED