31 lines
509 B
C
31 lines
509 B
C
#if defined(_ASSERT_H)
|
|
#undef _ASSERT_H
|
|
#undef assert
|
|
#undef __ASSERT_VOID_CAST
|
|
#endif
|
|
|
|
#ifndef _ASSERT_H
|
|
#define _ASSERT_H 1
|
|
|
|
#define __ASSERT_VOID_CAST (void)
|
|
|
|
#if !defined(NDEBUG)
|
|
#define assert(expr) \
|
|
((expr) ? __ASSERT_VOID_CAST(0) : __assert_fail(__FILE__, __LINE__, #expr))
|
|
#else
|
|
#define assert(expr) \
|
|
((void) 0)
|
|
#endif
|
|
|
|
#if defined(__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
|
|
[[noreturn]] void __assert_fail(const char *file, int line, const char *message);
|
|
|
|
#if defined(__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
#endif
|