[other] preparations for --styleCheck:error for the Nim compiler (#11478)

This commit is contained in:
Andreas Rumpf 2019-06-12 08:35:32 +02:00 • committed by GitHub
commit 572b7c37a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 43 deletions

View file

@ -474,10 +474,10 @@ when defined(endb):
when defined(cpp) and appType != "lib" and
not defined(js) and not defined(nimscript) and
hostOS != "standalone" and not defined(noCppExceptions):
type
type
StdException {.importcpp: "std::exception", header: "<exception>".} = object
proc what(ex: StdException): cstring {.importcpp: "((char *)#.what())".}
proc setTerminate(handler: proc() {.noconv.})
@ -497,7 +497,7 @@ when defined(cpp) and appType != "lib" and
msg = "Error: unhandled cpp exception: " & $e.what()
except:
msg = "Error: unhandled unknown cpp exception"
when defined(genode):
# stderr not available by default, use the LOG session
echo msg
@ -518,7 +518,7 @@ when not defined(noSignalHandler) and not defined(useNimRtl):
action("SIGABRT: Abnormal termination.\n")
elif s == SIGFPE: action("SIGFPE: Arithmetic error.\n")
elif s == SIGILL: action("SIGILL: Illegal operation.\n")
elif s == SIGBUS:
elif (when declared(SIGBUS): s == SIGBUS else: false):
action("SIGBUS: Illegal storage access. (Attempt to read from nil?)\n")
else:
block platformSpecificSignal:
@ -553,7 +553,8 @@ when not defined(noSignalHandler) and not defined(useNimRtl):
c_signal(SIGABRT, signalHandler)
c_signal(SIGFPE, signalHandler)
c_signal(SIGILL, signalHandler)
c_signal(SIGBUS, signalHandler)
when declared(SIGBUS):
c_signal(SIGBUS, signalHandler)
when declared(SIGPIPE):
c_signal(SIGPIPE, signalHandler)