commit c9aa387c59912f8205f428e3fb5175fa915ec34b
parent 3d39248bb3adb5421a787c1549c467e3635057af
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 25 Apr 2021 09:31:34 -0400
rt: don't assert in rt::abort
If any of these calls fail, we need to just ignore the error. Using an
error assertion would cause a stack overflow by repeatedly calling
rt::abort.
Diffstat:
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/rt/+linux/abort.ha b/rt/+linux/abort.ha
@@ -1,8 +1,8 @@
fn platform_abort(msg: str) void = {
const prefix = "Abort: ";
const linefeed = "\n";
- write(2, *(&prefix: **void): *const char, len(prefix))!;
- write(2, *(&msg: **void): *const char, len(msg))!;
- write(2, *(&linefeed: **void): *const char, 1)!;
- kill(getpid(), SIGABRT)!;
+ write(2, *(&prefix: **void): *const char, len(prefix)): void;
+ write(2, *(&msg: **void): *const char, len(msg)): void;
+ write(2, *(&linefeed: **void): *const char, 1): void;
+ kill(getpid(), SIGABRT): void;
};
diff --git a/rt/abort.ha b/rt/abort.ha
@@ -14,10 +14,10 @@ export @noreturn fn abort_fixed(loc: str, i: int) void = {
const prefix = "Abort: ";
const sep = ": ";
const linefeed = "\n";
- write(2, *(&prefix: **void): *const char, len(prefix))!;
- write(2, *(&loc: **void): *const char, len(loc))!;
- write(2, *(&sep: **void): *const char, len(sep))!;
- write(2, *(&reasons[i]: **void): *const char, len(reasons[i]))!;
- write(2, *(&linefeed: **void): *const char, 1)!;
- kill(getpid(), SIGABRT)!;
+ write(2, *(&prefix: **void): *const char, len(prefix)): void;
+ write(2, *(&loc: **void): *const char, len(loc)): void;
+ write(2, *(&sep: **void): *const char, len(sep)): void;
+ write(2, *(&reasons[i]: **void): *const char, len(reasons[i])): void;
+ write(2, *(&linefeed: **void): *const char, 1): void;
+ kill(getpid(), SIGABRT): void;
};