summary refs log tree commit diff stats
path: root/compiler/commands.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2018-12-09 23:39:57 -0800
committerTimothee Cour <timothee.cour2@gmail.com>2018-12-09 23:39:57 -0800
commit9d10278a9ca0d90a5fe82fa6e7dfb7d7dcb0f38a (patch)
tree3f376e5254fa91742b63d24b24c7f53f4bb46cf0 /compiler/commands.nim
parentdaaf50ae0383e4b8250cfca7cfe3cee27a0290d9 (diff)
downloadNim-9d10278a9ca0d90a5fe82fa6e7dfb7d7dcb0f38a.tar.gz
--errorMax:0 means: unlimited
Diffstat (limited to 'compiler/commands.nim')
-rw-r--r--compiler/commands.nim10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index 576a7dc7f..40283489c 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -618,10 +618,14 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
     expectNoArg(conf, switch, arg, pass, info)
     incl(conf.globalOptions, optRun)
   of "errormax":
-    # Note: `nim check` (etc) can overwrite this;
-    # `0` is meaningless and has same effect as `1`
     expectArg(conf, switch, arg, pass, info)
-    conf.errorMax = parseInt(arg)
+    conf.errorMax = block:
+      # Note: `nim check` (etc) can overwrite this.
+      # `0` is meaningless, give it a useful meaning as in clang's -ferror-limit
+      # If user doesn't set this flag and the code doesn't either, it'd
+      # have the same effect as errorMax = 1
+      let ret = parseInt(arg)
+      if ret == 0: high(int) else: ret
   of "verbosity":
     expectArg(conf, switch, arg, pass, info)
     let verbosity = parseInt(arg)