From 48aa7e9385ce265d51e8b75fb6e583c682201c54 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 26 Jan 2017 15:47:35 +0100 Subject: 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 --- driver/Commandline.ml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'driver/Commandline.ml') 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 -- cgit