summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2023-03-31 04:16:09 +0200
committerGitHub <noreply@github.com>2023-03-31 04:16:09 +0200
commitd5719c47dce91152173263b08f3b8b12ee04b6ba (patch)
tree825faa1971842ec701602406f707413a07794093
parent2e4ba4ad93c6d9021b6de975cf7ac78e67acba26 (diff)
downloadNim-d5719c47dce91152173263b08f3b8b12ee04b6ba.tar.gz
make --exceptions:quirky work with C++ (#21581)
* make --exceptions:quirky work with C++

* make tests green again
-rw-r--r--lib/system/excpt.nim4
-rw-r--r--lib/system/fatal.nim6
-rw-r--r--tests/errmsgs/t14444.nim2
3 files changed, 7 insertions, 5 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index 86cfff9cd..6b40ca391 100644
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -448,7 +448,7 @@ proc raiseExceptionAux(e: sink(ref Exception)) {.nodestroy.} =
     else:
       pushCurrentException(e)
       {.emit: "throw `e`;".}
-  elif defined(nimQuirky) or gotoBasedExceptions:
+  elif quirkyExceptions or gotoBasedExceptions:
     pushCurrentException(e)
     when gotoBasedExceptions:
       inc nimInErrorMode
@@ -560,7 +560,7 @@ proc nimFrame(s: PFrame) {.compilerRtl, inl, raises: [].} =
 when defined(cpp) and appType != "lib" and not gotoBasedExceptions and
     not defined(js) and not defined(nimscript) and
     hostOS != "standalone" and hostOS != "any" and not defined(noCppExceptions) and
-    not defined(nimQuirky):
+    not quirkyExceptions:
 
   type
     StdException {.importcpp: "std::exception", header: "<exception>".} = object
diff --git a/lib/system/fatal.nim b/lib/system/fatal.nim
index 6073ee779..f1f94d078 100644
--- a/lib/system/fatal.nim
+++ b/lib/system/fatal.nim
@@ -9,7 +9,9 @@
 
 {.push profiler: off.}
 
-const gotoBasedExceptions = compileOption("exceptions", "goto")
+const
+  gotoBasedExceptions = compileOption("exceptions", "goto")
+  quirkyExceptions = compileOption("exceptions", "quirky")
 
 when hostOS == "standalone":
   include "$projectpath/panicoverride"
@@ -21,7 +23,7 @@ when hostOS == "standalone":
     rawoutput(message)
     panic(arg)
 
-elif (defined(nimQuirky) or defined(nimPanics)) and not defined(nimscript):
+elif (quirkyExceptions or defined(nimPanics)) and not defined(nimscript):
   import ansi_c
 
   func name(t: typedesc): string {.magic: "TypeTrait".}
diff --git a/tests/errmsgs/t14444.nim b/tests/errmsgs/t14444.nim
index 143b4542e..27365236e 100644
--- a/tests/errmsgs/t14444.nim
+++ b/tests/errmsgs/t14444.nim
@@ -3,7 +3,7 @@ discard """
   exitcode: "1"
   output: '''
 t14444.nim(13)           t14444
-fatal.nim(51)            sysFatal
+fatal.nim(53)            sysFatal
 Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]
 '''
 """