Ensure assert_fail and abort have noreturn attribute

This commit is contained in:
Jeremy Soller
2023-03-10 11:23:56 -07:00
parent 334e33cfde
commit e7b70fdb93
9 changed files with 275 additions and 112 deletions
+3
View File
@@ -8,3 +8,6 @@ cpp_compat = true
[enum]
prefix_with_name = true
[fn]
no_return = "__attribute__((noreturn))"
+8 -1
View File
@@ -89,12 +89,19 @@ pub unsafe extern "C" fn a64l(s: *const c_char) -> c_long {
c_long::from(l)
}
#[no_mangle]
pub unsafe extern "C" fn abort() -> ! {
eprintln!("Legacy Abort");
intrinsics::abort();
}
#[no_mangle]
pub unsafe extern "C" fn __abort(
func: *const c_char,
file: *const c_char,
line: c_int,
) {
) -> ! {
let func = CStr::from_ptr(func).to_str().unwrap();
let file = CStr::from_ptr(file).to_str().unwrap();