summaryrefslogtreecommitdiffstats
path: root/src/include/assert.h
blob: 13888bee841bcda32241b1967ad4d6c988fc9804 (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
31
#include <builtins.h>

#ifndef _ASSERT_H
#define _ASSERT_H

#ifdef __cplusplus
extern "C"
{
#endif

NO_RETURN
void __assert(bool expr, const char *exprStr, const char *file, int line);

#define assert(expr) \
{\
    if (!(expr))\
    {\
        __assert((expr), #expr, __FILE__, __LINE__);\
    }\
}\

#ifdef NDEBUG 
#undef assert
#define assert(expr) { }
#endif

#ifdef __cplusplus
};
#endif

#endif
OpenPOWER on IntegriCloud