diff options
author | Bernhard Schommer <bschommer@users.noreply.github.com> | 2018-02-08 16:38:54 +0100 |
---|---|---|
committer | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2018-02-08 16:38:54 +0100 |
commit | f02f00a01b598567f70e138c144d9581973802e6 (patch) | |
tree | db15b2ad60692f936435cdd784e7bb7f6a977a40 /driver/Commandline.mli | |
parent | 54fa98c3833091a75d0c1afe84b42afc35452fe3 (diff) | |
download | compcert-f02f00a01b598567f70e138c144d9581973802e6.tar.gz compcert-f02f00a01b598567f70e138c144d9581973802e6.zip |
Refactor the handling of errors and warnings (#44)
* Module Cerrors is now called Diagnostic and can be used in parts of CompCert other than cparser/
* Replaced eprintf error. Instead of having eprintf msg; exit 2 use the functions from the
Diagnostics module.
* Raise on error before calling external tools.
* Added diagnostics to clightgen.
* Fix error handling of AsmToJson.
* Cleanup error handling of Elab and C2C.
*The implementation of location printing (file & line) is simplified and correctly prints valid filenames with invalid lines.
Diffstat (limited to 'driver/Commandline.mli')
-rw-r--r-- | driver/Commandline.mli | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/driver/Commandline.mli b/driver/Commandline.mli index 32f5daf3..e1b917f2 100644 --- a/driver/Commandline.mli +++ b/driver/Commandline.mli @@ -35,12 +35,17 @@ type action = | Integer of (int -> unit) (** read next arg as an int, call function *) | Ignore (** ignore the next arg *) | Unit of (unit -> unit) (** call the function with unit as argument *) - -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. *) +exception CmdError of string +(** Raise by [parse_cmdline] when an error occured *) + +val parse_cmdline: (pattern * action) list -> unit +(** [parse_cmdline actions] parses the commandline and performs all [actions]. + Raises [CmdError] if an error occurred. +*) + 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 |