diff options
author | François Pottier <francois.pottier@inria.fr> | 2015-10-20 21:58:03 +0200 |
---|---|---|
committer | François Pottier <francois.pottier@inria.fr> | 2015-10-23 11:35:02 +0200 |
commit | 026c78ba5bce18516268b47b3bcd2c19142544dc (patch) | |
tree | a01bba6e3ae59cee4be9130febf90b1ddcc75194 | |
parent | c0643d38d5b26d707e85f7dd930d1dea2256872f (diff) | |
download | compcert-026c78ba5bce18516268b47b3bcd2c19142544dc.tar.gz compcert-026c78ba5bce18516268b47b3bcd2c19142544dc.zip |
Added [Cerrors.fatal_error_raw].
-rw-r--r-- | cparser/Cerrors.ml | 12 | ||||
-rw-r--r-- | cparser/Cerrors.mli | 1 |
2 files changed, 13 insertions, 0 deletions
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 diff --git a/cparser/Cerrors.mli b/cparser/Cerrors.mli index 6d34451b..3e315fad 100644 --- a/cparser/Cerrors.mli +++ b/cparser/Cerrors.mli @@ -16,6 +16,7 @@ val warn_error : bool ref val reset : unit -> unit exception Abort +val fatal_error_raw : ('a, out_channel, unit, 'b) format4 -> 'a val fatal_error : ('a, Format.formatter, unit, unit, unit, 'b) format6 -> 'a val error : ('a, Format.formatter, unit, unit, unit, unit) format6 -> 'a val warning : ('a, Format.formatter, unit, unit, unit, unit) format6 -> 'a |