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

namespace Kakoune
{

void on_assert_failed(const char* message);

}

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

#ifdef assert
#undef assert
#endif

#define assert(condition) \
    if (not (condition)) \
        on_assert_failed("assert failed \"" #condition "\" at " __FILE__ ":" TOSTRING(__LINE__))

#endif // assert_hh_INCLUDED