23
23
let report_error ppf exn =
24
24
let report ppf = function
25
25
| Lexer.Error(err, l) ->
26
Location.print_error ppf l;
27
27
Lexer.report_error ppf err
28
28
| Syntaxerr.Error err ->
29
29
Syntaxerr.report_error ppf err
31
Location.print_error_cur_file ppf;
31
32
fprintf ppf "Preprocessor error"
34
Location.print_error_cur_file ppf;
33
35
Env.report_error ppf err
34
| Ctype.Tags(l, l') -> fprintf ppf
36
| Ctype.Tags(l, l') ->
37
Location.print_error_cur_file ppf;
35
39
"In this program,@ variant constructors@ `%s and `%s@ \
36
40
have the same hash value.@ Change one of them." l l'
37
41
| Typecore.Error(loc, err) ->
38
Location.print ppf loc; Typecore.report_error ppf err
42
Location.print_error ppf loc; Typecore.report_error ppf err
39
43
| Typetexp.Error(loc, err) ->
40
Location.print ppf loc; Typetexp.report_error ppf err
44
Location.print_error ppf loc; Typetexp.report_error ppf err
41
45
| Typedecl.Error(loc, err) ->
42
Location.print ppf loc; Typedecl.report_error ppf err
46
Location.print_error ppf loc; Typedecl.report_error ppf err
43
47
| Typeclass.Error(loc, err) ->
44
Location.print ppf loc; Typeclass.report_error ppf err
48
Location.print_error ppf loc; Typeclass.report_error ppf err
45
49
| Includemod.Error err ->
50
Location.print_error_cur_file ppf;
46
51
Includemod.report_error ppf err
47
52
| Typemod.Error(loc, err) ->
48
Location.print ppf loc; Typemod.report_error ppf err
53
Location.print_error ppf loc; Typemod.report_error ppf err
49
54
| Translcore.Error(loc, err) ->
50
Location.print ppf loc; Translcore.report_error ppf err
55
Location.print_error ppf loc; Translcore.report_error ppf err
51
56
| Translclass.Error(loc, err) ->
52
Location.print ppf loc; Translclass.report_error ppf err
57
Location.print_error ppf loc; Translclass.report_error ppf err
53
58
| Translmod.Error(loc, err) ->
54
Location.print ppf loc; Translmod.report_error ppf err
59
Location.print_error ppf loc; Translmod.report_error ppf err
55
60
| Compilenv.Error code ->
61
Location.print_error_cur_file ppf;
56
62
Compilenv.report_error ppf code
57
63
| Asmgen.Error code ->
64
Location.print_error_cur_file ppf;
58
65
Asmgen.report_error ppf code
59
66
| Asmlink.Error code ->
67
Location.print_error_cur_file ppf;
60
68
Asmlink.report_error ppf code
61
69
| Asmlibrarian.Error code ->
70
Location.print_error_cur_file ppf;
62
71
Asmlibrarian.report_error ppf code
63
72
| Asmpackager.Error code ->
73
Location.print_error_cur_file ppf;
64
74
Asmpackager.report_error ppf code
76
Location.print_error_cur_file ppf;
66
77
fprintf ppf "I/O error: %s" msg
67
78
| Warnings.Errors (n) ->
68
fprintf ppf "@.Error: error-enabled warnings (%d occurrences)" n
79
Location.print_error_cur_file ppf;
80
fprintf ppf "Error-enabled warnings (%d occurrences)" n
69
81
| x -> fprintf ppf "@]"; raise x in
71
83
fprintf ppf "@[%a@]@." report exn