summary refs log tree commit diff stats
path: root/compiler/commands.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-01-20 01:49:59 -0800
committerGitHub <noreply@github.com>2021-01-20 10:49:59 +0100
commit4fc7fcb775140dc774a713063917fbf7d1392bdf (patch)
treeffb29f080816cc85e7a47a96cde8e79945d023a8 /compiler/commands.nim
parent2bedb0fe2c38424a53ec7376c05db09090af9f93 (diff)
downloadNim-4fc7fcb775140dc774a713063917fbf7d1392bdf.tar.gz
`--hintAsError` (#16763)
* --hintAsError

* add test, changelog

* condsyms
Diffstat (limited to 'compiler/commands.nim')
-rw-r--r--compiler/commands.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index bc1a63cc4..0c835a2f7 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -191,7 +191,8 @@ proc processSpecificNote*(arg: string, state: TSpecialWord, pass: TCmdLinePass,
   if i == arg.len: discard
   elif i < arg.len and (arg[i] in {':', '='}): inc(i)
   else: invalidCmdLineOption(conf, pass, orig, info)
-  if state == wHint:
+  # unfortunately, hintUser and warningUser clash
+  if state in {wHint, wHintAsError}:
     let x = findStr(hintMin, hintMax, id, errUnknown)
     if x != errUnknown: n = TNoteKind(x)
     else: localError(conf, info, "unknown hint: " & id)
@@ -209,13 +210,13 @@ proc processSpecificNote*(arg: string, state: TSpecialWord, pass: TCmdLinePass,
     incl(conf.modifiedyNotes, n)
     case val
     of "on":
-      if state == wWarningAsError:
-        incl(conf.warningAsErrors, n)
+      if state in {wWarningAsError, wHintAsError}:
+        incl(conf.warningAsErrors, n) # xxx rename warningAsErrors to noteAsErrors
       else:
         incl(conf.notes, n)
         incl(conf.mainPackageNotes, n)
     of "off":
-      if state == wWarningAsError:
+      if state in {wWarningAsError, wHintAsError}:
         excl(conf.warningAsErrors, n)
       else:
         excl(conf.notes, n)
@@ -607,6 +608,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
   of "warning": processSpecificNote(arg, wWarning, pass, info, switch, conf)
   of "hint": processSpecificNote(arg, wHint, pass, info, switch, conf)
   of "warningaserror": processSpecificNote(arg, wWarningAsError, pass, info, switch, conf)
+  of "hintaserror": processSpecificNote(arg, wHintAsError, pass, info, switch, conf)
   of "hints":
     if processOnOffSwitchOrList(conf, {optHints}, arg, pass, info): listHints(conf)
   of "threadanalysis": processOnOffSwitchG(conf, {optThreadAnalysis}, arg, pass, info)