Unverified Commit 857e7469 authored by Bernhard Schommer's avatar Bernhard Schommer
Browse files

Added error summary in case of fatal error.

parent d8da5069
......@@ -342,14 +342,24 @@ let error loc fmt =
let fatal_error loc fmt =
fatal_error None loc fmt
let error_summary () =
if !num_errors > 0 then begin
eprintf "@[<hov 0>%d error%s detected.@]@."
!num_errors
(if !num_errors = 1 then "" else "s");
num_errors := 0;
end
let check_errors () =
if !num_errors > 0 then begin
eprintf "@[<hov 0>%d error%s detected.@]@."
!num_errors
(if !num_errors = 1 then "" else "s");
num_errors := 0;
raise Abort
end
let error_option w =
let key = string_of_warning w in
[Exact ("-W"^key), Unit (activate_warning w);
......
......@@ -84,3 +84,6 @@ val no_loc : string * int
val file_loc : string -> string * int
(** [file_loc f] generates a location for file [f] *)
val error_summary : unit -> unit
(** Print a summary containing the numbers of errors encountered *)
......@@ -415,5 +415,5 @@ let _ =
with
| Sys_error msg
| CmdError msg -> error no_loc "%s" msg; exit 2
| Abort -> exit 2
| Abort -> error_summary (); exit 2
| e -> crash e
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment