PR#3114 make all error messages start with a location and "Error: "
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8705 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
0593f338d4
commit
e9a9bf9613
12
.depend
12
.depend
|
@ -663,16 +663,16 @@ driver/compile.cmo: utils/warnings.cmi typing/unused_var.cmi \
|
|||
typing/typemod.cmi typing/typedtree.cmi bytecomp/translmod.cmi \
|
||||
typing/stypes.cmi bytecomp/simplif.cmi typing/printtyp.cmi \
|
||||
bytecomp/printlambda.cmi bytecomp/printinstr.cmi parsing/printast.cmi \
|
||||
driver/pparse.cmi parsing/parse.cmi utils/misc.cmi typing/ident.cmi \
|
||||
typing/env.cmi bytecomp/emitcode.cmi utils/config.cmi utils/clflags.cmi \
|
||||
utils/ccomp.cmi bytecomp/bytegen.cmi driver/compile.cmi
|
||||
driver/pparse.cmi parsing/parse.cmi utils/misc.cmi parsing/location.cmi \
|
||||
typing/ident.cmi typing/env.cmi bytecomp/emitcode.cmi utils/config.cmi \
|
||||
utils/clflags.cmi utils/ccomp.cmi bytecomp/bytegen.cmi driver/compile.cmi
|
||||
driver/compile.cmx: utils/warnings.cmx typing/unused_var.cmx \
|
||||
typing/typemod.cmx typing/typedtree.cmx bytecomp/translmod.cmx \
|
||||
typing/stypes.cmx bytecomp/simplif.cmx typing/printtyp.cmx \
|
||||
bytecomp/printlambda.cmx bytecomp/printinstr.cmx parsing/printast.cmx \
|
||||
driver/pparse.cmx parsing/parse.cmx utils/misc.cmx typing/ident.cmx \
|
||||
typing/env.cmx bytecomp/emitcode.cmx utils/config.cmx utils/clflags.cmx \
|
||||
utils/ccomp.cmx bytecomp/bytegen.cmx driver/compile.cmi
|
||||
driver/pparse.cmx parsing/parse.cmx utils/misc.cmx parsing/location.cmx \
|
||||
typing/ident.cmx typing/env.cmx bytecomp/emitcode.cmx utils/config.cmx \
|
||||
utils/clflags.cmx utils/ccomp.cmx bytecomp/bytegen.cmx driver/compile.cmi
|
||||
driver/errors.cmo: utils/warnings.cmi typing/typetexp.cmi typing/typemod.cmi \
|
||||
typing/typedecl.cmi typing/typecore.cmi typing/typeclass.cmi \
|
||||
bytecomp/translmod.cmi bytecomp/translcore.cmi bytecomp/translclass.cmi \
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1,4 +1,4 @@
|
|||
3.11+dev7 Private_abbrevs+natdynlink (2007-11-28)
|
||||
3.11+dev8 Private_abbrevs+natdynlink (2007-12-04)
|
||||
|
||||
# The version string is the first line of this file.
|
||||
# It must be in the format described in stdlib/sys.mli
|
||||
|
|
|
@ -260,6 +260,17 @@ misc.o: misc.c ../byterun/config.h ../byterun/../config/m.h \
|
|||
../byterun/major_gc.h ../byterun/freelist.h ../byterun/misc.h \
|
||||
../byterun/mlvalues.h ../byterun/misc.h ../byterun/minor_gc.h \
|
||||
../byterun/misc.h ../byterun/misc.h ../byterun/mlvalues.h
|
||||
natdynlink.o: natdynlink.c ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
|
||||
../byterun/config.h ../byterun/misc.h ../byterun/memory.h \
|
||||
../byterun/config.h ../byterun/gc.h ../byterun/mlvalues.h \
|
||||
../byterun/major_gc.h ../byterun/freelist.h ../byterun/misc.h \
|
||||
../byterun/mlvalues.h ../byterun/misc.h ../byterun/minor_gc.h \
|
||||
../byterun/misc.h ../byterun/misc.h ../byterun/mlvalues.h stack.h \
|
||||
../byterun/callback.h ../byterun/mlvalues.h ../byterun/alloc.h \
|
||||
../byterun/misc.h ../byterun/mlvalues.h natdynlink.h \
|
||||
../byterun/osdeps.h ../byterun/misc.h ../byterun/fail.h \
|
||||
../byterun/misc.h ../byterun/mlvalues.h
|
||||
obj.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
|
||||
../byterun/config.h ../byterun/misc.h ../byterun/fail.h \
|
||||
|
@ -324,7 +335,7 @@ startup.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \
|
|||
../byterun/gc.h ../byterun/mlvalues.h ../byterun/gc_ctrl.h \
|
||||
../byterun/misc.h ../byterun/osdeps.h ../byterun/misc.h \
|
||||
../byterun/printexc.h ../byterun/misc.h ../byterun/mlvalues.h \
|
||||
../byterun/sys.h ../byterun/misc.h
|
||||
../byterun/sys.h ../byterun/misc.h natdynlink.h
|
||||
str.o: str.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
|
||||
../byterun/config.h ../byterun/misc.h ../byterun/fail.h \
|
||||
|
@ -628,6 +639,17 @@ misc.d.o: misc.c ../byterun/config.h ../byterun/../config/m.h \
|
|||
../byterun/major_gc.h ../byterun/freelist.h ../byterun/misc.h \
|
||||
../byterun/mlvalues.h ../byterun/misc.h ../byterun/minor_gc.h \
|
||||
../byterun/misc.h ../byterun/misc.h ../byterun/mlvalues.h
|
||||
natdynlink.d.o: natdynlink.c ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
|
||||
../byterun/config.h ../byterun/misc.h ../byterun/memory.h \
|
||||
../byterun/config.h ../byterun/gc.h ../byterun/mlvalues.h \
|
||||
../byterun/major_gc.h ../byterun/freelist.h ../byterun/misc.h \
|
||||
../byterun/mlvalues.h ../byterun/misc.h ../byterun/minor_gc.h \
|
||||
../byterun/misc.h ../byterun/misc.h ../byterun/mlvalues.h stack.h \
|
||||
../byterun/callback.h ../byterun/mlvalues.h ../byterun/alloc.h \
|
||||
../byterun/misc.h ../byterun/mlvalues.h natdynlink.h \
|
||||
../byterun/osdeps.h ../byterun/misc.h ../byterun/fail.h \
|
||||
../byterun/misc.h ../byterun/mlvalues.h
|
||||
obj.d.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
|
||||
../byterun/config.h ../byterun/misc.h ../byterun/fail.h \
|
||||
|
@ -692,7 +714,7 @@ startup.d.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \
|
|||
../byterun/gc.h ../byterun/mlvalues.h ../byterun/gc_ctrl.h \
|
||||
../byterun/misc.h ../byterun/osdeps.h ../byterun/misc.h \
|
||||
../byterun/printexc.h ../byterun/misc.h ../byterun/mlvalues.h \
|
||||
../byterun/sys.h ../byterun/misc.h
|
||||
../byterun/sys.h ../byterun/misc.h natdynlink.h
|
||||
str.d.o: str.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
|
||||
../byterun/config.h ../byterun/misc.h ../byterun/fail.h \
|
||||
|
@ -996,6 +1018,17 @@ misc.p.o: misc.c ../byterun/config.h ../byterun/../config/m.h \
|
|||
../byterun/major_gc.h ../byterun/freelist.h ../byterun/misc.h \
|
||||
../byterun/mlvalues.h ../byterun/misc.h ../byterun/minor_gc.h \
|
||||
../byterun/misc.h ../byterun/misc.h ../byterun/mlvalues.h
|
||||
natdynlink.p.o: natdynlink.c ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
|
||||
../byterun/config.h ../byterun/misc.h ../byterun/memory.h \
|
||||
../byterun/config.h ../byterun/gc.h ../byterun/mlvalues.h \
|
||||
../byterun/major_gc.h ../byterun/freelist.h ../byterun/misc.h \
|
||||
../byterun/mlvalues.h ../byterun/misc.h ../byterun/minor_gc.h \
|
||||
../byterun/misc.h ../byterun/misc.h ../byterun/mlvalues.h stack.h \
|
||||
../byterun/callback.h ../byterun/mlvalues.h ../byterun/alloc.h \
|
||||
../byterun/misc.h ../byterun/mlvalues.h natdynlink.h \
|
||||
../byterun/osdeps.h ../byterun/misc.h ../byterun/fail.h \
|
||||
../byterun/misc.h ../byterun/mlvalues.h
|
||||
obj.p.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
|
||||
../byterun/config.h ../byterun/misc.h ../byterun/fail.h \
|
||||
|
@ -1060,7 +1093,7 @@ startup.p.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \
|
|||
../byterun/gc.h ../byterun/mlvalues.h ../byterun/gc_ctrl.h \
|
||||
../byterun/misc.h ../byterun/osdeps.h ../byterun/misc.h \
|
||||
../byterun/printexc.h ../byterun/misc.h ../byterun/mlvalues.h \
|
||||
../byterun/sys.h ../byterun/misc.h
|
||||
../byterun/sys.h ../byterun/misc.h natdynlink.h
|
||||
str.p.o: str.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
|
||||
../byterun/config.h ../byterun/misc.h ../byterun/fail.h \
|
||||
|
|
BIN
boot/ocamlc
BIN
boot/ocamlc
Binary file not shown.
BIN
boot/ocamldep
BIN
boot/ocamldep
Binary file not shown.
BIN
boot/ocamllex
BIN
boot/ocamllex
Binary file not shown.
|
@ -42,6 +42,8 @@ fix_code.o: fix_code.c config.h ../config/m.h ../config/s.h \
|
|||
floats.o: floats.c alloc.h compatibility.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h reverse.h stacks.h
|
||||
freelist-new.o: freelist-new.c config.h ../config/m.h ../config/s.h \
|
||||
compatibility.h freelist.h misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h
|
||||
freelist.o: freelist.c config.h ../config/m.h ../config/s.h \
|
||||
compatibility.h freelist.h misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h
|
||||
gc_ctrl.o: gc_ctrl.c alloc.h compatibility.h misc.h config.h \
|
||||
|
@ -177,6 +179,8 @@ fix_code.d.o: fix_code.c config.h ../config/m.h ../config/s.h \
|
|||
floats.d.o: floats.c alloc.h compatibility.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h reverse.h stacks.h
|
||||
freelist-new.d.o: freelist-new.c config.h ../config/m.h ../config/s.h \
|
||||
compatibility.h freelist.h misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h
|
||||
freelist.d.o: freelist.c config.h ../config/m.h ../config/s.h \
|
||||
compatibility.h freelist.h misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h
|
||||
gc_ctrl.d.o: gc_ctrl.c alloc.h compatibility.h misc.h config.h \
|
||||
|
|
|
@ -51,6 +51,7 @@ let initial_env () =
|
|||
(* Compile a .mli file *)
|
||||
|
||||
let interface ppf sourcefile outputprefix =
|
||||
Location.input_name := sourcefile;
|
||||
init_path ();
|
||||
let modulename =
|
||||
String.capitalize(Filename.basename(chop_extension_if_any sourcefile)) in
|
||||
|
@ -81,6 +82,7 @@ let print_if ppf flag printer arg =
|
|||
let (++) x f = f x
|
||||
|
||||
let implementation ppf sourcefile outputprefix =
|
||||
Location.input_name := sourcefile;
|
||||
init_path ();
|
||||
let modulename =
|
||||
String.capitalize(Filename.basename(chop_extension_if_any sourcefile)) in
|
||||
|
@ -95,7 +97,7 @@ let implementation ppf sourcefile outputprefix =
|
|||
with x ->
|
||||
Pparse.remove_preprocessed_if_ast inputfile;
|
||||
raise x
|
||||
end else begin
|
||||
end else begin
|
||||
let objfile = outputprefix ^ ".cmo" in
|
||||
let oc = open_out_bin objfile in
|
||||
try
|
||||
|
@ -123,4 +125,5 @@ let implementation ppf sourcefile outputprefix =
|
|||
end
|
||||
|
||||
let c_file name =
|
||||
Location.input_name := name;
|
||||
if Ccomp.compile_file name <> 0 then exit 2
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
(* $Id$ *)
|
||||
|
||||
(* WARNING: if you change something in this file, you must look at
|
||||
opterrors.ml to see if you need to make the same changes there.
|
||||
opterrors.ml and ocamldoc/odoc_analyse.ml
|
||||
to see if you need to make the same changes there.
|
||||
*)
|
||||
|
||||
open Format
|
||||
|
@ -23,47 +24,58 @@ open Format
|
|||
let report_error ppf exn =
|
||||
let report ppf = function
|
||||
| Lexer.Error(err, loc) ->
|
||||
Location.print ppf loc;
|
||||
Location.print_error ppf loc;
|
||||
Lexer.report_error ppf err
|
||||
| Syntaxerr.Error err ->
|
||||
Syntaxerr.report_error ppf err
|
||||
| Pparse.Error ->
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf "Preprocessor error"
|
||||
| Env.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Env.report_error ppf err
|
||||
| Ctype.Tags(l, l') -> fprintf ppf
|
||||
| Ctype.Tags(l, l') ->
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf
|
||||
"In this program,@ variant constructors@ `%s and `%s@ \
|
||||
have the same hash value.@ Change one of them." l l'
|
||||
| Typecore.Error(loc, err) ->
|
||||
Location.print ppf loc; Typecore.report_error ppf err
|
||||
Location.print_error ppf loc; Typecore.report_error ppf err
|
||||
| Typetexp.Error(loc, err) ->
|
||||
Location.print ppf loc; Typetexp.report_error ppf err
|
||||
Location.print_error ppf loc; Typetexp.report_error ppf err
|
||||
| Typedecl.Error(loc, err) ->
|
||||
Location.print ppf loc; Typedecl.report_error ppf err
|
||||
Location.print_error ppf loc; Typedecl.report_error ppf err
|
||||
| Typeclass.Error(loc, err) ->
|
||||
Location.print ppf loc; Typeclass.report_error ppf err
|
||||
Location.print_error ppf loc; Typeclass.report_error ppf err
|
||||
| Includemod.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Includemod.report_error ppf err
|
||||
| Typemod.Error(loc, err) ->
|
||||
Location.print ppf loc; Typemod.report_error ppf err
|
||||
Location.print_error ppf loc; Typemod.report_error ppf err
|
||||
| Translcore.Error(loc, err) ->
|
||||
Location.print ppf loc; Translcore.report_error ppf err
|
||||
Location.print_error ppf loc; Translcore.report_error ppf err
|
||||
| Translclass.Error(loc, err) ->
|
||||
Location.print ppf loc; Translclass.report_error ppf err
|
||||
Location.print_error ppf loc; Translclass.report_error ppf err
|
||||
| Translmod.Error(loc, err) ->
|
||||
Location.print ppf loc; Translmod.report_error ppf err
|
||||
Location.print_error ppf loc; Translmod.report_error ppf err
|
||||
| Symtable.Error code ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Symtable.report_error ppf code
|
||||
| Bytelink.Error code ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Bytelink.report_error ppf code
|
||||
| Bytelibrarian.Error code ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Bytelibrarian.report_error ppf code
|
||||
| Bytepackager.Error code ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Bytepackager.report_error ppf code
|
||||
| Sys_error msg ->
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf "I/O error: %s" msg
|
||||
| Warnings.Errors (n) ->
|
||||
fprintf ppf "@.Error: error-enabled warnings (%d occurrences)" n
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf "Error-enabled warnings (%d occurrences)" n
|
||||
| x -> fprintf ppf "@]"; raise x in
|
||||
|
||||
fprintf ppf "@[%a@]@." report exn
|
||||
|
|
|
@ -23,49 +23,61 @@ open Format
|
|||
let report_error ppf exn =
|
||||
let report ppf = function
|
||||
| Lexer.Error(err, l) ->
|
||||
Location.print ppf l;
|
||||
Location.print_error ppf l;
|
||||
Lexer.report_error ppf err
|
||||
| Syntaxerr.Error err ->
|
||||
Syntaxerr.report_error ppf err
|
||||
| Pparse.Error ->
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf "Preprocessor error"
|
||||
| Env.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Env.report_error ppf err
|
||||
| Ctype.Tags(l, l') -> fprintf ppf
|
||||
| Ctype.Tags(l, l') ->
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf
|
||||
"In this program,@ variant constructors@ `%s and `%s@ \
|
||||
have the same hash value.@ Change one of them." l l'
|
||||
| Typecore.Error(loc, err) ->
|
||||
Location.print ppf loc; Typecore.report_error ppf err
|
||||
Location.print_error ppf loc; Typecore.report_error ppf err
|
||||
| Typetexp.Error(loc, err) ->
|
||||
Location.print ppf loc; Typetexp.report_error ppf err
|
||||
Location.print_error ppf loc; Typetexp.report_error ppf err
|
||||
| Typedecl.Error(loc, err) ->
|
||||
Location.print ppf loc; Typedecl.report_error ppf err
|
||||
Location.print_error ppf loc; Typedecl.report_error ppf err
|
||||
| Typeclass.Error(loc, err) ->
|
||||
Location.print ppf loc; Typeclass.report_error ppf err
|
||||
Location.print_error ppf loc; Typeclass.report_error ppf err
|
||||
| Includemod.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Includemod.report_error ppf err
|
||||
| Typemod.Error(loc, err) ->
|
||||
Location.print ppf loc; Typemod.report_error ppf err
|
||||
Location.print_error ppf loc; Typemod.report_error ppf err
|
||||
| Translcore.Error(loc, err) ->
|
||||
Location.print ppf loc; Translcore.report_error ppf err
|
||||
Location.print_error ppf loc; Translcore.report_error ppf err
|
||||
| Translclass.Error(loc, err) ->
|
||||
Location.print ppf loc; Translclass.report_error ppf err
|
||||
Location.print_error ppf loc; Translclass.report_error ppf err
|
||||
| Translmod.Error(loc, err) ->
|
||||
Location.print ppf loc; Translmod.report_error ppf err
|
||||
Location.print_error ppf loc; Translmod.report_error ppf err
|
||||
| Compilenv.Error code ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Compilenv.report_error ppf code
|
||||
| Asmgen.Error code ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Asmgen.report_error ppf code
|
||||
| Asmlink.Error code ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Asmlink.report_error ppf code
|
||||
| Asmlibrarian.Error code ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Asmlibrarian.report_error ppf code
|
||||
| Asmpackager.Error code ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Asmpackager.report_error ppf code
|
||||
| Sys_error msg ->
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf "I/O error: %s" msg
|
||||
| Warnings.Errors (n) ->
|
||||
fprintf ppf "@.Error: error-enabled warnings (%d occurrences)" n
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf "Error-enabled warnings (%d occurrences)" n
|
||||
| x -> fprintf ppf "@]"; raise x in
|
||||
|
||||
fprintf ppf "@[%a@]@." report exn
|
||||
|
|
|
@ -89,41 +89,41 @@ odoc_exception.cmx: ../typing/types.cmx odoc_types.cmx odoc_name.cmx
|
|||
odoc_global.cmo: ../utils/clflags.cmi odoc_global.cmi
|
||||
odoc_global.cmx: ../utils/clflags.cmx odoc_global.cmi
|
||||
odoc_html.cmo: odoc_text.cmi odoc_ocamlhtml.cmo odoc_messages.cmo \
|
||||
odoc_info.cmi odoc_dag2html.cmi odoc_args.cmi
|
||||
odoc_info.cmi odoc_dag2html.cmi odoc_args.cmi ../parsing/asttypes.cmi
|
||||
odoc_html.cmx: odoc_text.cmx odoc_ocamlhtml.cmx odoc_messages.cmx \
|
||||
odoc_info.cmx odoc_dag2html.cmx odoc_args.cmx
|
||||
odoc_info.cmx odoc_dag2html.cmx odoc_args.cmx ../parsing/asttypes.cmi
|
||||
odoc_info.cmo: ../typing/printtyp.cmi odoc_value.cmo odoc_types.cmi \
|
||||
odoc_type.cmo odoc_text.cmi odoc_str.cmi odoc_search.cmi odoc_scan.cmo \
|
||||
odoc_print.cmi odoc_parameter.cmo odoc_name.cmi odoc_module.cmo \
|
||||
odoc_misc.cmi odoc_messages.cmo odoc_global.cmi odoc_exception.cmo \
|
||||
odoc_dep.cmo odoc_comments.cmi odoc_class.cmo odoc_args.cmi \
|
||||
odoc_analyse.cmi odoc_info.cmi
|
||||
odoc_dep.cmo odoc_config.cmi odoc_comments.cmi odoc_class.cmo \
|
||||
odoc_args.cmi odoc_analyse.cmi odoc_info.cmi
|
||||
odoc_info.cmx: ../typing/printtyp.cmx odoc_value.cmx odoc_types.cmx \
|
||||
odoc_type.cmx odoc_text.cmx odoc_str.cmx odoc_search.cmx odoc_scan.cmx \
|
||||
odoc_print.cmx odoc_parameter.cmx odoc_name.cmx odoc_module.cmx \
|
||||
odoc_misc.cmx odoc_messages.cmx odoc_global.cmx odoc_exception.cmx \
|
||||
odoc_dep.cmx odoc_comments.cmx odoc_class.cmx odoc_args.cmx \
|
||||
odoc_analyse.cmx odoc_info.cmi
|
||||
odoc_dep.cmx odoc_config.cmx odoc_comments.cmx odoc_class.cmx \
|
||||
odoc_args.cmx odoc_analyse.cmx odoc_info.cmi
|
||||
odoc_latex.cmo: odoc_to_text.cmo odoc_messages.cmo odoc_latex_style.cmo \
|
||||
odoc_info.cmi
|
||||
odoc_info.cmi ../parsing/asttypes.cmi
|
||||
odoc_latex.cmx: odoc_to_text.cmx odoc_messages.cmx odoc_latex_style.cmx \
|
||||
odoc_info.cmx
|
||||
odoc_info.cmx ../parsing/asttypes.cmi
|
||||
odoc_lexer.cmo: odoc_parser.cmi odoc_messages.cmo odoc_comments_global.cmi \
|
||||
odoc_args.cmi
|
||||
odoc_lexer.cmx: odoc_parser.cmx odoc_messages.cmx odoc_comments_global.cmx \
|
||||
odoc_args.cmx
|
||||
odoc_man.cmo: odoc_str.cmi odoc_print.cmi odoc_misc.cmi odoc_messages.cmo \
|
||||
odoc_info.cmi odoc_args.cmi
|
||||
odoc_info.cmi odoc_args.cmi ../parsing/asttypes.cmi
|
||||
odoc_man.cmx: odoc_str.cmx odoc_print.cmx odoc_misc.cmx odoc_messages.cmx \
|
||||
odoc_info.cmx odoc_args.cmx
|
||||
odoc_info.cmx odoc_args.cmx ../parsing/asttypes.cmi
|
||||
odoc_merge.cmo: odoc_value.cmo odoc_types.cmi odoc_type.cmo \
|
||||
odoc_parameter.cmo odoc_name.cmi odoc_module.cmo odoc_messages.cmo \
|
||||
odoc_exception.cmo odoc_class.cmo odoc_args.cmi odoc_merge.cmi
|
||||
odoc_merge.cmx: odoc_value.cmx odoc_types.cmx odoc_type.cmx \
|
||||
odoc_parameter.cmx odoc_name.cmx odoc_module.cmx odoc_messages.cmx \
|
||||
odoc_exception.cmx odoc_class.cmx odoc_args.cmx odoc_merge.cmi
|
||||
odoc_messages.cmo: odoc_global.cmi ../utils/config.cmi
|
||||
odoc_messages.cmx: odoc_global.cmx ../utils/config.cmx
|
||||
odoc_messages.cmo: odoc_global.cmi odoc_config.cmi ../utils/config.cmi
|
||||
odoc_messages.cmx: odoc_global.cmx odoc_config.cmx ../utils/config.cmx
|
||||
odoc_misc.cmo: ../typing/types.cmi ../typing/predef.cmi ../typing/path.cmi \
|
||||
odoc_types.cmi odoc_messages.cmo ../parsing/longident.cmi \
|
||||
../typing/ctype.cmi ../typing/btype.cmi odoc_misc.cmi
|
||||
|
@ -180,14 +180,18 @@ odoc_sig.cmx: ../typing/types.cmx ../typing/typedtree.cmx ../typing/path.cmx \
|
|||
../parsing/asttypes.cmi odoc_sig.cmi
|
||||
odoc_str.cmo: ../typing/types.cmi ../typing/printtyp.cmi odoc_value.cmo \
|
||||
odoc_type.cmo odoc_print.cmi odoc_name.cmi odoc_misc.cmi \
|
||||
odoc_messages.cmo odoc_exception.cmo odoc_class.cmo odoc_str.cmi
|
||||
odoc_messages.cmo odoc_exception.cmo odoc_class.cmo \
|
||||
../parsing/asttypes.cmi odoc_str.cmi
|
||||
odoc_str.cmx: ../typing/types.cmx ../typing/printtyp.cmx odoc_value.cmx \
|
||||
odoc_type.cmx odoc_print.cmx odoc_name.cmx odoc_misc.cmx \
|
||||
odoc_messages.cmx odoc_exception.cmx odoc_class.cmx odoc_str.cmi
|
||||
odoc_messages.cmx odoc_exception.cmx odoc_class.cmx \
|
||||
../parsing/asttypes.cmi odoc_str.cmi
|
||||
odoc_test.cmo: odoc_info.cmi
|
||||
odoc_test.cmx: odoc_info.cmx
|
||||
odoc_texi.cmo: odoc_to_text.cmo odoc_messages.cmo odoc_info.cmi
|
||||
odoc_texi.cmx: odoc_to_text.cmx odoc_messages.cmx odoc_info.cmx
|
||||
odoc_texi.cmo: odoc_to_text.cmo odoc_messages.cmo odoc_info.cmi \
|
||||
../parsing/asttypes.cmi
|
||||
odoc_texi.cmx: odoc_to_text.cmx odoc_messages.cmx odoc_info.cmx \
|
||||
../parsing/asttypes.cmi
|
||||
odoc_text.cmo: odoc_types.cmi odoc_text_parser.cmi odoc_text_lexer.cmo \
|
||||
odoc_text.cmi
|
||||
odoc_text.cmx: odoc_types.cmx odoc_text_parser.cmx odoc_text_lexer.cmx \
|
||||
|
@ -198,8 +202,10 @@ odoc_text_parser.cmo: odoc_types.cmi odoc_misc.cmi odoc_text_parser.cmi
|
|||
odoc_text_parser.cmx: odoc_types.cmx odoc_misc.cmx odoc_text_parser.cmi
|
||||
odoc_to_text.cmo: odoc_messages.cmo odoc_info.cmi
|
||||
odoc_to_text.cmx: odoc_messages.cmx odoc_info.cmx
|
||||
odoc_type.cmo: ../typing/types.cmi odoc_types.cmi odoc_name.cmi
|
||||
odoc_type.cmx: ../typing/types.cmx odoc_types.cmx odoc_name.cmx
|
||||
odoc_type.cmo: ../typing/types.cmi odoc_types.cmi odoc_name.cmi \
|
||||
../parsing/asttypes.cmi
|
||||
odoc_type.cmx: ../typing/types.cmx odoc_types.cmx odoc_name.cmx \
|
||||
../parsing/asttypes.cmi
|
||||
odoc_types.cmo: odoc_messages.cmo odoc_types.cmi
|
||||
odoc_types.cmx: odoc_messages.cmx odoc_types.cmi
|
||||
odoc_value.cmo: ../typing/types.cmi ../typing/printtyp.cmi odoc_types.cmi \
|
||||
|
@ -216,7 +222,7 @@ odoc_dag2html.cmi: odoc_info.cmi
|
|||
odoc_env.cmi: ../typing/types.cmi odoc_name.cmi
|
||||
odoc_info.cmi: ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
|
||||
odoc_type.cmo odoc_search.cmi odoc_parameter.cmo odoc_module.cmo \
|
||||
odoc_exception.cmo odoc_class.cmo
|
||||
odoc_exception.cmo odoc_class.cmo ../parsing/asttypes.cmi
|
||||
odoc_merge.cmi: odoc_types.cmi odoc_module.cmo
|
||||
odoc_misc.cmi: ../typing/types.cmi odoc_types.cmi ../parsing/longident.cmi
|
||||
odoc_name.cmi: ../typing/path.cmi ../parsing/longident.cmi \
|
||||
|
|
|
@ -158,35 +158,41 @@ module Sig_analyser = Odoc_sig.Analyser (Odoc_comments.Basic_info_retriever)
|
|||
let process_error exn =
|
||||
let report ppf = function
|
||||
| Lexer.Error(err, loc) ->
|
||||
Location.print ppf loc;
|
||||
Location.print_error ppf loc;
|
||||
Lexer.report_error ppf err
|
||||
| Syntaxerr.Error err ->
|
||||
Syntaxerr.report_error ppf err
|
||||
| Env.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Env.report_error ppf err
|
||||
| Ctype.Tags(l, l') -> fprintf ppf
|
||||
| Ctype.Tags(l, l') ->
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf
|
||||
"In this program,@ variant constructors@ `%s and `%s@ \
|
||||
have the same hash value." l l'
|
||||
| Typecore.Error(loc, err) ->
|
||||
Location.print ppf loc; Typecore.report_error ppf err
|
||||
Location.print_error ppf loc; Typecore.report_error ppf err
|
||||
| Typetexp.Error(loc, err) ->
|
||||
Location.print ppf loc; Typetexp.report_error ppf err
|
||||
Location.print_error ppf loc; Typetexp.report_error ppf err
|
||||
| Typedecl.Error(loc, err) ->
|
||||
Location.print ppf loc; Typedecl.report_error ppf err
|
||||
Location.print_error ppf loc; Typedecl.report_error ppf err
|
||||
| Includemod.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Includemod.report_error ppf err
|
||||
| Typemod.Error(loc, err) ->
|
||||
Location.print ppf loc; Typemod.report_error ppf err
|
||||
Location.print_error ppf loc; Typemod.report_error ppf err
|
||||
| Translcore.Error(loc, err) ->
|
||||
Location.print ppf loc; Translcore.report_error ppf err
|
||||
Location.print_error ppf loc; Translcore.report_error ppf err
|
||||
| Sys_error msg ->
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf "I/O error: %s" msg
|
||||
| Typeclass.Error(loc, err) ->
|
||||
Location.print ppf loc; Typeclass.report_error ppf err
|
||||
Location.print_error ppf loc; Typeclass.report_error ppf err
|
||||
| Translclass.Error(loc, err) ->
|
||||
Location.print ppf loc; Translclass.report_error ppf err
|
||||
Location.print_error ppf loc; Translclass.report_error ppf err
|
||||
| Warnings.Errors (n) ->
|
||||
fprintf ppf "@.Error: error-enabled warnings (%d occurrences)" n
|
||||
Location.print_error_cur_file ppf;
|
||||
fprintf ppf "Error-enabled warnings (%d occurrences)" n
|
||||
| x ->
|
||||
fprintf ppf "@]";
|
||||
fprintf ppf "Compilation error. Use the OCaml compiler to get more details."
|
||||
|
@ -208,6 +214,7 @@ let process_file ppf sourcefile =
|
|||
match sourcefile with
|
||||
Odoc_args.Impl_file file ->
|
||||
(
|
||||
Location.input_name := file;
|
||||
try
|
||||
let (parsetree_typedtree_opt, input_file) = process_implementation_file ppf file in
|
||||
match parsetree_typedtree_opt with
|
||||
|
@ -239,6 +246,7 @@ let process_file ppf sourcefile =
|
|||
)
|
||||
| Odoc_args.Intf_file file ->
|
||||
(
|
||||
Location.input_name := file;
|
||||
try
|
||||
let (ast, signat, input_file) = process_interface_file ppf file in
|
||||
let file_module = Sig_analyser.analyse_signature file
|
||||
|
@ -266,6 +274,7 @@ let process_file ppf sourcefile =
|
|||
None
|
||||
)
|
||||
| Odoc_args.Text_file file ->
|
||||
Location.input_name := file;
|
||||
try
|
||||
let mod_name =
|
||||
String.capitalize (Filename.basename (Filename.chop_extension file))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
bng.o: bng.c bng.h ../../byterun/config.h ../../byterun/../config/m.h \
|
||||
../../byterun/../config/s.h ../../byterun/compatibility.h bng_ia32.c \
|
||||
../../byterun/../config/s.h ../../byterun/compatibility.h bng_ppc.c \
|
||||
bng_digit.c
|
||||
bng_alpha.o: bng_alpha.c
|
||||
bng_amd64.o: bng_amd64.c
|
||||
|
|
|
@ -61,7 +61,7 @@ let rhs_loc n = {
|
|||
loc_ghost = false;
|
||||
};;
|
||||
|
||||
let input_name = ref ""
|
||||
let input_name = ref "_none_"
|
||||
let input_lexbuf = ref (None : lexbuf option)
|
||||
|
||||
(* Terminal info *)
|
||||
|
@ -229,6 +229,14 @@ let print ppf loc =
|
|||
fprintf ppf "%s%i" msg_chars startchar;
|
||||
fprintf ppf "%s%i%s@.%s" msg_to endchar msg_colon msg_head;
|
||||
end
|
||||
;;
|
||||
|
||||
let print_error ppf loc =
|
||||
print ppf loc;
|
||||
fprintf ppf "Error: ";
|
||||
;;
|
||||
|
||||
let print_error_cur_file ppf = print_error ppf (in_file !input_name);;
|
||||
|
||||
let print_warning loc ppf w =
|
||||
if Warnings.is_active w then begin
|
||||
|
|
|
@ -47,7 +47,8 @@ val input_name: string ref
|
|||
val input_lexbuf: Lexing.lexbuf option ref
|
||||
|
||||
val get_pos_info : Lexing.position -> string * int * int (* file, line, char *)
|
||||
val print: formatter -> t -> unit
|
||||
val print_error: formatter -> t -> unit
|
||||
val print_error_cur_file: formatter -> unit
|
||||
val print_warning: t -> formatter -> Warnings.t -> unit
|
||||
val prerr_warning: t -> Warnings.t -> unit
|
||||
val echo_eof: unit -> unit
|
||||
|
|
|
@ -31,11 +31,9 @@ let report_error ppf = function
|
|||
the highlighted '%s' might be unmatched" closing opening
|
||||
else begin
|
||||
fprintf ppf "%aSyntax error: '%s' expected@."
|
||||
Location.print closing_loc closing;
|
||||
Location.print_error closing_loc closing;
|
||||
fprintf ppf "%aThis '%s' might be unmatched"
|
||||
Location.print opening_loc opening
|
||||
Location.print_error opening_loc opening
|
||||
end
|
||||
| Other loc ->
|
||||
fprintf ppf "%aSyntax error" Location.print loc
|
||||
|
||||
|
||||
fprintf ppf "%aSyntax error" Location.print_error loc
|
||||
|
|
|
@ -253,7 +253,7 @@ let file_dependencies source_file =
|
|||
let report_err = function
|
||||
| Lexer.Error(err, range) ->
|
||||
fprintf Format.err_formatter "@[%a%a@]@."
|
||||
Location.print range Lexer.report_error err
|
||||
Location.print_error range Lexer.report_error err
|
||||
| Syntaxerr.Error err ->
|
||||
fprintf Format.err_formatter "@[%a@]@."
|
||||
Syntaxerr.report_error err
|
||||
|
|
|
@ -476,7 +476,7 @@ let main () =
|
|||
let report_error ppf = function
|
||||
| Lexer.Error(err, range) ->
|
||||
fprintf ppf "@[%a%a@]@."
|
||||
Location.print range Lexer.report_error err
|
||||
Location.print_error range Lexer.report_error err
|
||||
| Syntaxerr.Error err ->
|
||||
fprintf ppf "@[%a@]@."
|
||||
Syntaxerr.report_error err
|
||||
|
|
|
@ -28,7 +28,8 @@ open Lambda
|
|||
type res = Ok of Obj.t | Err of string
|
||||
type evaluation_outcome = Result of Obj.t | Exception of exn
|
||||
|
||||
external ndl_run_toplevel: string -> string -> res = "caml_natdynlink_run_toplevel"
|
||||
external ndl_run_toplevel: string -> string -> res
|
||||
= "caml_natdynlink_run_toplevel"
|
||||
external ndl_loadsym: string -> Obj.t = "caml_natdynlink_loadsym"
|
||||
|
||||
let global_symbol id =
|
||||
|
@ -44,9 +45,9 @@ let dll_run dll entry =
|
|||
match (try Result (Obj.magic (ndl_run_toplevel dll entry)) with exn -> Exception exn) with
|
||||
| Exception _ as r -> r
|
||||
| Result r ->
|
||||
match Obj.magic r with
|
||||
| Ok x -> Result x
|
||||
| Err s -> fatal_error ("Opttoploop.dll_run " ^ s)
|
||||
match Obj.magic r with
|
||||
| Ok x -> Result x
|
||||
| Err s -> fatal_error ("Opttoploop.dll_run " ^ s)
|
||||
|
||||
|
||||
type directive_fun =
|
||||
|
@ -65,7 +66,7 @@ let toplevel_value id =
|
|||
|
||||
let rec eval_path = function
|
||||
| Pident id ->
|
||||
if Ident.persistent id || Ident.global id
|
||||
if Ident.persistent id || Ident.global id
|
||||
then global_symbol id
|
||||
else toplevel_value id
|
||||
| Pdot(p, s, pos) ->
|
||||
|
@ -110,7 +111,8 @@ let remove_printer = Printer.remove_printer
|
|||
|
||||
let parse_toplevel_phrase = ref Parse.toplevel_phrase
|
||||
let parse_use_file = ref Parse.use_file
|
||||
let print_location = Location.print
|
||||
let print_location = Location.print_error (* FIXME change back to print *)
|
||||
let print_error = Location.print_error
|
||||
let print_warning = Location.print_warning
|
||||
let input_name = Location.input_name
|
||||
|
||||
|
@ -130,18 +132,18 @@ let load_lambda ppf (size, lam) =
|
|||
let slam = Simplif.simplify_lambda lam in
|
||||
if !Clflags.dump_lambda then fprintf ppf "%a@." Printlambda.lambda slam;
|
||||
|
||||
let dll =
|
||||
let dll =
|
||||
if !Clflags.keep_asm_file then !phrase_name ^ ext_dll
|
||||
else Filename.temp_file ("caml" ^ !phrase_name) ext_dll
|
||||
in
|
||||
let fn = Filename.chop_extension dll in
|
||||
Asmgen.compile_implementation ~toplevel:need_symbol fn ppf (size, lam);
|
||||
Asmlink.call_linker_shared [fn ^ ext_obj] dll;
|
||||
Sys.remove (fn ^ ext_obj);
|
||||
Sys.remove (fn ^ ext_obj);
|
||||
|
||||
let dll =
|
||||
if Filename.is_implicit dll
|
||||
then Filename.concat (Sys.getcwd ()) dll
|
||||
let dll =
|
||||
if Filename.is_implicit dll
|
||||
then Filename.concat (Sys.getcwd ()) dll
|
||||
else dll in
|
||||
let res = dll_run dll !phrase_name in
|
||||
(try Sys.remove dll with Sys_error _ -> ());
|
||||
|
@ -236,7 +238,7 @@ let execute_phrase print_outcome ppf phr =
|
|||
let out_phr =
|
||||
match res with
|
||||
| Result v ->
|
||||
Compilenv.record_global_approx_toplevel ();
|
||||
Compilenv.record_global_approx_toplevel ();
|
||||
if print_outcome then
|
||||
match str with
|
||||
| [Tstr_eval exp] ->
|
||||
|
@ -244,8 +246,8 @@ let execute_phrase print_outcome ppf phr =
|
|||
let ty = Printtyp.tree_of_type_scheme exp.exp_type in
|
||||
Ophr_eval (outv, ty)
|
||||
| [] -> Ophr_signature []
|
||||
| _ ->
|
||||
Ophr_signature (item_list newenv
|
||||
| _ ->
|
||||
Ophr_signature (item_list newenv
|
||||
(Typemod.simplify_signature sg))
|
||||
|
||||
else Ophr_signature []
|
||||
|
|
|
@ -74,6 +74,7 @@ val max_printer_steps: int ref
|
|||
val parse_toplevel_phrase : (Lexing.lexbuf -> Parsetree.toplevel_phrase) ref
|
||||
val parse_use_file : (Lexing.lexbuf -> Parsetree.toplevel_phrase list) ref
|
||||
val print_location : formatter -> Location.t -> unit
|
||||
val print_error : formatter -> Location.t -> unit
|
||||
val print_warning : Location.t -> formatter -> Warnings.t -> unit
|
||||
val input_name : string ref
|
||||
|
||||
|
@ -99,4 +100,3 @@ val read_interactive_input : (string -> string -> int -> int * bool) ref
|
|||
(* Hooks for initialization *)
|
||||
|
||||
val toplevel_startup_hook : (unit -> unit) ref
|
||||
|
||||
|
|
|
@ -100,7 +100,8 @@ let remove_printer = Printer.remove_printer
|
|||
|
||||
let parse_toplevel_phrase = ref Parse.toplevel_phrase
|
||||
let parse_use_file = ref Parse.use_file
|
||||
let print_location = Location.print
|
||||
let print_location = Location.print_error (* FIXME change back to print *)
|
||||
let print_error = Location.print_error
|
||||
let print_warning = Location.print_warning
|
||||
let input_name = Location.input_name
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ val max_printer_steps: int ref
|
|||
val parse_toplevel_phrase : (Lexing.lexbuf -> Parsetree.toplevel_phrase) ref
|
||||
val parse_use_file : (Lexing.lexbuf -> Parsetree.toplevel_phrase list) ref
|
||||
val print_location : formatter -> Location.t -> unit
|
||||
val print_error : formatter -> Location.t -> unit
|
||||
val print_warning : Location.t -> formatter -> Warnings.t -> unit
|
||||
val input_name : string ref
|
||||
|
||||
|
|
Loading…
Reference in New Issue