diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/.depend | 4 | ||||
-rw-r--r-- | tools/addlabels.ml | 7 | ||||
-rwxr-xr-x | tools/check-typo | 6 | ||||
-rw-r--r-- | tools/cmt2annot.ml | 9 | ||||
-rw-r--r-- | tools/depend.ml | 9 | ||||
-rw-r--r-- | tools/dumpobj.ml | 4 | ||||
-rw-r--r-- | tools/eqparsetree.ml | 26 | ||||
-rwxr-xr-x | tools/make-package-macosx | 2 | ||||
-rwxr-xr-x | tools/make-version-header.sh | 6 | ||||
-rw-r--r-- | tools/objinfo.ml | 3 | ||||
-rw-r--r-- | tools/objinfo_helper.c | 2 | ||||
-rw-r--r-- | tools/ocaml299to3.ml | 3 | ||||
-rw-r--r-- | tools/ocamlcp.ml | 2 | ||||
-rw-r--r-- | tools/ocamldep.ml | 15 | ||||
-rw-r--r-- | tools/ocamlmklib.mlp | 6 | ||||
-rw-r--r-- | tools/ocamlmktop.ml | 4 | ||||
-rw-r--r-- | tools/ocamlmktop.tpl | 3 | ||||
-rw-r--r-- | tools/ocamloptp.ml | 2 | ||||
-rw-r--r-- | tools/untypeast.ml | 12 |
19 files changed, 75 insertions, 50 deletions
diff --git a/tools/.depend b/tools/.depend index 0a68fd85cb..6719b5d51f 100644 --- a/tools/.depend +++ b/tools/.depend @@ -78,10 +78,6 @@ ocamlprof.cmx : ../utils/warnings.cmx ../parsing/syntaxerr.cmx \ ../parsing/lexer.cmx opnames.cmo : opnames.cmx : -pprintast.cmo : ../parsing/parsetree.cmi ../utils/misc.cmi \ - ../parsing/longident.cmi ../parsing/location.cmi ../parsing/asttypes.cmi -pprintast.cmx : ../parsing/parsetree.cmi ../utils/misc.cmx \ - ../parsing/longident.cmx ../parsing/location.cmx ../parsing/asttypes.cmi primreq.cmo : ../utils/config.cmi ../bytecomp/cmo_format.cmi primreq.cmx : ../utils/config.cmx ../bytecomp/cmo_format.cmi profiling.cmo : profiling.cmi diff --git a/tools/addlabels.ml b/tools/addlabels.ml index 6daab8b794..cc94f5eabc 100644 --- a/tools/addlabels.ml +++ b/tools/addlabels.ml @@ -190,7 +190,8 @@ let rec insert_labels_app ~labels ~text args = let pos0 = arg.pexp_loc.Location.loc_start.Lexing.pos_cnum in let pos = insertion_point pos0 ~text in match arg.pexp_desc with - | Pexp_ident({ txt = Longident.Lident name }) when l = name && pos = pos0 -> + | Pexp_ident({ txt = Longident.Lident name }) + when l = name && pos = pos0 -> add_insertion pos "~" | _ -> add_insertion pos ("~" ^ l ^ ":") end; @@ -224,7 +225,9 @@ let rec add_labels_expr ~text ~values ~classes expr = end; List.iter args ~f:(fun (_,e) -> add_labels_rec e) | Pexp_apply ({pexp_desc=Pexp_send - ({pexp_desc=Pexp_ident({ txt = Longident.Lident s })},meth)}, args) -> + ({pexp_desc=Pexp_ident({ txt = Longident.Lident s })}, + meth)}, + args) -> begin try if SMap.find s values = ["<object>"] then let labels = SMap.find (s ^ "#" ^ meth) values in diff --git a/tools/check-typo b/tools/check-typo index eabd1c05d8..05c7c68c07 100755 --- a/tools/check-typo +++ b/tools/check-typo @@ -47,6 +47,9 @@ # *.clib # *.reference # */reference +# - Any file whose name matches one of the following patterns is +# automatically exempt from the "long-line" rule. +# *.reference # ASCII characters are bytes from 0 to 127. Any other byte is # flagged as a non-ASCII character. @@ -137,6 +140,9 @@ IGNORE_DIRS=" *.mlpack|*.mllib|*.mltop|*.odocl|*.itarget|*.clib) h;; *.reference|*/reference) h;; esac + case "$f" in + *.reference) rules="long-line,$rules";; + esac (cat "$f"; echo) \ | awk -v rules="$rules" -v svnrules="$svnrules" -v file="$f" \ diff --git a/tools/cmt2annot.ml b/tools/cmt2annot.ml index 9632e48b55..fd2a6c9502 100644 --- a/tools/cmt2annot.ml +++ b/tools/cmt2annot.ml @@ -23,7 +23,9 @@ let bind_variables scope = super # pattern pat; match pat.pat_desc with | Tpat_var (id, _) | Tpat_alias (_, id, _) -> - Stypes.record (Stypes.An_ident (pat.pat_loc, Ident.name id, Annot.Idef scope)) + Stypes.record (Stypes.An_ident (pat.pat_loc, + Ident.name id, + Annot.Idef scope)) | _ -> () end @@ -136,7 +138,8 @@ let binary_part iter x = | Partial_signature_item x -> iter # signature_item x | Partial_module_type x -> iter # module_type x -let gen_annot target_filename filename {Cmt_format.cmt_loadpath; cmt_annots; cmt_use_summaries; _} = +let gen_annot target_filename filename + {Cmt_format.cmt_loadpath; cmt_annots; cmt_use_summaries; _} = let open Cmt_format in Envaux.reset_cache (); Config.load_path := cmt_loadpath; @@ -152,7 +155,7 @@ let gen_annot target_filename filename {Cmt_format.cmt_loadpath; cmt_annots; cmt iterator # structure typedtree; Stypes.dump target_filename | Interface _ -> - Printf.fprintf stderr "Cannot generate annotations for interface file\n%!"; + Printf.eprintf "Cannot generate annotations for interface file\n%!"; exit 2 | Partial_implementation parts -> Array.iter (binary_part iterator) parts; diff --git a/tools/depend.ml b/tools/depend.ml index 7883f84917..1d74153dba 100644 --- a/tools/depend.ml +++ b/tools/depend.ml @@ -75,7 +75,10 @@ let add_type_declaration bv td = let add_tkind = function Ptype_abstract -> () | Ptype_variant cstrs -> - List.iter (fun (c, args, rty, _) -> List.iter (add_type bv) args; Misc.may (add_type bv) rty) cstrs + List.iter (fun (c, args, rty, _) -> + List.iter (add_type bv) args; + Misc.may (add_type bv) rty) + cstrs | Ptype_record lbls -> List.iter (fun (l, mut, ty, _) -> add_type bv ty) lbls in add_tkind td.ptype_kind @@ -234,7 +237,9 @@ and add_sig_item bv item = | Psig_module(id, mty) -> add_modtype bv mty; StringSet.add id.txt bv | Psig_recmodule decls -> - let bv' = List.fold_right StringSet.add (List.map (fun (x,_) -> x.txt) decls) bv in + let bv' = + List.fold_right StringSet.add (List.map (fun (x,_) -> x.txt) decls) bv + in List.iter (fun (id, mty) -> add_modtype bv' mty) decls; bv' | Psig_modtype(id,mtyd) -> diff --git a/tools/dumpobj.ml b/tools/dumpobj.ml index df654a94cc..b2af7884e1 100644 --- a/tools/dumpobj.ml +++ b/tools/dumpobj.ml @@ -541,7 +541,9 @@ let dump_exe ic = let arg_list = [ "-noloc", Arg.Clear print_locations, " : don't print source information"; ] -let arg_usage = Printf.sprintf "%s [OPTIONS] FILES : dump content of bytecode files" Sys.argv.(0) +let arg_usage = + Printf.sprintf "%s [OPTIONS] FILES : dump content of bytecode files" + Sys.argv.(0) let first_file = ref true diff --git a/tools/eqparsetree.ml b/tools/eqparsetree.ml index 454a3ddd21..10d631f024 100644 --- a/tools/eqparsetree.ml +++ b/tools/eqparsetree.ml @@ -12,8 +12,8 @@ (* - This module is mainly used to diff two parsetree, it helps to automate the test - for parsing/pprintast.ml + This module is mainly used to diff two parsetree, it helps to automate the + test for parsing/pprintast.ml *) @@ -38,7 +38,7 @@ let eq_option mf_a (x, y) = | (None, None) -> true | (Some x, Some y) -> mf_a (x, y) | (_, _) -> false - + module Location =struct include Location let eq_t : (t*t) -> bool = fun (_,_) -> true @@ -66,54 +66,54 @@ module Asttypes = struct | (Const_int64 a0, Const_int64 b0) -> eq_int64 (a0, b0) | (Const_nativeint a0, Const_nativeint b0) -> eq_nativeint (a0, b0) | (_, _) -> false - + let eq_rec_flag : (rec_flag * rec_flag) -> 'result = function | (Nonrecursive, Nonrecursive) -> true | (Recursive, Recursive) -> true | (Default, Default) -> true | (_, _) -> false - + let eq_direction_flag : (direction_flag * direction_flag) -> 'result = function | (Upto, Upto) -> true | (Downto, Downto) -> true | (_, _) -> false - + let eq_private_flag : (private_flag * private_flag) -> 'result = function | (Private, Private) -> true | (Public, Public) -> true | (_, _) -> false - + let eq_mutable_flag : (mutable_flag * mutable_flag) -> 'result = function | (Immutable, Immutable) -> true | (Mutable, Mutable) -> true | (_, _) -> false - + let eq_virtual_flag : (virtual_flag * virtual_flag) -> 'result = function | (Virtual, Virtual) -> true | (Concrete, Concrete) -> true | (_, _) -> false - + let eq_override_flag : (override_flag * override_flag) -> 'result = function | (Override, Override) -> true | (Fresh, Fresh) -> true | (_, _) -> false - + let eq_closed_flag : (closed_flag * closed_flag) -> 'result = function | (Closed, Closed) -> true | (Open, Open) -> true | (_, _) -> false - + let eq_label : (label * label) -> 'result = fun (a0, a1) -> eq_string (a0, a1) - + let eq_loc : 'all_a0. (('all_a0 * 'all_a0) -> 'result) -> @@ -777,5 +777,3 @@ and eq_toplevel_phrase : | (Ptop_dir (a0, a1), Ptop_dir (b0, b1)) -> (eq_string (a0, b0)) && (eq_directive_argument (a1, b1)) | (_, _) -> false - - diff --git a/tools/make-package-macosx b/tools/make-package-macosx index 657860e77b..1fa08919d2 100755 --- a/tools/make-package-macosx +++ b/tools/make-package-macosx @@ -84,7 +84,7 @@ mkdir -p resources # stop here -> | cat >resources/ReadMe.txt <<EOF This package installs OCaml version ${VERSION}. -You need Mac OS X 10.7.x (Lion), with the +You need Mac OS X 10.7.x (Lion) or later, with the XCode tools installed (v4.3.3 or later). Files will be installed in the following directories: diff --git a/tools/make-version-header.sh b/tools/make-version-header.sh index 22320ec16c..b5e69be956 100755 --- a/tools/make-version-header.sh +++ b/tools/make-version-header.sh @@ -30,13 +30,13 @@ version="`ocamlc -v | sed -n -e 's/.*version //p'`" major="`echo "$version" | sed -n -e '1s/^\([0-9]*\)\..*/\1/p'`" minor="`echo "$version" | sed -n -e '1s/^[0-9]*\.\([0-9]*\).*/\1/p'`" -patchlevel="`echo "$version" | sed -n -e '1s/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/p'`" +patchlvl="`echo "$version" | sed -n -e '1s/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/p'`" suffix="`echo "$version" | sed -n -e '1s/^[^+]*+\(.*\)/\1/p'`" echo "#define OCAML_VERSION_MAJOR $major" echo "#define OCAML_VERSION_MINOR $minor" -case $patchlevel in "") patchlevel=0;; esac -echo "#define OCAML_VERSION_PATCHLEVEL $patchlevel" +case $patchlvl in "") patchlvl=0;; esac +echo "#define OCAML_VERSION_PATCHLEVEL $patchlvl" case "$suffix" in "") echo "#undef OCAML_VERSION_ADDITIONAL";; *) echo "#define OCAML_VERSION_ADDITIONAL \"$suffix\"";; diff --git a/tools/objinfo.ml b/tools/objinfo.ml index 186d7f5ae9..eb88a8b29c 100644 --- a/tools/objinfo.ml +++ b/tools/objinfo.ml @@ -268,7 +268,8 @@ let dump_obj filename = end let arg_list = [] -let arg_usage = Printf.sprintf "%s [OPTIONS] FILES : give information on files" Sys.argv.(0) +let arg_usage = + Printf.sprintf "%s [OPTIONS] FILES : give information on files" Sys.argv.(0) let main() = Arg.parse arg_list dump_obj arg_usage; diff --git a/tools/objinfo_helper.c b/tools/objinfo_helper.c index 689cdf750e..58dfd2d459 100644 --- a/tools/objinfo_helper.c +++ b/tools/objinfo_helper.c @@ -85,7 +85,7 @@ int main(int argc, char ** argv) int main(int argc, char ** argv) { - fprintf(stderr, "BFD library unavailable, cannot print info on .cmxs files\n"); + fprintf(stderr,"BFD library unavailable, cannot print info on .cmxs files\n"); return 2; } diff --git a/tools/ocaml299to3.ml b/tools/ocaml299to3.ml index 8ff98a8f6f..a8eab92a99 100644 --- a/tools/ocaml299to3.ml +++ b/tools/ocaml299to3.ml @@ -124,7 +124,8 @@ let _ = print_endline "Convert OCaml 2.99 O'Labl-style labels in implementation files to"; print_endline - "a syntax compatible with version 3. Also `fun:' labels are replaced by `f:'."; + "a syntax compatible with version 3. Also `fun:' labels are replaced \ + by `f:'."; print_endline "Other syntactic changes are not handled."; print_endline "Old files are renamed to <file>.bak."; print_endline "Interface files do not need label syntax conversion."; diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml index 256213e1fd..7e779eae10 100644 --- a/tools/ocamlcp.ml +++ b/tools/ocamlcp.ml @@ -74,10 +74,10 @@ module Options = Main_args.Make_bytecomp_options (struct let _pp s = incompatible "-pp" let _ppx s = incompatible "-ppx" let _principal = option "-principal" - let _short_paths = option "-short-paths" let _rectypes = option "-rectypes" let _nojoin () = option "-nojoin" () let _runtime_variant s = option_with_arg "-runtime-variant" s + let _short_paths = option "-short-paths" let _strict_sequence = option "-strict-sequence" let _thread () = option "-thread" () let _vmthread () = option "-vmthread" () diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml index 9e368bf70b..8fb0c70027 100644 --- a/tools/ocamldep.ml +++ b/tools/ocamldep.ml @@ -13,7 +13,7 @@ open Compenv open Parsetree - +let ppf = Format.err_formatter (* Print the dependencies *) type file_kind = ML | MLI;; @@ -285,8 +285,9 @@ let ml_file_dependencies source_file = end let mli_file_dependencies source_file = - let extracted_deps = read_parse_and_extract - Parse.interface Depend.add_signature Config.ast_intf_magic_number source_file + let extracted_deps = + read_parse_and_extract Parse.interface Depend.add_signature + Config.ast_intf_magic_number source_file in if !sort_files then files := (source_file, MLI, extracted_deps) :: !files @@ -302,7 +303,7 @@ let mli_file_dependencies source_file = end let file_dependencies_as kind source_file = - Compenv.readenv Before_compile; + Compenv.readenv ppf Before_compile; load_path := []; List.iter add_to_load_path ( (!Compenv.last_include_dirs @ @@ -415,7 +416,7 @@ let print_version_num () = let _ = Clflags.classic := false; first_include_dirs := Filename.current_dir_name :: !first_include_dirs; - Compenv.readenv Before_args; + Compenv.readenv ppf Before_args; Arg.parse [ "-nojoin", Arg.Set Clflags.nojoin, "act over pure OCaml source files" ; @@ -441,7 +442,7 @@ let _ = " Output one line per file, regardless of the length"; "-pp", Arg.String(fun s -> Clflags.preprocessor := Some s), "<cmd> Pipe sources through preprocessor <cmd>"; - "-ppx", Arg.String(fun s -> first_ppx := s :: !first_ppx), + "-ppx", Arg.String(fun s -> first_ppx := s :: !first_ppx), "<cmd> Pipe abstract syntax trees through preprocessor <cmd>"; "-slash", Arg.Set Clflags.force_slash, " (Windows) Use forward slash / instead of backslash \\ in file paths"; @@ -452,6 +453,6 @@ let _ = "-vnum", Arg.Unit print_version_num, " Print version number and exit"; ] file_dependencies usage; - Compenv.readenv Before_link; + Compenv.readenv ppf Before_link; if !sort_files then sort_files_by_dependencies !files; exit (if !error_occurred then 2 else 0) diff --git a/tools/ocamlmklib.mlp b/tools/ocamlmklib.mlp index 972151447d..8c52b1363f 100644 --- a/tools/ocamlmklib.mlp +++ b/tools/ocamlmklib.mlp @@ -20,7 +20,8 @@ let compiler_path name = let bytecode_objs = ref [] (* .cmo,.cma,.ml,.mli files to pass to jocamlc *) and native_objs = ref [] (* .cmx,.cmxa,.ml,.mli files to pass to jocamlopt *) -and c_objs = ref [] (* .o, .a, .obj, .lib, .dll files to pass to mksharedlib and ar *) +and c_objs = ref [] (* .o, .a, .obj, .lib, .dll files to pass + to mksharedlib and ar *) and caml_libs = ref [] (* -cclib to pass to jocamlc, jocamlopt *) and caml_opts = ref [] (* -ccopt to pass to jocamlc, jocamlopt *) and dynlink = ref supports_shared_libraries @@ -142,7 +143,8 @@ let parse_arguments argv = if !output_c = "" then output_c := !output let usage = "\ -Usage: jocamlmklib [options] <.cmo|.cma|.cmx|.cmxa|.ml|.mli|.o|.a|.obj|.lib|.dll files>\ +Usage: jocamlmklib [options] <.cmo|.cma|.cmx|.cmxa|.ml|.mli|.o|.a|.obj|.lib|\ + .dll files>\ \nOptions are:\ \n -cclib <lib> C library passed to jocamlc -a or jocamlopt -a only\ \n -ccopt <opt> C option passed to jocamlc -a or jocamlopt -a only\ diff --git a/tools/ocamlmktop.ml b/tools/ocamlmktop.ml index ee21f76e40..06288d740b 100644 --- a/tools/ocamlmktop.ml +++ b/tools/ocamlmktop.ml @@ -12,4 +12,6 @@ let _ = let args = Ccomp.quote_files (List.tl (Array.to_list Sys.argv)) in - exit(Sys.command("ocamlc -I +compiler-libs -linkall ocamlcommon.cma ocamlbytecomp.cma ocamltoplevel.cma " ^ args ^ " topstart.cmo")) + exit(Sys.command("ocamlc -I +compiler-libs -linkall ocamlcommon.cma \ + ocamlbytecomp.cma ocamltoplevel.cma " + ^ args ^ " topstart.cmo")) diff --git a/tools/ocamlmktop.tpl b/tools/ocamlmktop.tpl index f6994da868..a6eef60ab5 100644 --- a/tools/ocamlmktop.tpl +++ b/tools/ocamlmktop.tpl @@ -11,4 +11,5 @@ # # ######################################################################### -exec %%BINDIR%%/jocamlc -I +compiler-libs -linkall ocamlcommon.cma ocamlbytecomp.cma ocamltoplevel.cma "$@" topstart.cmo +exec %%BINDIR%%/jocamlc -I +compiler-libs -linkall ocamlcommon.cma \ + ocamlbytecomp.cma ocamltoplevel.cma "$@" topstart.cmo diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml index 1e47e16086..1832248347 100644 --- a/tools/ocamloptp.ml +++ b/tools/ocamloptp.ml @@ -76,10 +76,10 @@ module Options = Main_args.Make_optcomp_options (struct let _pp s = incompatible "-pp" let _ppx s = incompatible "-ppx" let _principal = option "-principal" - let _short_paths = option "-short-paths" let _rectypes = option "-rectypes" let _runtime_variant s = option_with_arg "-runtime-variant" s let _S = option "-S" + let _short_paths = option "-short-paths" let _strict_sequence = option "-strict-sequence" let _shared = option "-shared" let _thread = option "-thread" diff --git a/tools/untypeast.ml b/tools/untypeast.ml index 1f96771c97..8a440d82a9 100644 --- a/tools/untypeast.ml +++ b/tools/untypeast.ml @@ -153,10 +153,12 @@ and untype_exception_declaration decl = and untype_pattern pat = let desc = match pat with - { pat_extra=[Tpat_unpack, _]; pat_desc = Tpat_var (_,name); _ } -> Ppat_unpack name + { pat_extra=[Tpat_unpack, _]; pat_desc = Tpat_var (_,name); _ } -> + Ppat_unpack name | { pat_extra=[Tpat_type (_path, lid), _]; _ } -> Ppat_type lid | { pat_extra= (Tpat_constraint ct, _) :: rem; _ } -> - Ppat_constraint (untype_pattern { pat with pat_extra=rem }, untype_core_type ct) + Ppat_constraint (untype_pattern { pat with pat_extra=rem }, + untype_core_type ct) | _ -> match pat.pat_desc with Tpat_any -> Ppat_any @@ -177,6 +179,7 @@ and untype_pattern pat = Ppat_construct (lid, (match args with [] -> None + | [arg] -> Some (untype_pattern arg) | args -> Some { ppat_desc = Ppat_tuple (List.map untype_pattern args); ppat_loc = pat.pat_loc; } @@ -356,7 +359,7 @@ and untype_signature_item item = | Tsig_modtype (_id, name, mdecl) -> Psig_modtype (name, untype_modtype_declaration mdecl) | Tsig_open (ovf, _path, lid) -> Psig_open (ovf, lid) - | Tsig_include (mty, _lid) -> Psig_include (untype_module_type mty) + | Tsig_include (mty, _) -> Psig_include (untype_module_type mty) | Tsig_class list -> Psig_class (List.map untype_class_description list) | Tsig_class_type list -> @@ -448,7 +451,8 @@ and untype_module_expr mexpr = and untype_class_expr cexpr = let desc = match cexpr.cl_desc with - | Tcl_constraint ( { cl_desc = Tcl_ident (_path, lid, tyl); _ }, None, _, _, _ ) -> + | Tcl_constraint ( { cl_desc = Tcl_ident (_path, lid, tyl); _ }, + None, _, _, _ ) -> Pcl_constr (lid, List.map untype_core_type tyl) | Tcl_structure clstr -> Pcl_structure (untype_class_structure clstr) |