summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2001-11-29 09:55:06 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2001-11-29 09:55:06 +0000
commitdb57f926fac33f35685b624eab3dff32069e36c0 (patch)
tree389374e5a693254df5d1503e1fd146a334401ff5
parent713598aa8a0b681b4c9f566c50bb3e5603b53ce6 (diff)
Revu verification de la coherence entre interfaces et implementations; l'ancien code examinait les fichiers dans le mauvais ordre! (PR#489)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4061 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmcomp/asmlink.ml21
1 files changed, 11 insertions, 10 deletions
diff --git a/asmcomp/asmlink.ml b/asmcomp/asmlink.ml
index 2ea2dc00e..bce838666 100644
--- a/asmcomp/asmlink.ml
+++ b/asmcomp/asmlink.ml
@@ -111,10 +111,9 @@ let scan_file obj_name tolink =
(* This is a .cmx file. It must be linked in any case.
Read the infos to see which modules it requires. *)
let (info, crc) = Compilenv.read_unit_info file_name in
- check_consistency file_name info crc;
remove_required info.ui_name;
List.iter (add_required file_name) info.ui_imports_cmx;
- info :: tolink
+ (info, file_name, crc) :: tolink
end
else if Filename.check_suffix file_name ".cmxa" then begin
(* This is an archive file. Each unit contained in it will be linked
@@ -133,12 +132,11 @@ let scan_file obj_name tolink =
|| !Clflags.link_everything
|| is_required info.ui_name
then begin
- check_consistency file_name info crc;
remove_required info.ui_name;
List.iter (add_required (Printf.sprintf "%s(%s)"
file_name info.ui_name))
info.ui_imports_cmx;
- info :: reqd
+ (info, file_name, crc) :: reqd
end else
reqd)
infos.lib_units tolink
@@ -153,28 +151,28 @@ module IntSet = Set.Make(
let compare = compare
end)
-let make_startup_file ppf filename info_list =
+let make_startup_file ppf filename units_list =
let compile_phrase p = Asmgen.compile_phrase ppf p in
let oc = open_out filename in
Emitaux.output_channel := oc;
Location.input_name := "startup"; (* set the name of the "current" input *)
Compilenv.reset "startup"; (* set the name of the "current" compunit *)
Emit.begin_assembly();
- let name_list = List.map (fun ui -> ui.ui_name) info_list in
+ let name_list = List.map (fun (info,_,_) -> info.ui_name) units_list in
compile_phrase (Cmmgen.entry_point name_list);
let apply_functions = ref (IntSet.add 2 (IntSet.add 3 IntSet.empty)) in
(* The callback functions always reference caml_apply[23] *)
let curry_functions =
ref IntSet.empty in
List.iter
- (fun info ->
+ (fun (info,_,_) ->
List.iter
(fun n -> apply_functions := IntSet.add n !apply_functions)
info.ui_apply_fun;
List.iter
(fun n -> curry_functions := IntSet.add n !curry_functions)
info.ui_curry_fun)
- info_list;
+ units_list;
IntSet.iter
(fun n -> compile_phrase (Cmmgen.apply_function n))
!apply_functions;
@@ -285,6 +283,9 @@ let link ppf objfiles =
[] -> ()
| mg -> raise(Error(Missing_implementations mg))
end;
+ List.iter
+ (fun (info, file_name, crc) -> check_consistency file_name info crc)
+ units_tolink;
Clflags.ccobjs := !Clflags.ccobjs @ !lib_ccobjs;
Clflags.ccopts := !lib_ccopts @ !Clflags.ccopts; (* put user's opts first *)
let startup = Filename.temp_file "camlstartup" ext_asm in
@@ -325,12 +326,12 @@ let report_error ppf = function
print_modules l
| Inconsistent_interface(intf, file1, file2) ->
fprintf ppf
- "@[<hv>Files %s@ and %s@ make inconsistent assumptions \
+ "@[<hov>Files %s@ and %s@ make inconsistent assumptions \
over interface %s@]"
file1 file2 intf
| Inconsistent_implementation(intf, file1, file2) ->
fprintf ppf
- "@[<hv>Files %s@ and %s@ make inconsistent assumptions \
+ "@[<hov>Files %s@ and %s@ make inconsistent assumptions \
over implementation %s@]"
file1 file2 intf
| Assembler_error file ->