Disable setTerminate when noCppExceptions is defined (#7751)
This commit is contained in:
parent
27631b1112
commit
cda591a42f
2 changed files with 4 additions and 3 deletions
|
|
@ -265,7 +265,7 @@ proc rdCharLoc(a: TLoc): Rope =
|
||||||
|
|
||||||
proc genObjectInit(p: BProc, section: TCProcSection, t: PType, a: TLoc,
|
proc genObjectInit(p: BProc, section: TCProcSection, t: PType, a: TLoc,
|
||||||
takeAddr: bool) =
|
takeAddr: bool) =
|
||||||
if p.module.compileToCpp and t.isException:
|
if p.module.compileToCpp and t.isException and not isDefined("noCppExceptions"):
|
||||||
# init vtable in Exception object for polymorphic exceptions
|
# init vtable in Exception object for polymorphic exceptions
|
||||||
includeHeader(p.module, "<new>")
|
includeHeader(p.module, "<new>")
|
||||||
linefmt(p, section, "new ($1) $2;$n", rdLoc(a), getTypeDesc(p.module, t))
|
linefmt(p, section, "new ($1) $2;$n", rdLoc(a), getTypeDesc(p.module, t))
|
||||||
|
|
|
||||||
|
|
@ -4172,8 +4172,9 @@ template doAssertRaises*(exception, code: untyped): typed =
|
||||||
if wrong:
|
if wrong:
|
||||||
raiseAssert(astToStr(exception) & " wasn't raised by:\n" & astToStr(code))
|
raiseAssert(astToStr(exception) & " wasn't raised by:\n" & astToStr(code))
|
||||||
|
|
||||||
when defined(cpp) and appType != "lib" and not defined(js) and
|
when defined(cpp) and appType != "lib" and
|
||||||
not defined(nimscript) and hostOS != "standalone":
|
not defined(js) and not defined(nimscript) and
|
||||||
|
hostOS != "standalone" and not defined(noCppExceptions):
|
||||||
proc setTerminate(handler: proc() {.noconv.})
|
proc setTerminate(handler: proc() {.noconv.})
|
||||||
{.importc: "std::set_terminate", header: "<exception>".}
|
{.importc: "std::set_terminate", header: "<exception>".}
|
||||||
setTerminate proc() {.noconv.} =
|
setTerminate proc() {.noconv.} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue