Unify process_alloc() and process_realloc() with PROCESS_ALLOC_MODE_REALLOC bit
[moveable_pool.git] / rassert.h
1 #ifndef _RASSERT_H
2 #define _RASSERT_H 1
3
4 // tries to be the same as assert(), but always present even with NDEBUG
5
6 #ifdef __FUZIX__
7 extern void __assert(const char *__expr, const char *__file, const int __line);
8
9 #if 1 // smaller code
10 #define rassert(expr)   \
11   ((void) ((expr) || (__assert ("",  __FILE__, __LINE__), 0)))
12 #else
13 #define rassert(expr)   \
14   ((void) ((expr) || (__assert (__STRING(expr),  __FILE__, __LINE__), 0)))
15 #endif
16 #elif defined(__GLIBC__)
17 extern void __assert_fail (const char *__assertion, const char *__file,
18                            unsigned int __line, const char *__function)
19      __THROW __attribute__ ((__noreturn__));
20
21 # define rassert(expr)                                                  \
22   ((expr)                                                               \
23    ? (void) (0)                                         \
24    : __assert_fail (#expr, __FILE__, __LINE__, __extension__ __PRETTY_FUNCTION__))
25 #else
26 // for unsupported platforms, it won't work with NDEBUG
27 #include <assert.h>
28
29 #define rassert(expr) assert(expr)
30 #endif
31
32 #endif