mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-04-29 18:24:42 +00:00
parent
2584a86ab4
commit
bb96099c65
1 changed files with 3 additions and 10 deletions
|
@ -6,18 +6,11 @@ COSMOPOLITAN_C_START_
|
||||||
void __assert_fail(const char *, const char *, int) hidden wontreturn relegated;
|
void __assert_fail(const char *, const char *, int) hidden wontreturn relegated;
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define __ASSERT_FAIL(EXPR, FILE, LINE)
|
#define assert(EXPR) ((void)0)
|
||||||
#else
|
#else
|
||||||
#define __ASSERT_FAIL(EXPR, FILE, LINE) __assert_fail(EXPR, FILE, LINE)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define assert(EXPR) \
|
#define assert(EXPR) \
|
||||||
do { \
|
((void)((EXPR) || (__assert_fail(#EXPR, __FILE__, __LINE__), 0)))
|
||||||
if (!(EXPR)) { \
|
#endif
|
||||||
__ASSERT_FAIL(#EXPR, __FILE__, __LINE__); \
|
|
||||||
unreachable; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define static_assert _Static_assert
|
#define static_assert _Static_assert
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue