revert #20719; relieve std/assertions of the sysFatal dep (#20743)

* Revert "make `system/fatal` importable (#20718)"

This reverts commit d735c447d3.

* relieve `std/assertions` of the sysFatal dep
This commit is contained in:
ringabout 2022-11-04 16:53:19 +08:00 • committed by GitHub
commit 12a20b9fb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 28 deletions

View file

@ -9,22 +9,27 @@
{.push profiler: off.}
when defined(nimHasExceptionsQuery):
const gotoBasedExceptions = compileOption("exceptions", "goto")
else:
const gotoBasedExceptions = false
when hostOS == "standalone":
include "$projectpath/panicoverride"
func sysFatal*(exceptn: typedesc, message: string) {.inline.} =
func sysFatal(exceptn: typedesc, message: string) {.inline.} =
panic(message)
func sysFatal*(exceptn: typedesc, message, arg: string) {.inline.} =
func sysFatal(exceptn: typedesc, message, arg: string) {.inline.} =
rawoutput(message)
panic(arg)
elif (defined(nimQuirky) or defined(nimPanics)) and not defined(nimscript):
import system/ansi_c
import ansi_c
func name(t: typedesc): string {.magic: "TypeTrait".}
func sysFatal*(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
func sysFatal(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
when nimvm:
# TODO when doAssertRaises works in CT, add a test for it
raise (ref exceptn)(msg: message & arg)
@ -41,14 +46,14 @@ elif (defined(nimQuirky) or defined(nimPanics)) and not defined(nimscript):
cstderr.rawWrite buf
quit 1
func sysFatal*(exceptn: typedesc, message: string) {.inline, noreturn.} =
func sysFatal(exceptn: typedesc, message: string) {.inline, noreturn.} =
sysFatal(exceptn, message, "")
else:
func sysFatal*(exceptn: typedesc, message: string) {.inline, noreturn.} =
func sysFatal(exceptn: typedesc, message: string) {.inline, noreturn.} =
raise (ref exceptn)(msg: message)
func sysFatal*(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
func sysFatal(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
raise (ref exceptn)(msg: message & arg)
{.pop.}