aboutsummaryrefslogtreecommitdiffstats
path: root/driver/Commandline.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2017-01-26 15:47:35 +0100
committerBernhard Schommer <bernhardschommer@gmail.com>2017-01-26 15:47:35 +0100
commit48aa7e9385ce265d51e8b75fb6e583c682201c54 (patch)
tree656460b11ac65e55c1417dd17f4059bf16787c75 /driver/Commandline.ml
parent141f8f8dfb7ed37ad5ad9eca568da86650f42a83 (diff)
downloadcompcert-48aa7e9385ce265d51e8b75fb6e583c682201c54.tar.gz
compcert-48aa7e9385ce265d51e8b75fb6e583c682201c54.zip
Added option -fmax-errors.
The option -fmax-errors limits the number of errors that are reported before the compilation is aborted. The default 0 means no limit. Bug 19872
Diffstat (limited to 'driver/Commandline.ml')
-rw-r--r--driver/Commandline.ml17
1 files changed, 17 insertions, 0 deletions
diff --git a/driver/Commandline.ml b/driver/Commandline.ml
index c0dd6257..b544c37b 100644
--- a/driver/Commandline.ml
+++ b/driver/Commandline.ml
@@ -115,3 +115,20 @@ let parse_cmdline spec =
with Responsefile.Error s ->
eprintf "%s" s;
exit 2
+
+let long_int_action key s =
+ let ls = String.length s
+ and lkey = String.length key in
+ assert (ls > lkey);
+ let s = String.sub s (lkey + 1) (ls - lkey - 1) in
+ try
+ int_of_string s
+ with Failure _ ->
+ eprintf "Argument to option `%s' must be an integer\n" key;
+ exit 2
+
+let longopt_int key f =
+ let act s =
+ let n = long_int_action key s in
+ f n in
+ Prefix (key ^ "="),Self act