banan-os/libc/include/assert.h

21 lines
406 B
C
Raw Normal View History

#ifndef __ASSERT_H
#define _ASSERT_H 1
2022-12-13 00:51:57 +02:00
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html
2022-12-13 00:51:57 +02:00
#include <sys/cdefs.h>
#ifdef NDEBUG
#define assert(ignore)((void) 0)
#else
#define assert(expr) do { if (!(expr)) __assert_fail(#expr, __FILE__, __LINE__, __func__); } while (0)
#endif
__BEGIN_DECLS
void __assert_fail(const char*, const char*, int, const char*);
__END_DECLS
#endif