From 026c78ba5bce18516268b47b3bcd2c19142544dc Mon Sep 17 00:00:00 2001 From: François Pottier Date: Tue, 20 Oct 2015 21:58:03 +0200 Subject: Added [Cerrors.fatal_error_raw]. --- cparser/Cerrors.ml | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cparser/Cerrors.ml') diff --git a/cparser/Cerrors.ml b/cparser/Cerrors.ml index 23ec1710..5c077f37 100644 --- a/cparser/Cerrors.ml +++ b/cparser/Cerrors.ml @@ -26,6 +26,18 @@ let reset () = num_errors := 0; num_warnings := 0 exception Abort +(* [fatal_error_raw] is identical to [fatal_error], except it uses [Printf] + to print its message, as opposed to [Format], and does not automatically + introduce indentation and a final dot into the message. This is useful + for multi-line messages. *) + +let fatal_error_raw fmt = + incr num_errors; + Printf.kfprintf + (fun _ -> raise Abort) + stderr + (fmt ^^ "Fatal error; compilation aborted.\n%!") + let fatal_error fmt = incr num_errors; kfprintf -- cgit