aboutsummaryrefslogtreecommitdiffstats
path: root/driver
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
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')
-rw-r--r--driver/Commandline.ml17
-rw-r--r--driver/Commandline.mli5
2 files changed, 22 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
diff --git a/driver/Commandline.mli b/driver/Commandline.mli
index 197d0b04..65253749 100644
--- a/driver/Commandline.mli
+++ b/driver/Commandline.mli
@@ -40,3 +40,8 @@ val parse_cmdline: (pattern * action) list -> unit
(* Note on precedence: [Exact] patterns are tried first, then the other
patterns are tried in the order in which they appear in the list. *)
+
+val longopt_int: string -> (int -> unit) -> pattern * action
+(** [longopt_int key fn] generates a pattern and an action for
+ options of the form [key=<n>] and calls [fn] with the integer argument
+*)