musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/exit/assert.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016年08月30日 16:39:54 -0400
committerRich Felker <dalias@aerifal.cx>2016年08月30日 16:39:54 -0400
commite738b8cbe64b6dd3ed9f47b6d4cd7eb2c422b38d (patch)
tree493734a392e2dfc2f84e8a5c92c4c848b2752794 /src/exit/assert.c
parent397586625e71d166f493f16bfe04f3005ae464c3 (diff)
downloadmusl-e738b8cbe64b6dd3ed9f47b6d4cd7eb2c422b38d.tar.gz
restore _Noreturn to __assert_fail
this reverts commit 2c1f8fd5da3306fd7c8a2267467e44eb61f12dd4. 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.
Diffstat (limited to 'src/exit/assert.c')
-rw-r--r--src/exit/assert.c 2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/exit/assert.c b/src/exit/assert.c
index e87442a7..49b0dc3e 100644
--- a/src/exit/assert.c
+++ b/src/exit/assert.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
-void __assert_fail(const char *expr, const char *file, int line, const char *func)
+_Noreturn void __assert_fail(const char *expr, const char *file, int line, const char *func)
{
fprintf(stderr, "Assertion failed: %s (%s: %s: %d)\n", expr, file, func, line);
fflush(NULL);
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月10日 08:28:31 +0000

AltStyle によって変換されたページ (->オリジナル) /