hare

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

commit 04b582a737335842925ae998fe3137110088552a
parent 051ab22004c2f32a0b64d147ac289a7b00f78be9
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat, 26 Nov 2022 12:53:22 +0100

Revert "Add location parameter to rc::_abort."

This reverts commit 218d566b85609cbe88b732927138b6451ba2a38d.

Diffstat:
Mrt/+freebsd/abort.ha | 5+----
Mrt/+linux/abort.ha | 5+----
Mrt/abort+test.ha | 4++--
Mrt/abort.ha | 16+++++++++++++---
4 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/rt/+freebsd/abort.ha b/rt/+freebsd/abort.ha @@ -1,13 +1,10 @@ // License: MPL-2.0 // (c) 2021 Drew DeVault <sir@cmpwn.com> -fn platform_abort(loc: str, msg: str) void = { +fn platform_abort(msg: str) void = { const prefix = "Abort: "; - const sep = ": "; const linefeed = "\n"; write(STDERR_FILENO, *(&prefix: **void): *const char, len(prefix)): void; - write(STDERR_FILENO, *(&loc: **void): *const char, len(loc)): void; - write(STDERR_FILENO, *(&sep: **void): *const char, len(sep)): void; write(STDERR_FILENO, *(&msg: **void): *const char, len(msg)): void; write(STDERR_FILENO, *(&linefeed: **void): *const char, 1): void; kill(getpid(), SIGABRT): void; diff --git a/rt/+linux/abort.ha b/rt/+linux/abort.ha @@ -1,13 +1,10 @@ // License: MPL-2.0 // (c) 2021 Drew DeVault <sir@cmpwn.com> -fn platform_abort(loc: str, msg: str) void = { +fn platform_abort(msg: str) void = { const prefix = "Abort: "; - const sep = ": "; const linefeed = "\n"; write(STDERR_FILENO, *(&prefix: **void): *const char, len(prefix)): void; - write(STDERR_FILENO, *(&loc: **void): *const char, len(loc)): void; - write(STDERR_FILENO, *(&sep: **void): *const char, len(sep)): void; write(STDERR_FILENO, *(&msg: **void): *const char, len(msg)): void; write(STDERR_FILENO, *(&linefeed: **void): *const char, 1): void; kill(getpid(), SIGABRT): void; diff --git a/rt/abort+test.ha b/rt/abort+test.ha @@ -2,8 +2,8 @@ // (c) 2021 Drew DeVault <sir@cmpwn.com> // (c) 2021 Eyal Sawady <ecs@d2evs.net> -export @noreturn @symbol("rt.abort") fn _abort(loc: str, msg: str) void = { - reason = abort_reason { loc = loc, msg = msg }; +export @noreturn @symbol("rt.abort") fn _abort(msg: str) void = { + reason = abort_reason { loc = "", msg = msg }; longjmp(&jmp, 1); }; diff --git a/rt/abort.ha b/rt/abort.ha @@ -1,8 +1,8 @@ // License: MPL-2.0 // (c) 2021 Drew DeVault <sir@cmpwn.com> -export @noreturn @symbol("rt.abort") fn _abort(loc: str, msg: str) void = { - platform_abort(loc, msg); +export @noreturn @symbol("rt.abort") fn _abort(msg: str) void = { + platform_abort(msg); }; // See harec:include/gen.h @@ -15,5 +15,15 @@ const reasons: [_]str = [ ]; export @noreturn fn abort_fixed(loc: str, i: int) void = { - platform_abort(loc, reasons[i]); + // TODO: This is also platform-specific + const prefix = "Abort: "; + const sep = ": "; + const linefeed = "\n"; + write(STDERR_FILENO, *(&prefix: **void): *const char, len(prefix)): void; + write(STDERR_FILENO, *(&loc: **void): *const char, len(loc)): void; + write(STDERR_FILENO, *(&sep: **void): *const char, len(sep)): void; + write(STDERR_FILENO, *(&reasons[i]: **void): *const char, len(reasons[i])): void; + write(STDERR_FILENO, *(&linefeed: **void): *const char, 1): void; + kill(getpid(), SIGABRT): void; + for (true) void; };