提交 e738b8cb 编写于 作者: R Rich Felker

restore _Noreturn to __assert_fail

this reverts commit 2c1f8fd5. 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.
上级 39758662
......@@ -16,7 +16,7 @@
extern "C" {
#endif
void __assert_fail (const char *, const char *, int, const char *);
_Noreturn void __assert_fail (const char *, const char *, int, const char *);
#ifdef __cplusplus
}
......
#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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册