mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Improve debug binary location detection
This commit is contained in:
parent
68c7c9c1e0
commit
7a9e176ecf
17 changed files with 92 additions and 50 deletions
|
@ -15,7 +15,7 @@
|
|||
COSMOPOLITAN_C_START_
|
||||
|
||||
void __assert_fail(const char *, const char *, int);
|
||||
void __unassert_fail(const char *, const char *, int);
|
||||
void unassert(const char *, const char *, int);
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define assert(x) ((void)0)
|
||||
|
@ -32,14 +32,14 @@ void __unassert_fail(const char *, const char *, int);
|
|||
#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)) { \
|
||||
__unassert_fail(s, __FILE__, __LINE__); \
|
||||
__asm__("nop"); \
|
||||
__builtin_unreachable(); \
|
||||
} \
|
||||
(void)0; \
|
||||
#define __assert_macro(x, s) \
|
||||
({ \
|
||||
if (__builtin_expect(!(x), 0)) { \
|
||||
(unassert)(s, __FILE__, __LINE__); \
|
||||
__asm__("nop"); \
|
||||
__builtin_unreachable(); \
|
||||
} \
|
||||
(void)0; \
|
||||
})
|
||||
#else
|
||||
#define npassert(x) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue