2023-05-26 22:21:07 +03:00
|
|
|
#ifndef __ASSERT_H
|
|
|
|
#define _ASSERT_H 1
|
2022-12-13 00:51:57 +02:00
|
|
|
|
2023-05-26 22:21:07 +03:00
|
|
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html
|
2022-12-13 00:51:57 +02:00
|
|
|
|
2023-05-26 22:21:07 +03:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
|
|
|
#ifdef NDEBUG
|
2024-06-17 16:49:26 +03:00
|
|
|
#define assert(ignore) ((void)0)
|
2023-05-26 22:21:07 +03:00
|
|
|
#else
|
2024-06-17 16:49:26 +03:00
|
|
|
#define assert(expr) ((expr) ? (void)0 : __assert_fail(#expr, __FILE__, __LINE__, __func__))
|
2023-05-26 22:21:07 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
2023-12-14 15:13:54 +02:00
|
|
|
[[noreturn]] void __assert_fail(const char*, const char*, int, const char*);
|
2023-05-26 22:21:07 +03:00
|
|
|
|
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif
|