31 lines
509 B
C
Raw Permalink Normal View History

#if defined(_ASSERT_H)
#undef _ASSERT_H
#undef assert
#undef __ASSERT_VOID_CAST
#endif
2024-11-11 23:50:38 +02:00
#ifndef _ASSERT_H
#define _ASSERT_H 1
#define __ASSERT_VOID_CAST (void)
2025-03-08 01:58:43 +02:00
#if !defined(NDEBUG)
2024-11-11 23:50:38 +02:00
#define assert(expr) \
((expr) ? __ASSERT_VOID_CAST(0) : __assert_fail(__FILE__, __LINE__, #expr))
2025-03-08 01:58:43 +02:00
#else
#define assert(expr) \
((void) 0)
#endif
2024-11-11 23:50:38 +02:00
2024-11-15 11:14:08 +02:00
#if defined(__cplusplus)
extern "C" {
#endif
2024-11-11 23:50:38 +02:00
[[noreturn]] void __assert_fail(const char *file, int line, const char *message);
2024-11-15 11:14:08 +02:00
#if defined(__cplusplus)
}
#endif
2024-11-11 23:50:38 +02:00
#endif