fixes #18921 [backport] (#18930)

This commit is contained in:
Andreas Rumpf 2021-09-30 12:09:42 +02:00 • committed by GitHub
commit c38ab3e257
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -482,18 +482,20 @@ proc setCommandEarly*(conf: ConfigRef, command: string) =
else: else:
conf.foreignPackageNotes = foreignPackageNotesDefault 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! # Keep this syncronized with the default config/nim.cfg!
if cmpIgnoreStyle(key, "nimQuirky") == 0: if cmpIgnoreStyle(key, "nimQuirky") == 0:
conf.exc = excQuirky conf.exc = excQuirky
elif cmpIgnoreStyle(key, "release") == 0 or cmpIgnoreStyle(key, "danger") == 0: elif cmpIgnoreStyle(key, "release") == 0 or cmpIgnoreStyle(key, "danger") == 0:
conf.options.excl {optStackTrace, optLineTrace, optLineDir, optOptimizeSize} if pass in {passCmd1, passPP}:
conf.globalOptions.excl {optExcessiveStackTrace, optCDebug} conf.options.excl {optStackTrace, optLineTrace, optLineDir, optOptimizeSize}
conf.options.incl optOptimizeSpeed conf.globalOptions.excl {optExcessiveStackTrace, optCDebug}
conf.options.incl optOptimizeSpeed
if cmpIgnoreStyle(key, "danger") == 0 or cmpIgnoreStyle(key, "quick") == 0: if cmpIgnoreStyle(key, "danger") == 0 or cmpIgnoreStyle(key, "quick") == 0:
conf.options.excl {optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck, if pass in {passCmd1, passPP}:
optOverflowCheck, optAssert, optStackTrace, optLineTrace, optLineDir} conf.options.excl {optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck,
conf.globalOptions.excl {optCDebug} optOverflowCheck, optAssert, optStackTrace, optLineTrace, optLineDir}
conf.globalOptions.excl {optCDebug}
proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo; proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
conf: ConfigRef) = conf: ConfigRef) =
@ -565,10 +567,10 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
expectArg(conf, switch, arg, pass, info) expectArg(conf, switch, arg, pass, info)
if {':', '='} in arg: if {':', '='} in arg:
splitSwitch(conf, arg, key, val, pass, info) splitSwitch(conf, arg, key, val, pass, info)
specialDefine(conf, key) specialDefine(conf, key, pass)
defineSymbol(conf.symbols, key, val) defineSymbol(conf.symbols, key, val)
else: else:
specialDefine(conf, arg) specialDefine(conf, arg, pass)
defineSymbol(conf.symbols, arg) defineSymbol(conf.symbols, arg)
of "undef", "u": of "undef", "u":
expectArg(conf, switch, arg, pass, info) expectArg(conf, switch, arg, pass, info)