diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2013-03-09 22:38:52 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2013-03-09 22:38:52 +0000 |
commit | c63f9e09579ba88c4b9510ccce062fbc767fd3a6 (patch) | |
tree | a9a7f7ef5f2c1a7d84ba7034e3ed12422800ec96 /bytecomp | |
parent | fb36548704ce096310707204c77218fe4d69f069 (diff) | |
download | ocaml-c63f9e09579ba88c4b9510ccce062fbc767fd3a6.tar.gz |
fix a few problems with whitespace and over-long lines
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13393 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'bytecomp')
-rw-r--r-- | bytecomp/bytelibrarian.ml | 3 | ||||
-rw-r--r-- | bytecomp/bytelink.ml | 7 | ||||
-rw-r--r-- | bytecomp/bytelink.mli | 3 | ||||
-rw-r--r-- | bytecomp/bytepackager.ml | 25 | ||||
-rw-r--r-- | bytecomp/emitcode.ml | 6 | ||||
-rw-r--r-- | bytecomp/matching.ml | 7 | ||||
-rw-r--r-- | bytecomp/simplif.ml | 6 | ||||
-rw-r--r-- | bytecomp/translcore.ml | 15 | ||||
-rw-r--r-- | bytecomp/translmod.ml | 49 | ||||
-rw-r--r-- | bytecomp/typeopt.ml | 3 |
10 files changed, 79 insertions, 45 deletions
diff --git a/bytecomp/bytelibrarian.ml b/bytecomp/bytelibrarian.ml index c13241afd2..0979475f01 100644 --- a/bytecomp/bytelibrarian.ml +++ b/bytecomp/bytelibrarian.ml @@ -91,7 +91,8 @@ let create_archive ppf file_list lib_name = output_string outchan cma_magic_number; let ofs_pos_toc = pos_out outchan in output_binary_int outchan 0; - let units = List.flatten(List.map (copy_object_file ppf outchan) file_list) in + let units = + List.flatten(List.map (copy_object_file ppf outchan) file_list) in let toc = { lib_units = units; lib_custom = !Clflags.custom_runtime; diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml index c218da51ea..8b444bab2a 100644 --- a/bytecomp/bytelink.ml +++ b/bytecomp/bytelink.ml @@ -174,7 +174,9 @@ let check_consistency ppf file_name cu = begin try let source = List.assoc cu.cu_name !implementations_defined in Location.print_warning (Location.in_file file_name) ppf - (Warnings.Multiple_definition(cu.cu_name, Location.show_filename file_name, Location.show_filename source)) + (Warnings.Multiple_definition(cu.cu_name, + Location.show_filename file_name, + Location.show_filename source)) with Not_found -> () end; implementations_defined := @@ -587,7 +589,8 @@ let report_error ppf = function fprintf ppf "The file %a is not a bytecode object file" Location.print_filename name | Wrong_object_name name -> - fprintf ppf "The output file %s has a wrong name. The extension implies object file when the link step was requested" name + fprintf ppf "The output file %s has the wrong name. The extension implies\ + \ an object file but the link step was requested" name | Symbol_error(name, err) -> fprintf ppf "Error while linking %a:@ %a" Location.print_filename name Symtable.report_error err diff --git a/bytecomp/bytelink.mli b/bytecomp/bytelink.mli index 89373be165..55ee5b829c 100644 --- a/bytecomp/bytelink.mli +++ b/bytecomp/bytelink.mli @@ -14,7 +14,8 @@ val link : Format.formatter -> string list -> string -> unit -val check_consistency: Format.formatter -> string -> Cmo_format.compilation_unit -> unit +val check_consistency: + Format.formatter -> string -> Cmo_format.compilation_unit -> unit val extract_crc_interfaces: unit -> (string * Digest.t) list diff --git a/bytecomp/bytepackager.ml b/bytecomp/bytepackager.ml index 324341f474..9e6d12c0a1 100644 --- a/bytecomp/bytepackager.ml +++ b/bytecomp/bytepackager.ml @@ -121,7 +121,8 @@ let read_member_info file = Accumulate relocs, debug info, etc. Return size of bytecode. *) -let rename_append_bytecode ppf packagename oc mapping defined ofs prefix subst objfile compunit = +let rename_append_bytecode ppf packagename oc mapping defined ofs prefix subst + objfile compunit = let ic = open_in_bin objfile in try Bytelink.check_consistency ppf objfile compunit; @@ -145,22 +146,27 @@ let rename_append_bytecode ppf packagename oc mapping defined ofs prefix subst o (* Same, for a list of .cmo and .cmi files. Return total size of bytecode. *) -let rec rename_append_bytecode_list ppf packagename oc mapping defined ofs prefix subst = function +let rec rename_append_bytecode_list ppf packagename oc mapping defined ofs + prefix subst = + function [] -> ofs | m :: rem -> match m.pm_kind with | PM_intf -> - rename_append_bytecode_list ppf packagename oc mapping defined ofs prefix subst rem + rename_append_bytecode_list ppf packagename oc mapping defined ofs + prefix subst rem | PM_impl compunit -> let size = - rename_append_bytecode ppf packagename oc mapping defined ofs prefix subst - m.pm_file compunit in + rename_append_bytecode ppf packagename oc mapping defined ofs + prefix subst m.pm_file compunit in let id = Ident.create_persistent m.pm_name in let root = Path.Pident (Ident.create_persistent prefix) in - rename_append_bytecode_list ppf packagename - oc mapping (id :: defined) - (ofs + size) prefix (Subst.add_module id (Path.Pdot (root, Ident.name id, Path.nopos)) subst) rem + rename_append_bytecode_list ppf packagename oc mapping (id :: defined) + (ofs + size) prefix + (Subst.add_module id (Path.Pdot (root, Ident.name id, Path.nopos)) + subst) + rem (* Generate the code that builds the tuple representing the package module *) @@ -200,7 +206,8 @@ let package_object_files ppf files targetfile targetname coercion = let pos_depl = pos_out oc in output_binary_int oc 0; let pos_code = pos_out oc in - let ofs = rename_append_bytecode_list ppf targetname oc mapping [] 0 targetname Subst.identity members in + let ofs = rename_append_bytecode_list ppf targetname oc mapping [] 0 + targetname Subst.identity members in build_global_target oc targetname members mapping ofs coercion; let pos_debug = pos_out oc in if !Clflags.debug && !events <> [] then diff --git a/bytecomp/emitcode.ml b/bytecomp/emitcode.ml index e69cae55e7..c0f8434ed2 100644 --- a/bytecomp/emitcode.ml +++ b/bytecomp/emitcode.ml @@ -340,7 +340,8 @@ let rec emit = function (Kgetglobal _ as instr1) :: (Kgetfield _ as instr2) :: c -> emit (Kpush :: instr1 :: instr2 :: ev :: c) | Kpush :: (Kevent {ev_kind = Event_before} as ev) :: - (Kacc _ | Kenvacc _ | Koffsetclosure _ | Kgetglobal _ | Kconst _ as instr) :: c -> + (Kacc _ | Kenvacc _ | Koffsetclosure _ | Kgetglobal _ | Kconst _ as instr):: + c -> emit (Kpush :: instr :: ev :: c) | Kgetglobal id :: Kgetfield n :: c -> out opGETGLOBALFIELD; slot_for_getglobal id; out_int n; emit c @@ -371,7 +372,8 @@ let to_file outchan unit_name code = cu_codesize = !out_position; cu_reloc = List.rev !reloc_info; cu_imports = Env.imported_units(); - cu_primitives = List.map Primitive.byte_name !Translmod.primitive_declarations; + cu_primitives = List.map Primitive.byte_name + !Translmod.primitive_declarations; cu_force_link = false; cu_debug = pos_debug; cu_debugsize = size_debug } in diff --git a/bytecomp/matching.ml b/bytecomp/matching.ml index 60fe0e3a67..116b19cf0b 100644 --- a/bytecomp/matching.ml +++ b/bytecomp/matching.ml @@ -1329,7 +1329,8 @@ let get_mod_field modname field = match Env.lookup_value (Longident.Lident field) env with | (Path.Pdot(_,_,i), _) -> i | _ -> fatal_error ("Primitive "^modname^"."^field^" not found.") - with Not_found -> fatal_error ("Primitive "^modname^"."^field^" not found.") + with Not_found -> + fatal_error ("Primitive "^modname^"."^field^" not found.") in Lprim(Pfield p, [Lprim(Pgetglobal mod_ident, [])]) with Not_found -> fatal_error ("Module "^modname^" unavailable.") @@ -2586,8 +2587,8 @@ let rec flatten_pat_line size p k = match p.pat_desc with | Tpat_any -> omegas size::k | Tpat_tuple args -> args::k | Tpat_or (p1,p2,_) -> flatten_pat_line size p1 (flatten_pat_line size p2 k) -| Tpat_alias (p,_,_) -> (* Note: if this 'as' pat is here, then this is a useless - binding, solves PR #3780 *) +| Tpat_alias (p,_,_) -> (* Note: if this 'as' pat is here, then this is a + useless binding, solves PR #3780 *) flatten_pat_line size p k | _ -> fatal_error "Matching.flatten_pat_line" diff --git a/bytecomp/simplif.ml b/bytecomp/simplif.ml index 1492149e0d..e60bb6d168 100644 --- a/bytecomp/simplif.ml +++ b/bytecomp/simplif.ml @@ -264,7 +264,8 @@ let simplify_exits lam = | Lfor(v, l1, l2, dir, l3) -> Lfor(v, simplif l1, simplif l2, dir, simplif l3) | Lassign(v, l) -> Lassign(v, simplif l) - | Lsend(k, m, o, ll, loc) -> Lsend(k, simplif m, simplif o, List.map simplif ll, loc) + | Lsend(k, m, o, ll, loc) -> + Lsend(k, simplif m, simplif o, List.map simplif ll, loc) | Levent(l, ev) -> Levent(simplif l, ev) | Lifused(v, l) -> Lifused (v,simplif l) in @@ -474,7 +475,8 @@ let simplify_lets lam = | Lfor(v, l1, l2, dir, l3) -> Lfor(v, simplif l1, simplif l2, dir, simplif l3) | Lassign(v, l) -> Lassign(v, simplif l) - | Lsend(k, m, o, ll, loc) -> Lsend(k, simplif m, simplif o, List.map simplif ll, loc) + | Lsend(k, m, o, ll, loc) -> + Lsend(k, simplif m, simplif o, List.map simplif ll, loc) | Levent(l, ev) -> Levent(simplif l, ev) | Lifused(v, l) -> if count_var v > 0 then simplif l else lambda_unit diff --git a/bytecomp/translcore.ml b/bytecomp/translcore.ml index 4e8de1ba16..34a2b97663 100644 --- a/bytecomp/translcore.ml +++ b/bytecomp/translcore.ml @@ -404,12 +404,14 @@ let transl_primitive loc p = match prim with Plazyforce -> let parm = Ident.create "prim" in - Lfunction(Curried, [parm], Matching.inline_lazy_force (Lvar parm) Location.none) + Lfunction(Curried, [parm], + Matching.inline_lazy_force (Lvar parm) Location.none) | _ -> let rec make_params n = if n <= 0 then [] else Ident.create "prim" :: make_params (n-1) in let params = make_params p.prim_arity in - Lfunction(Curried, params, Lprim(prim, List.map (fun id -> Lvar id) params)) + Lfunction(Curried, params, + Lprim(prim, List.map (fun id -> Lvar id) params)) (* To check the well-formedness of r.h.s. of "let rec" definitions *) @@ -612,12 +614,14 @@ and transl_exp0 e = if public_send || p.prim_name = "%sendself" then let kind = if public_send then Public else Self in let obj = Ident.create "obj" and meth = Ident.create "meth" in - Lfunction(Curried, [obj; meth], Lsend(kind, Lvar meth, Lvar obj, [], e.exp_loc)) + Lfunction(Curried, [obj; meth], Lsend(kind, Lvar meth, Lvar obj, [], + e.exp_loc)) else if p.prim_name = "%sendcache" then let obj = Ident.create "obj" and meth = Ident.create "meth" in let cache = Ident.create "cache" and pos = Ident.create "pos" in Lfunction(Curried, [obj; meth; cache; pos], - Lsend(Cached, Lvar meth, Lvar obj, [Lvar cache; Lvar pos], e.exp_loc)) + Lsend(Cached, Lvar meth, Lvar obj, [Lvar cache; Lvar pos], + e.exp_loc)) else transl_primitive e.exp_loc p | Texp_ident(path, _, {val_kind = Val_anc _}) -> @@ -648,7 +652,8 @@ and transl_exp0 e = in let wrap0 f = if args' = [] then f else wrap f in - let args = List.map (function _, Some x, _ -> x | _ -> assert false) args in + let args = + List.map (function _, Some x, _ -> x | _ -> assert false) args in let argl = transl_list args in let public_send = p.prim_name = "%send" || not !Clflags.native_code && p.prim_name = "%sendcache"in diff --git a/bytecomp/translmod.ml b/bytecomp/translmod.ml index 195dcc99b1..16c481bf83 100644 --- a/bytecomp/translmod.ml +++ b/bytecomp/translmod.ml @@ -79,7 +79,8 @@ let rec compose_coercions c1 c2 = let primitive_declarations = ref ([] : Primitive.description list) let record_primitive = function - | {val_kind=Val_prim p} -> primitive_declarations := p :: !primitive_declarations + | {val_kind=Val_prim p} -> + primitive_declarations := p :: !primitive_declarations | _ -> () (* Keep track of the root path (from the root of the namespace to the @@ -306,7 +307,8 @@ and transl_structure fields cc rootpath = function transl_module Tcoerce_none (field_path rootpath id) modl, transl_structure (id :: fields) cc rootpath rem) | Tstr_recmodule bindings -> - let ext_fields = List.rev_append (List.map (fun (id, _,_,_) -> id) bindings) fields in + let ext_fields = + List.rev_append (List.map (fun (id, _,_,_) -> id) bindings) fields in compile_recmodule (fun id modl -> transl_module Tcoerce_none (field_path rootpath id) modl) @@ -377,7 +379,8 @@ let rec defined_idents = function | Tstr_class_type cl_list -> defined_idents rem | Tstr_include(modl, ids) -> ids @ defined_idents rem -(* second level idents (module M = struct ... let id = ... end), and all sub-levels idents *) +(* second level idents (module M = struct ... let id = ... end), + and all sub-levels idents *) let rec more_idents = function [] -> [] | item :: rem -> @@ -475,10 +478,14 @@ let transl_store_structure glob map prims str = (* Careful: see next case *) let subst = !transl_store_subst in Lsequence(lam, - Llet(Strict, id, - subst_lambda subst - (Lprim(Pmakeblock(0, Immutable), List.map (fun id -> Lvar id) (defined_idents str.str_items))), - Lsequence(store_ident id, transl_store rootpath (add_ident true id subst) rem))) + Llet(Strict, id, + subst_lambda subst + (Lprim(Pmakeblock(0, Immutable), + List.map (fun id -> Lvar id) + (defined_idents str.str_items))), + Lsequence(store_ident id, + transl_store rootpath (add_ident true id subst) + rem))) | Tstr_module( id, _, modl) -> let lam = transl_module Tcoerce_none (field_path rootpath id) modl in @@ -489,7 +496,8 @@ let transl_store_structure glob map prims str = If not, we can use the value from the global (add_ident true adds id -> Pgetglobal... to subst). *) Llet(Strict, id, subst_lambda subst lam, - Lsequence(store_ident id, transl_store rootpath (add_ident true id subst) rem)) + Lsequence(store_ident id, + transl_store rootpath (add_ident true id subst) rem)) | Tstr_recmodule bindings -> let ids = List.map fst4 bindings in compile_recmodule @@ -560,7 +568,8 @@ let transl_store_structure glob map prims str = transl_primitive Location.none prim]), cont) - in List.fold_right store_primitive prims (transl_store (global_path glob) !transl_store_subst str) + in List.fold_right store_primitive prims + (transl_store (global_path glob) !transl_store_subst str) (* Transform a coercion and the list of value identifiers defined by a toplevel structure into a table [id -> (pos, coercion)], @@ -582,22 +591,22 @@ let build_ident_map restr idlist more_ids = natural_map (pos+1) (Ident.add id (pos, Tcoerce_none) map) prims rem in let (map, prims, pos) = match restr with - Tcoerce_none -> - natural_map 0 Ident.empty [] idlist + Tcoerce_none -> + natural_map 0 Ident.empty [] idlist | Tcoerce_structure pos_cc_list -> - let idarray = Array.of_list idlist in - let rec export_map pos map prims undef = function + let idarray = Array.of_list idlist in + let rec export_map pos map prims undef = function [] -> natural_map pos map prims undef - | (source_pos, Tcoerce_primitive p) :: rem -> + | (source_pos, Tcoerce_primitive p) :: rem -> export_map (pos + 1) map ((pos, p) :: prims) undef rem - | (source_pos, cc) :: rem -> + | (source_pos, cc) :: rem -> let id = idarray.(source_pos) in export_map (pos + 1) (Ident.add id (pos, cc) map) prims (list_remove id undef) rem - in export_map 0 Ident.empty [] idlist pos_cc_list + in export_map 0 Ident.empty [] idlist pos_cc_list | _ -> - fatal_error "Translmod.build_ident_map" + fatal_error "Translmod.build_ident_map" in natural_map pos map prims more_ids @@ -608,7 +617,8 @@ let transl_store_gen module_name ({ str_items = str }, restr) topl = reset_labels (); primitive_declarations := []; let module_id = Ident.create_persistent module_name in - let (map, prims, size) = build_ident_map restr (defined_idents str) (more_idents str) in + let (map, prims, size) = + build_ident_map restr (defined_idents str) (more_idents str) in let f = function | [ { str_desc = Tstr_eval expr } ] when topl -> assert (size = 0); @@ -778,5 +788,6 @@ open Format let report_error ppf = function Circular_dependency id -> fprintf ppf - "@[Cannot safely evaluate the definition@ of the recursively-defined module %a@]" + "@[Cannot safely evaluate the definition@ \ + of the recursively-defined module %a@]" Printtyp.ident id diff --git a/bytecomp/typeopt.ml b/bytecomp/typeopt.ml index 7b3961ebd7..e9b7405fa2 100644 --- a/bytecomp/typeopt.ml +++ b/bytecomp/typeopt.ml @@ -120,6 +120,7 @@ let bigarray_kind_and_layout exp = match scrape exp.exp_env exp.exp_type with | Tconstr(p, [caml_type; elt_type; layout_type], abbrev) -> (bigarray_decode_type exp.exp_env elt_type kind_table Pbigarray_unknown, - bigarray_decode_type exp.exp_env layout_type layout_table Pbigarray_unknown_layout) + bigarray_decode_type exp.exp_env layout_type layout_table + Pbigarray_unknown_layout) | _ -> (Pbigarray_unknown, Pbigarray_unknown_layout) |