Make development more pleasant on MacOS Arm64

This commit is contained in:
Justine Tunney 2023-11-12 05:42:17 -08:00
parent f7cad70da1
commit 0863427b3a
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
8 changed files with 90 additions and 10 deletions

View file

@ -14,7 +14,8 @@
#define _ASSERT_H
COSMOPOLITAN_C_START_
void __assert_fail(const char *, const char *, int) wontreturn relegated;
void __assert_fail(const char *, const char *, int);
void __unassert_fail(const char *, const char *, int);
#ifdef NDEBUG
#define assert(x) ((void)0)
@ -31,12 +32,14 @@ void __assert_fail(const char *, const char *, int) wontreturn relegated;
#ifndef NDEBUG
#define unassert(x) __assert_macro(x, #x)
#define npassert(x) __assert_macro(x, #x)
#define __assert_macro(x, s) \
({ \
if (__builtin_expect(!(x), 0)) { \
__assert_fail(s, __FILE__, __LINE__); \
} \
(void)0; \
#define __assert_macro(x, s) \
({ \
if (__builtin_expect(!(x), 0)) { \
__unassert_fail(s, __FILE__, __LINE__); \
__asm__("nop"); \
__builtin_unreachable(); \
} \
(void)0; \
})
#else
#define npassert(x) \