hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit b2f0d7d58a84dd6474bdeccd01d7a0f23aec3bbc
parent 78a8255df679a44a899b8ec7e86a12b1ce70a378
Author: Bor Grošelj Simić <bgs@turminal.net>
Date:   Sun, 14 May 2023 23:14:05 +0200

unify fixed and non-fixed abort paths

Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>

Diffstat:
Mrt/abort+test.ha | 8+-------
Mrt/abort.ha | 12+-----------
2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/rt/abort+test.ha b/rt/abort+test.ha @@ -33,11 +33,5 @@ const reasons: [_]str = [ ]; export @noreturn fn abort_fixed(loc: str, i: int) void = { - match (jmp) { - case let j: *jmpbuf => - reason = abort_reason { loc = loc, msg = reasons[i] }; - longjmp(j, 1); - case null => - platform_abort(loc, reasons[i]); - }; + _abort(loc, reasons[i]); }; diff --git a/rt/abort.ha b/rt/abort.ha @@ -18,15 +18,5 @@ const reasons: [_]str = [ ]; export @noreturn fn abort_fixed(loc: str, i: int) void = { - // TODO: This is also platform-specific - const prefix = "Abort: "; - const sep = ": "; - const linefeed = "\n"; - write(STDERR_FILENO, *(&prefix: **void): *const u8, len(prefix)): void; - write(STDERR_FILENO, *(&loc: **void): *const u8, len(loc)): void; - write(STDERR_FILENO, *(&sep: **void): *const u8, len(sep)): void; - write(STDERR_FILENO, *(&reasons[i]: **void): *const u8, len(reasons[i])): void; - write(STDERR_FILENO, *(&linefeed: **void): *const u8, 1): void; - kill(getpid(), SIGABRT): void; - for (true) void; + platform_abort(loc, reasons[i]); };