mirror of
git://git.musl-libc.org/musl
synced 2024-12-17 20:24:54 +00:00
e738b8cbe6
this reverts commit 2c1f8fd5da
. without
the _Noreturn attribute, the compiler cannot use asserts to perform
reachability/range analysis. this leads to missed optimizations and
spurious warnings.
the original backtrace problem that prompted the removal of _Noreturn
was not clearly documented at the time, but it seems to happen only
when libc was built without -g, which also breaks many other
backtracing cases.
24 lines
428 B
C
24 lines
428 B
C
#include <features.h>
|
|
|
|
#undef assert
|
|
|
|
#ifdef NDEBUG
|
|
#define assert(x) (void)0
|
|
#else
|
|
#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
|
|
#endif
|
|
|
|
#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
|
|
#define static_assert _Static_assert
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
_Noreturn void __assert_fail (const char *, const char *, int, const char *);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|