blob: 77ebf5d381098278f66aba8371dd02f8ebb50c85 [file] [log] [blame]
ajscee3df12004-11-24 17:14:49 +00001#ifndef _QUAGGA_ASSERT_H
2#define _QUAGGA_ASSERT_H
3
4extern 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 */