summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-02-19 00:33:47 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-02-19 00:33:47 +0100
commit12b5c0985d7e7449d98a6f80a77369368698b0a3 (patch)
tree4e43446bc4b2fbbfd97ea2b94a67b8718e5e82f1 /compiler
parent9a63ac36702f2a595a41bc27737394b1bdd53030 (diff)
parent378c904131f267fc9281f89b8df6ee0c2dcb008e (diff)
downloadNim-12b5c0985d7e7449d98a6f80a77369368698b0a3.tar.gz
Merge pull request #3881 from endragor/nocppexceptions
Added --noCppExceptions switch
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgexprs.nim6
-rw-r--r--compiler/commands.nim4
-rw-r--r--compiler/options.nim1
3 files changed, 9 insertions, 2 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index fcc36e4fd..1a5334a98 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -2111,8 +2111,10 @@ proc expr(p: BProc, n: PNode, d: var TLoc) =
       initLocExpr(p, n.sons[0], a)
   of nkAsmStmt: genAsmStmt(p, n)
   of nkTryStmt:
-    if p.module.compileToCpp: genTryCpp(p, n, d)
-    else: genTry(p, n, d)
+    if p.module.compileToCpp and optNoCppExceptions notin gGlobalOptions:
+      genTryCpp(p, n, d)
+    else:
+      genTry(p, n, d)
   of nkRaiseStmt: genRaiseStmt(p, n)
   of nkTypeSection:
     # we have to emit the type information for object types here to support
diff --git a/compiler/commands.nim b/compiler/commands.nim
index 8dacebd83..2622d64f4 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -619,6 +619,10 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) =
     cAssembler = nameToCC(arg)
     if cAssembler notin cValidAssemblers:
       localError(info, errGenerated, "'$1' is not a valid assembler." % [arg])
+  of "nocppexceptions":
+    expectNoArg(switch, arg, pass, info)
+    incl(gGlobalOptions, optNoCppExceptions)
+    defineSymbol("noCppExceptions")
   else:
     if strutils.find(switch, '.') >= 0: options.setConfigVar(switch, arg)
     else: invalidCmdLineOption(pass, switch, info)
diff --git a/compiler/options.nim b/compiler/options.nim
index 82d18e242..29cdd96fb 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -66,6 +66,7 @@ type                          # please make sure we have under 32 options
                               # also: generate header file
     optIdeDebug               # idetools: debug mode
     optIdeTerse               # idetools: use terse descriptions
+    optNoCppExceptions        # use C exception handling even with CPP
   TGlobalOptions* = set[TGlobalOption]
   TCommands* = enum           # Nim's commands
                               # **keep binary compatible**