add warnings for gc:option (#19722)
This commit is contained in:
parent
2f32b450d3
commit
465fd06d50
1 changed files with 49 additions and 42 deletions
|
|
@ -527,6 +527,50 @@ proc unregisterArcOrc(conf: ConfigRef) =
|
||||||
excl conf.globalOptions, optSeqDestructors
|
excl conf.globalOptions, optSeqDestructors
|
||||||
excl conf.globalOptions, optTinyRtti
|
excl conf.globalOptions, optTinyRtti
|
||||||
|
|
||||||
|
proc processMemoryManagementOption(switch, arg: string, pass: TCmdLinePass,
|
||||||
|
info: TLineInfo; conf: ConfigRef) =
|
||||||
|
if conf.backend == backendJs: return # for: bug #16033
|
||||||
|
expectArg(conf, switch, arg, pass, info)
|
||||||
|
if pass in {passCmd2, passPP}:
|
||||||
|
case arg.normalize
|
||||||
|
of "boehm":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
|
conf.selectedGC = gcBoehm
|
||||||
|
defineSymbol(conf.symbols, "boehmgc")
|
||||||
|
incl conf.globalOptions, optTlsEmulation # Boehm GC doesn't scan the real TLS
|
||||||
|
of "refc":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
|
conf.selectedGC = gcRefc
|
||||||
|
of "markandsweep":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
|
conf.selectedGC = gcMarkAndSweep
|
||||||
|
defineSymbol(conf.symbols, "gcmarkandsweep")
|
||||||
|
of "destructors", "arc":
|
||||||
|
registerArcOrc(pass, conf, false)
|
||||||
|
of "orc":
|
||||||
|
registerArcOrc(pass, conf, true)
|
||||||
|
of "hooks":
|
||||||
|
conf.selectedGC = gcHooks
|
||||||
|
defineSymbol(conf.symbols, "gchooks")
|
||||||
|
incl conf.globalOptions, optSeqDestructors
|
||||||
|
processOnOffSwitchG(conf, {optSeqDestructors}, arg, pass, info)
|
||||||
|
if pass in {passCmd2, passPP}:
|
||||||
|
defineSymbol(conf.symbols, "nimSeqsV2")
|
||||||
|
of "go":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
|
conf.selectedGC = gcGo
|
||||||
|
defineSymbol(conf.symbols, "gogc")
|
||||||
|
of "none":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
|
conf.selectedGC = gcNone
|
||||||
|
defineSymbol(conf.symbols, "nogc")
|
||||||
|
of "stack", "regions":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
|
conf.selectedGC = gcRegions
|
||||||
|
defineSymbol(conf.symbols, "gcregions")
|
||||||
|
of "v2": warningOptionNoop(arg)
|
||||||
|
else: localError(conf, info, errNoneBoehmRefcExpectedButXFound % arg)
|
||||||
|
|
||||||
proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||||
conf: ConfigRef) =
|
conf: ConfigRef) =
|
||||||
var
|
var
|
||||||
|
|
@ -626,48 +670,11 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||||
processOnOffSwitchG(conf, {optForceFullMake}, arg, pass, info)
|
processOnOffSwitchG(conf, {optForceFullMake}, arg, pass, info)
|
||||||
of "project":
|
of "project":
|
||||||
processOnOffSwitchG(conf, {optWholeProject, optGenIndex}, arg, pass, info)
|
processOnOffSwitchG(conf, {optWholeProject, optGenIndex}, arg, pass, info)
|
||||||
of "gc", "mm":
|
of "gc":
|
||||||
if conf.backend == backendJs: return # for: bug #16033
|
warningDeprecated(conf, info, "`gc:option` is deprecated; use `mm:option` instead")
|
||||||
expectArg(conf, switch, arg, pass, info)
|
processMemoryManagementOption(switch, arg, pass, info, conf)
|
||||||
if pass in {passCmd2, passPP}:
|
of "mm":
|
||||||
case arg.normalize
|
processMemoryManagementOption(switch, arg, pass, info, conf)
|
||||||
of "boehm":
|
|
||||||
unregisterArcOrc(conf)
|
|
||||||
conf.selectedGC = gcBoehm
|
|
||||||
defineSymbol(conf.symbols, "boehmgc")
|
|
||||||
incl conf.globalOptions, optTlsEmulation # Boehm GC doesn't scan the real TLS
|
|
||||||
of "refc":
|
|
||||||
unregisterArcOrc(conf)
|
|
||||||
conf.selectedGC = gcRefc
|
|
||||||
of "markandsweep":
|
|
||||||
unregisterArcOrc(conf)
|
|
||||||
conf.selectedGC = gcMarkAndSweep
|
|
||||||
defineSymbol(conf.symbols, "gcmarkandsweep")
|
|
||||||
of "destructors", "arc":
|
|
||||||
registerArcOrc(pass, conf, false)
|
|
||||||
of "orc":
|
|
||||||
registerArcOrc(pass, conf, true)
|
|
||||||
of "hooks":
|
|
||||||
conf.selectedGC = gcHooks
|
|
||||||
defineSymbol(conf.symbols, "gchooks")
|
|
||||||
incl conf.globalOptions, optSeqDestructors
|
|
||||||
processOnOffSwitchG(conf, {optSeqDestructors}, arg, pass, info)
|
|
||||||
if pass in {passCmd2, passPP}:
|
|
||||||
defineSymbol(conf.symbols, "nimSeqsV2")
|
|
||||||
of "go":
|
|
||||||
unregisterArcOrc(conf)
|
|
||||||
conf.selectedGC = gcGo
|
|
||||||
defineSymbol(conf.symbols, "gogc")
|
|
||||||
of "none":
|
|
||||||
unregisterArcOrc(conf)
|
|
||||||
conf.selectedGC = gcNone
|
|
||||||
defineSymbol(conf.symbols, "nogc")
|
|
||||||
of "stack", "regions":
|
|
||||||
unregisterArcOrc(conf)
|
|
||||||
conf.selectedGC = gcRegions
|
|
||||||
defineSymbol(conf.symbols, "gcregions")
|
|
||||||
of "v2": warningOptionNoop(arg)
|
|
||||||
else: localError(conf, info, errNoneBoehmRefcExpectedButXFound % arg)
|
|
||||||
of "warnings", "w":
|
of "warnings", "w":
|
||||||
if processOnOffSwitchOrList(conf, {optWarns}, arg, pass, info): listWarnings(conf)
|
if processOnOffSwitchOrList(conf, {optWarns}, arg, pass, info): listWarnings(conf)
|
||||||
of "warning": processSpecificNote(arg, wWarning, pass, info, switch, conf)
|
of "warning": processSpecificNote(arg, wWarning, pass, info, switch, conf)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue