@@ -199,23 +199,21 @@ proc processSpecificNote*(arg: string, state: TSpecialWord, pass: TCmdLinePass,
199199 let x = findStr (lineinfos.WarningsToStr , id)
200200 if x >= 0 : n = TNoteKind (x + ord (warnMin))
201201 else : localError (conf, info, " unknown warning: " & id)
202- case substr (arg, i).normalize
203- of " on" :
204- incl (conf.notes, n)
205- incl (conf.mainPackageNotes, n)
206- incl (conf.enableNotes, n)
207- if pass == passCmd1:
208- incl (conf.cmdLineNotes, n)
209- excl (conf.cmdLineDisabledNotes, n)
210- of " off" :
211- excl (conf.notes, n)
212- excl (conf.mainPackageNotes, n)
213- incl (conf.disableNotes, n)
214- excl (conf.foreignPackageNotes, n)
215- if pass == passCmd1:
216- incl (conf.cmdLineDisabledNotes, n)
217- excl (conf.cmdLineNotes, n)
218- else : localError (conf, info, errOnOrOffExpectedButXFound % arg)
202+
203+ let val = substr (arg, i).normalize
204+ if val notin [" on" , " off" ]:
205+ localError (conf, info, errOnOrOffExpectedButXFound % arg)
206+ elif n notin conf.cmdlineNotes or pass == passCmd1:
207+ if pass == passCmd1: incl (conf.cmdlineNotes, n)
208+ incl (conf.modifiedyNotes, n)
209+ case val
210+ of " on" :
211+ incl (conf.notes, n)
212+ incl (conf.mainPackageNotes, n)
213+ of " off" :
214+ excl (conf.notes, n)
215+ excl (conf.mainPackageNotes, n)
216+ excl (conf.foreignPackageNotes, n)
219217
220218proc processCompile (conf: ConfigRef ; filename: string ) =
221219 var found = findFile (conf, filename)
@@ -598,7 +596,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
598596 of " deadcodeelim" : discard # deprecated, dead code elim always on
599597 of " threads" :
600598 processOnOffSwitchG (conf, {optThreads}, arg, pass, info)
601- # if optThreads in conf.globalOptions: incl( conf.notes, warnGcUnsafe)
599+ # if optThreads in conf.globalOptions: conf.setNote( warnGcUnsafe)
602600 of " tlsemulation" : processOnOffSwitchG (conf, {optTlsEmulation}, arg, pass, info)
603601 of " taintmode" : processOnOffSwitchG (conf, {optTaintMode}, arg, pass, info)
604602 of " implicitstatic" :
@@ -710,9 +708,10 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
710708 if verbosity notin {0 .. 3 }:
711709 localError (conf, info, " invalid verbosity level: '$1'" % arg)
712710 conf.verbosity = verbosity
713- conf.notes = NotesVerbosity [conf.verbosity]
714- incl (conf.notes, conf.enableNotes)
715- excl (conf.notes, conf.disableNotes)
711+ var verb = NotesVerbosity [conf.verbosity]
712+ # # We override the default `verb` by explicitly modified (set/unset) notes.
713+ conf.notes = (conf.modifiedyNotes * conf.notes + verb) -
714+ (conf.modifiedyNotes * verb - conf.notes)
716715 conf.mainPackageNotes = conf.notes
717716 of " parallelbuild" :
718717 expectArg (conf, switch, arg, pass, info)
0 commit comments