Added --noCppExceptions switch
This commit is contained in:
parent
2dd324632d
commit
378c904131
6 changed files with 18 additions and 3 deletions
|
|
@ -2111,8 +2111,10 @@ proc expr(p: BProc, n: PNode, d: var TLoc) =
|
||||||
initLocExpr(p, n.sons[0], a)
|
initLocExpr(p, n.sons[0], a)
|
||||||
of nkAsmStmt: genAsmStmt(p, n)
|
of nkAsmStmt: genAsmStmt(p, n)
|
||||||
of nkTryStmt:
|
of nkTryStmt:
|
||||||
if p.module.compileToCpp: genTryCpp(p, n, d)
|
if p.module.compileToCpp and optNoCppExceptions notin gGlobalOptions:
|
||||||
else: genTry(p, n, d)
|
genTryCpp(p, n, d)
|
||||||
|
else:
|
||||||
|
genTry(p, n, d)
|
||||||
of nkRaiseStmt: genRaiseStmt(p, n)
|
of nkRaiseStmt: genRaiseStmt(p, n)
|
||||||
of nkTypeSection:
|
of nkTypeSection:
|
||||||
# we have to emit the type information for object types here to support
|
# we have to emit the type information for object types here to support
|
||||||
|
|
|
||||||
|
|
@ -619,6 +619,10 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) =
|
||||||
cAssembler = nameToCC(arg)
|
cAssembler = nameToCC(arg)
|
||||||
if cAssembler notin cValidAssemblers:
|
if cAssembler notin cValidAssemblers:
|
||||||
localError(info, errGenerated, "'$1' is not a valid assembler." % [arg])
|
localError(info, errGenerated, "'$1' is not a valid assembler." % [arg])
|
||||||
|
of "nocppexceptions":
|
||||||
|
expectNoArg(switch, arg, pass, info)
|
||||||
|
incl(gGlobalOptions, optNoCppExceptions)
|
||||||
|
defineSymbol("noCppExceptions")
|
||||||
else:
|
else:
|
||||||
if strutils.find(switch, '.') >= 0: options.setConfigVar(switch, arg)
|
if strutils.find(switch, '.') >= 0: options.setConfigVar(switch, arg)
|
||||||
else: invalidCmdLineOption(pass, switch, info)
|
else: invalidCmdLineOption(pass, switch, info)
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ type # please make sure we have under 32 options
|
||||||
# also: generate header file
|
# also: generate header file
|
||||||
optIdeDebug # idetools: debug mode
|
optIdeDebug # idetools: debug mode
|
||||||
optIdeTerse # idetools: use terse descriptions
|
optIdeTerse # idetools: use terse descriptions
|
||||||
|
optNoCppExceptions # use C exception handling even with CPP
|
||||||
TGlobalOptions* = set[TGlobalOption]
|
TGlobalOptions* = set[TGlobalOption]
|
||||||
TCommands* = enum # Nim's commands
|
TCommands* = enum # Nim's commands
|
||||||
# **keep binary compatible**
|
# **keep binary compatible**
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ Advanced options:
|
||||||
--putenv:key=value set an environment variable
|
--putenv:key=value set an environment variable
|
||||||
--NimblePath:PATH add a path for Nimble support
|
--NimblePath:PATH add a path for Nimble support
|
||||||
--noNimblePath deactivate the Nimble path
|
--noNimblePath deactivate the Nimble path
|
||||||
|
--noCppExceptions use default exception handling with C++ backend
|
||||||
--excludePath:PATH exclude a path from the list of search paths
|
--excludePath:PATH exclude a path from the list of search paths
|
||||||
--dynlibOverride:SYMBOL marks SYMBOL so that dynlib:SYMBOL
|
--dynlibOverride:SYMBOL marks SYMBOL so that dynlib:SYMBOL
|
||||||
has no effect and can be statically linked instead;
|
has no effect and can be statically linked instead;
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ proc raiseExceptionAux(e: ref Exception) =
|
||||||
if not localRaiseHook(e): return
|
if not localRaiseHook(e): return
|
||||||
if globalRaiseHook != nil:
|
if globalRaiseHook != nil:
|
||||||
if not globalRaiseHook(e): return
|
if not globalRaiseHook(e): return
|
||||||
when defined(cpp):
|
when defined(cpp) and not defined(noCppExceptions):
|
||||||
if e[] of OutOfMemError:
|
if e[] of OutOfMemError:
|
||||||
showErrorMessage(e.name)
|
showErrorMessage(e.name)
|
||||||
quitOrDebug()
|
quitOrDebug()
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,13 @@ Library Additions
|
||||||
- The rlocks module has been added providing reentrant lock synchronization
|
- The rlocks module has been added providing reentrant lock synchronization
|
||||||
primitive
|
primitive
|
||||||
|
|
||||||
|
Compiler Additions
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Added a new ``--noCppExceptions`` switch that allows to use default exception
|
||||||
|
handling (no ``throw`` or ``try``/``catch`` generated) when compiling to C++
|
||||||
|
code
|
||||||
|
|
||||||
|
|
||||||
2016-01-27 Nim in Action is now available!
|
2016-01-27 Nim in Action is now available!
|
||||||
==========================================
|
==========================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue