ajs | cee3df1 | 2004-11-24 17:14:49 +0000 | [diff] [blame] | 1 | #ifndef _QUAGGA_ASSERT_H |
| 2 | #define _QUAGGA_ASSERT_H |
| 3 | |
| 4 | extern void _zlog_assert_failed (const char *assertion, const char *file, |
| 5 | unsigned int line, const char *function) |
| 6 | __attribute__ ((noreturn)); |
| 7 | |
| 8 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 9 | #define __ASSERT_FUNCTION __func__ |
| 10 | #elif defined(__GNUC__) |
| 11 | #define __ASSERT_FUNCTION __FUNCTION__ |
| 12 | #else |
| 13 | #define __ASSERT_FUNCTION NULL |
| 14 | #endif |
| 15 | |
| 16 | #define zassert(EX) ((void)((EX) ? 0 : \ |
| 17 | (_zlog_assert_failed(#EX, __FILE__, __LINE__, \ |
| 18 | __ASSERT_FUNCTION), 0))) |
| 19 | |
| 20 | #undef assert |
| 21 | #define assert(EX) zassert(EX) |
| 22 | |
| 23 | #endif /* _QUAGGA_ASSERT_H */ |