mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
std.os.abort: take advantage of @trap
This commit is contained in:
parent
cdb9cc8f6b
commit
8558983c86
@ -575,22 +575,12 @@ pub fn abort() noreturn {
|
||||
raise(SIG.KILL) catch {};
|
||||
exit(127); // Pid 1 might not be signalled in some containers.
|
||||
}
|
||||
if (builtin.os.tag == .uefi) {
|
||||
exit(0); // TODO choose appropriate exit code
|
||||
switch (builtin.os.tag) {
|
||||
.uefi, .wasi, .cuda => @trap(),
|
||||
else => system.abort(),
|
||||
}
|
||||
if (builtin.os.tag == .wasi) {
|
||||
exit(1);
|
||||
}
|
||||
if (builtin.os.tag == .cuda) {
|
||||
// TODO: introduce `@trap` instead of abusing https://github.com/ziglang/zig/issues/2291
|
||||
@"llvm.trap"();
|
||||
}
|
||||
|
||||
system.abort();
|
||||
}
|
||||
|
||||
extern fn @"llvm.trap"() noreturn;
|
||||
|
||||
pub const RaiseError = UnexpectedError;
|
||||
|
||||
pub fn raise(sig: u8) RaiseError!void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user