Skip to content

Commit a110da8

Browse files
committed
Moved fatal_error from Coqtop to Errors and corrected dependencies accordingly.
This allows fatal_error to be used for printing anomalies at loading time.
1 parent 29fcfc4 commit a110da8

File tree

10 files changed

+25
-11
lines changed

10 files changed

+25
-11
lines changed

checker/check.mllib

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Coq_config
22

33
Hook
4+
Terminal
45
Canary
56
Hashset
67
Hashcons
@@ -23,13 +24,14 @@ Pp
2324
Segmenttree
2425
Unicodetable
2526
Unicode
26-
Errors
2727
CObj
2828
CList
2929
CString
3030
CArray
3131
CStack
3232
Util
33+
Ppstyle
34+
Errors
3335
Ephemeron
3436
Future
3537
CUnix

dev/printers.mllib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ Pp
2727
Segmenttree
2828
Unicodetable
2929
Unicode
30-
Errors
3130
CObj
3231
CList
3332
CString
3433
CArray
3534
CStack
3635
Util
36+
Ppstyle
37+
Errors
3738
Bigint
3839
Dyn
3940
CUnix
@@ -154,7 +155,6 @@ Tok
154155
Lexer
155156
Ppextend
156157
Pputils
157-
Ppstyle
158158
Ppannotation
159159
Stdarg
160160
Constrarg

grammar/grammar.mllib

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Coq_config
22

33
Hook
4+
Terminal
45
Canary
56
Hashset
67
Hashcons
@@ -19,12 +20,14 @@ Serialize
1920
Stateid
2021
Feedback
2122
Pp
22-
Errors
23+
2324
CList
2425
CString
2526
CArray
2627
CStack
2728
Util
29+
Ppstyle
30+
Errors
2831
Bigint
2932
Predicate
3033
Segmenttree

lib/clib.mllib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Util
2929
Stateid
3030
Feedback
3131
Pp
32+
Ppstyle
3233
Xml_lexer
3334
Xml_parser
3435
Xml_printer

lib/errors.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,13 @@ let handled e =
129129
let bottom _ = raise Bottom in
130130
try let _ = print_gen bottom !handle_stack e in true
131131
with Bottom -> false
132+
133+
(** Prints info which is either an error or
134+
an anomaly and then exits with the appropriate
135+
error code *)
136+
137+
let fatal_error info anomaly =
138+
let msg = info ++ fnl () in
139+
pp_with ~pp_tag:Ppstyle.pp_tag !Pp_control.err_ft msg;
140+
flush_all ();
141+
exit (if anomaly then 129 else 1)

lib/errors.mli

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,8 @@ val noncritical : exn -> bool
9292
(** Check whether an exception is handled by some toplevel printer. The
9393
[Anomaly] exception is never handled. *)
9494
val handled : exn -> bool
95+
96+
(** Prints info which is either an error or
97+
an anomaly and then exits with the appropriate
98+
error code *)
99+
val fatal_error : Pp.std_ppcmds -> bool -> 'a
File renamed without changes.
File renamed without changes.

printing/printing.mllib

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
Genprint
22
Pputils
3-
Ppstyle
43
Ppannotation
54
Ppconstr
65
Ppconstrsig

toplevel/coqtop.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ let () = at_exit flush_all
2020

2121
let ( / ) = Filename.concat
2222

23-
let fatal_error info anomaly =
24-
let msg = info ++ fnl () in
25-
pp_with ~pp_tag:Ppstyle.pp_tag !Pp_control.err_ft msg;
26-
flush_all ();
27-
exit (if anomaly then 129 else 1)
28-
2923
let get_version_date () =
3024
try
3125
let ch = open_in (Envars.coqlib () / "revision") in

0 commit comments

Comments
 (0)