fixes #21195; std/assertions continue to use sysFatal when nimPreviewSlimSystem is not defined (#21196)

* fixes #21195; `std/assertions` continue to use `sysFatal`

* try includes

* make `std/assertions` self-contained

* fixes tests

* fixes tests
This commit is contained in:
ringabout 2022-12-30 03:15:08 +08:00 • committed by GitHub
commit ebd1c678be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 63 additions and 30 deletions

View file

@ -1081,31 +1081,9 @@ proc align(address, alignment: int): int =
else:
result = (address + (alignment - 1)) and not (alignment - 1)
when defined(nimNoQuit):
proc rawQuit(errorcode: int = QuitSuccess) = discard "ignoring quit"
elif defined(genode):
import genode/env
var systemEnv {.exportc: runtimeEnvSym.}: GenodeEnvPtr
type GenodeEnv* = GenodeEnvPtr
## Opaque type representing Genode environment.
proc rawQuit(env: GenodeEnv; errorcode: int) {.magic: "Exit", noreturn,
importcpp: "#->parent().exit(@); Genode::sleep_forever()", header: "<base/sleep.h>".}
proc rawQuit(errorcode: int = QuitSuccess) {.inline, noreturn.} =
systemEnv.rawQuit(errorcode)
elif defined(js) and defined(nodejs) and not defined(nimscript):
proc rawQuit(errorcode: int = QuitSuccess) {.magic: "Exit",
importc: "process.exit", noreturn.}
else:
proc rawQuit(errorcode: cint) {.
magic: "Exit", importc: "exit", header: "<stdlib.h>", noreturn.}
include system/rawquits
when defined(genode):
export GenodeEnv
template sysAssert(cond: bool, msg: string) =
when defined(useSysAssert):