Skip to content

Commit

Permalink
fixes #18921 [backport]
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq committed Sep 30, 2021
1 parent 6bb32da commit 321e6a3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -482,18 +482,20 @@ proc setCommandEarly*(conf: ConfigRef, command: string) =
else:
conf.foreignPackageNotes = foreignPackageNotesDefault

proc specialDefine(conf: ConfigRef, key: string) =
proc specialDefine(conf: ConfigRef, key: string; pass: TCmdLinePass) =
# Keep this syncronized with the default config/nim.cfg!
if cmpIgnoreStyle(key, "nimQuirky") == 0:
conf.exc = excQuirky
elif cmpIgnoreStyle(key, "release") == 0 or cmpIgnoreStyle(key, "danger") == 0:
conf.options.excl {optStackTrace, optLineTrace, optLineDir, optOptimizeSize}
conf.globalOptions.excl {optExcessiveStackTrace, optCDebug}
conf.options.incl optOptimizeSpeed
if pass in {passCmd1, passPP}:
conf.options.excl {optStackTrace, optLineTrace, optLineDir, optOptimizeSize}
conf.globalOptions.excl {optExcessiveStackTrace, optCDebug}
conf.options.incl optOptimizeSpeed
if cmpIgnoreStyle(key, "danger") == 0 or cmpIgnoreStyle(key, "quick") == 0:
conf.options.excl {optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck,
optOverflowCheck, optAssert, optStackTrace, optLineTrace, optLineDir}
conf.globalOptions.excl {optCDebug}
if pass in {passCmd1, passPP}:
conf.options.excl {optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck,
optOverflowCheck, optAssert, optStackTrace, optLineTrace, optLineDir}
conf.globalOptions.excl {optCDebug}

proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
conf: ConfigRef) =
Expand Down Expand Up @@ -565,10 +567,10 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
expectArg(conf, switch, arg, pass, info)
if {':', '='} in arg:
splitSwitch(conf, arg, key, val, pass, info)
specialDefine(conf, key)
specialDefine(conf, key, pass)
defineSymbol(conf.symbols, key, val)
else:
specialDefine(conf, arg)
specialDefine(conf, arg, pass)
defineSymbol(conf.symbols, arg)
of "undef", "u":
expectArg(conf, switch, arg, pass, info)
Expand Down

0 comments on commit 321e6a3

Please sign in to comment.