From 857e746959f1eb9d0158073114d5ae0aa1c2fc1f Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 9 Feb 2018 09:53:12 +0100 Subject: Added error summary in case of fatal error. --- cparser/Diagnostics.ml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cparser/Diagnostics.ml') diff --git a/cparser/Diagnostics.ml b/cparser/Diagnostics.ml index d9b96393..fbdc9297 100644 --- a/cparser/Diagnostics.ml +++ b/cparser/Diagnostics.ml @@ -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 "@[%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 "@[%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); -- cgit