1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Objective Caml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
2001-06-15 12:09:45 -07:00
|
|
|
(* WARNING: if you change something in this file, you must look at
|
|
|
|
errors.ml to see if you need to make the same changes there.
|
|
|
|
*)
|
1995-07-02 09:51:07 -07:00
|
|
|
|
2000-03-06 21:02:33 -08:00
|
|
|
open Format
|
1995-07-02 09:51:07 -07:00
|
|
|
|
|
|
|
(* Report an error *)
|
|
|
|
|
2000-03-06 21:02:33 -08:00
|
|
|
let report_error ppf exn =
|
|
|
|
let report ppf = function
|
2002-11-01 09:06:47 -08:00
|
|
|
| Lexer.Error(err, l) ->
|
|
|
|
Location.print ppf l;
|
2000-03-06 21:02:33 -08:00
|
|
|
Lexer.report_error ppf err
|
1997-08-22 01:55:41 -07:00
|
|
|
| Syntaxerr.Error err ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Syntaxerr.report_error ppf err
|
2002-02-08 02:14:31 -08:00
|
|
|
| Pparse.Error ->
|
|
|
|
fprintf ppf "Preprocessor error"
|
1995-07-02 09:51:07 -07:00
|
|
|
| Env.Error err ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Env.report_error ppf err
|
2001-06-15 12:09:45 -07:00
|
|
|
| Ctype.Tags(l, l') -> fprintf ppf
|
|
|
|
"In this program,@ variant constructors@ `%s and `%s@ \
|
|
|
|
have the same hash value." l l'
|
1995-07-02 09:51:07 -07:00
|
|
|
| Typecore.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Typecore.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Typetexp.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Typetexp.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Typedecl.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Typedecl.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Includemod.Error err ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Includemod.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Typemod.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Typemod.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Translcore.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Translcore.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Compilenv.Error code ->
|
2000-04-21 01:13:22 -07:00
|
|
|
Compilenv.report_error ppf code
|
1995-07-02 09:51:07 -07:00
|
|
|
| Asmgen.Error code ->
|
2000-04-21 01:13:22 -07:00
|
|
|
Asmgen.report_error ppf code
|
1995-07-02 09:51:07 -07:00
|
|
|
| Asmlink.Error code ->
|
2000-04-21 01:13:22 -07:00
|
|
|
Asmlink.report_error ppf code
|
1995-07-11 11:07:53 -07:00
|
|
|
| Asmlibrarian.Error code ->
|
2000-04-21 01:13:22 -07:00
|
|
|
Asmlibrarian.report_error ppf code
|
2002-02-08 08:55:44 -08:00
|
|
|
| Asmpackager.Error code ->
|
|
|
|
Asmpackager.report_error ppf code
|
1995-07-02 09:51:07 -07:00
|
|
|
| Sys_error msg ->
|
2000-03-06 21:02:33 -08:00
|
|
|
fprintf ppf "I/O error: %s" msg
|
1996-04-22 04:15:41 -07:00
|
|
|
| Typeclass.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Typeclass.report_error ppf err
|
2001-06-15 12:09:45 -07:00
|
|
|
| Translclass.Error(loc, err) ->
|
|
|
|
Location.print ppf loc; Translclass.report_error ppf err
|
|
|
|
| Warnings.Errors (n) ->
|
|
|
|
fprintf ppf "@.Error: %d error-enabled warnings occurred." n
|
2000-03-06 21:02:33 -08:00
|
|
|
| x -> fprintf ppf "@]"; raise x in
|
|
|
|
|
|
|
|
fprintf ppf "@[%a@]@." report exn
|