diff options
| author | Alain Frisch <alain@frisch.fr> | 2014-09-04 16:11:12 +0000 |
|---|---|---|
| committer | Alain Frisch <alain@frisch.fr> | 2014-09-04 16:11:12 +0000 |
| commit | 378a967cb7436c5eee41262e07e26a65b7da6c74 (patch) | |
| tree | 6b1e1f339127077657d4659a8030d18dd563dd0c /tools | |
| parent | e0957377188e4b04fef7fb3f48f1b3ce3b101018 (diff) | |
| parent | a360747bc2e98e31b478898ff128bb91fcc9afbe (diff) | |
| download | ocaml-378a967cb7436c5eee41262e07e26a65b7da6c74.tar.gz | |
Sync with trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@15190 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/.depend | 10 | ||||
| -rwxr-xr-x | tools/check-typo | 6 | ||||
| -rw-r--r-- | tools/cmt2annot.ml | 8 | ||||
| -rw-r--r-- | tools/dumpobj.ml | 2 | ||||
| -rwxr-xr-x | tools/make-package-macosx | 2 | ||||
| -rw-r--r-- | tools/objinfo_helper.c | 5 | ||||
| -rw-r--r-- | tools/ocamlcp.ml | 1 | ||||
| -rw-r--r-- | tools/ocamloptp.ml | 2 | ||||
| -rw-r--r-- | tools/ocamlprof.ml | 6 | ||||
| -rw-r--r-- | tools/untypeast.ml | 30 |
10 files changed, 55 insertions, 17 deletions
diff --git a/tools/.depend b/tools/.depend index ea66ede860..b0407009d2 100644 --- a/tools/.depend +++ b/tools/.depend @@ -40,11 +40,13 @@ eqparsetree.cmo : ../parsing/parsetree.cmi ../parsing/longident.cmi \ eqparsetree.cmx : ../parsing/parsetree.cmi ../parsing/longident.cmx \ ../parsing/location.cmx ../parsing/asttypes.cmi objinfo.cmo : ../asmcomp/printclambda.cmi ../utils/misc.cmi \ - ../utils/config.cmi ../asmcomp/cmx_format.cmi ../bytecomp/cmo_format.cmi \ - ../typing/cmi_format.cmi ../bytecomp/bytesections.cmi + ../utils/config.cmi ../asmcomp/cmx_format.cmi ../typing/cmt_format.cmi \ + ../bytecomp/cmo_format.cmi ../typing/cmi_format.cmi \ + ../bytecomp/bytesections.cmi objinfo.cmx : ../asmcomp/printclambda.cmx ../utils/misc.cmx \ - ../utils/config.cmx ../asmcomp/cmx_format.cmi ../bytecomp/cmo_format.cmi \ - ../typing/cmi_format.cmx ../bytecomp/bytesections.cmx + ../utils/config.cmx ../asmcomp/cmx_format.cmi ../typing/cmt_format.cmx \ + ../bytecomp/cmo_format.cmi ../typing/cmi_format.cmx \ + ../bytecomp/bytesections.cmx ocaml299to3.cmo : ocaml299to3.cmx : ocamlcp.cmo : ../driver/main_args.cmi diff --git a/tools/check-typo b/tools/check-typo index ea7c63f775..bd48dc7a3e 100755 --- a/tools/check-typo +++ b/tools/check-typo @@ -39,11 +39,11 @@ # automatically exempt from all rules # *.reference # */reference +# */.depend* # - Any file whose name begins with "Makefile" is automatically exempt # from the "tabs" rule. # - Any file whose name matches one of the following patterns is # automatically exempt from the "missing-header" rule. -# */.depend* # */.ignore # *.mlpack # *.mllib @@ -137,9 +137,9 @@ IGNORE_DIRS=" add_hd(){ rules="missing-header,$rules"; } case "$f" in Makefile*|*/Makefile*) rules="tab,$rules";; - */.depend*|*/.ignore) add_hd;; + */.ignore) add_hd;; *.mlpack|*.mllib|*.mltop|*.odocl|*.itarget|*.clib) add_hd;; - *.reference|*/reference) continue;; + *.reference|*/reference|*/.depend*) continue;; esac case "$f" in ocamldoc/*|*/ocamldoc/*) rules="long-line,$rules";; diff --git a/tools/cmt2annot.ml b/tools/cmt2annot.ml index eee0c79065..36ca187ca5 100644 --- a/tools/cmt2annot.ml +++ b/tools/cmt2annot.ml @@ -179,9 +179,13 @@ let gen_ml target_filename filename cmt = let (printer, ext) = match cmt.Cmt_format.cmt_annots with | Cmt_format.Implementation typedtree -> - (fun ppf -> Pprintast.structure ppf (Untypeast.untype_structure typedtree)), ".ml" + (fun ppf -> Pprintast.structure ppf + (Untypeast.untype_structure typedtree)), + ".ml" | Cmt_format.Interface typedtree -> - (fun ppf -> Pprintast.signature ppf (Untypeast.untype_signature typedtree)), ".mli" + (fun ppf -> Pprintast.signature ppf + (Untypeast.untype_signature typedtree)), + ".mli" | _ -> Printf.fprintf stderr "File was generated with an error\n%!"; exit 2 diff --git a/tools/dumpobj.ml b/tools/dumpobj.ml index d95c210da4..f1e2897381 100644 --- a/tools/dumpobj.ml +++ b/tools/dumpobj.ml @@ -519,7 +519,7 @@ let dump_exe ic = primitives := read_primitive_table ic prim_size; ignore(Bytesections.seek_section ic "DATA"); let init_data = (input_value ic : Obj.t array) in - globals := Array.create (Array.length init_data) Empty; + globals := Array.make (Array.length init_data) Empty; for i = 0 to Array.length init_data - 1 do !globals.(i) <- Constant (init_data.(i)) done; diff --git a/tools/make-package-macosx b/tools/make-package-macosx index 1fa08919d2..e823156ba0 100755 --- a/tools/make-package-macosx +++ b/tools/make-package-macosx @@ -85,7 +85,7 @@ mkdir -p resources cat >resources/ReadMe.txt <<EOF This package installs OCaml version ${VERSION}. You need Mac OS X 10.7.x (Lion) or later, with the -XCode tools installed (v4.3.3 or later). +XCode tools installed (v4.6.3 or later). Files will be installed in the following directories: diff --git a/tools/objinfo_helper.c b/tools/objinfo_helper.c index 58dfd2d459..a8c79bd39d 100644 --- a/tools/objinfo_helper.c +++ b/tools/objinfo_helper.c @@ -17,7 +17,12 @@ #ifdef HAS_LIBBFD #include <stdlib.h> #include <string.h> + +// PACKAGE: protect against binutils change +// https://sourceware.org/bugzilla/show_bug.cgi?id=14243 +#define PACKAGE "ocamlobjinfo" #include <bfd.h> +#undef PACKAGE int main(int argc, char ** argv) { diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml index 75adcb82ef..51559aea3e 100644 --- a/tools/ocamlcp.ml +++ b/tools/ocamlcp.ml @@ -83,6 +83,7 @@ module Options = Main_args.Make_bytecomp_options (struct let _safe_string = option "-safe-string" let _short_paths = option "-short-paths" let _strict_sequence = option "-strict-sequence" + let _strict_formats = option "-strict-formats" let _thread () = option "-thread" () let _vmthread () = option "-vmthread" () let _unsafe = option "-unsafe" diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml index 178f7c2d25..0b788843fe 100644 --- a/tools/ocamloptp.ml +++ b/tools/ocamloptp.ml @@ -86,6 +86,7 @@ module Options = Main_args.Make_optcomp_options (struct let _safe_string = option "-safe-string" let _short_paths = option "-short-paths" let _strict_sequence = option "-strict-sequence" + let _strict_formats = option "-strict-formats" let _shared = option "-shared" let _thread = option "-thread" let _unsafe = option "-unsafe" @@ -120,6 +121,7 @@ module Options = Main_args.Make_optcomp_options (struct let _dscheduling = option "-dscheduling" let _dlinear = option "-dlinear" let _dstartup = option "-dstartup" + let _opaque = option "-opaque" let anonymous = process_file end);; diff --git a/tools/ocamlprof.ml b/tools/ocamlprof.ml index 9c2bb489dd..dde248cd48 100644 --- a/tools/ocamlprof.ml +++ b/tools/ocamlprof.ml @@ -86,7 +86,7 @@ let add_incr_counter modul (kind,pos) = | Close -> fprintf !outchan ")"; ;; -let counters = ref (Array.create 0 0) +let counters = ref (Array.make 0 0) (* User defined marker *) let special_id = ref "" @@ -122,7 +122,7 @@ let init_rewrite modes mod_name = cur_point := 0; if !instr_mode then begin fprintf !outchan "module %sProfiling = Profiling;; " modprefix; - fprintf !outchan "let %s%s_cnt = Array.create 000000000" idprefix mod_name; + fprintf !outchan "let %s%s_cnt = Array.make 000000000" idprefix mod_name; pos_len := pos_out !outchan; fprintf !outchan " 0;; Profiling.counters := \ @@ -131,7 +131,7 @@ let init_rewrite modes mod_name = end let final_rewrite add_function = - to_insert := Sort.list (fun x y -> snd x < snd y) !to_insert; + to_insert := List.sort (fun x y -> compare (snd x) (snd y)) !to_insert; prof_counter := 0; List.iter add_function !to_insert; copy (in_channel_length !inchan); diff --git a/tools/untypeast.ml b/tools/untypeast.ml index b59443c595..58242fc23e 100644 --- a/tools/untypeast.ml +++ b/tools/untypeast.ml @@ -30,6 +30,9 @@ Some notes: *) +let string_is_prefix sub str = + let sublen = String.length sub in + String.length str >= sublen && String.sub str 0 sublen = sub let option f = function None -> None | Some e -> Some (f e) @@ -288,7 +291,7 @@ and untype_expression exp = in { uc with pc_lhs = pat }) exn_cases - in + in Pexp_match (untype_expression exp, merged_cases) | Texp_try (exp, cases) -> Pexp_try (untype_expression exp, untype_cases cases) @@ -586,7 +589,12 @@ and untype_core_type ct = Typ.mk ~loc:ct.ctyp_loc desc and untype_class_structure cs = - { pcstr_self = untype_pattern cs.cstr_self; + let rec remove_self = function + | { pat_desc = Tpat_alias (p, id, _s) } when string_is_prefix "selfpat-" id.Ident.name -> + remove_self p + | p -> p + in + { pcstr_self = untype_pattern (remove_self cs.cstr_self); pcstr_fields = List.map untype_class_field cs.cstr_fields; } @@ -596,6 +604,11 @@ and untype_row_field rf = Rtag (label, attrs, bool, List.map untype_core_type list) | Tinherit ct -> Rinherit (untype_core_type ct) +and is_self_pat = function + | { pat_desc = Tpat_alias(_pat, id, _) } -> + string_is_prefix "self-" (Ident.name id) + | _ -> false + and untype_class_field cf = let desc = match cf.cf_desc with Tcf_inherit (ovf, cl, super, _vals, _meths) -> @@ -609,8 +622,19 @@ and untype_class_field cf = | Tcf_method (lab, priv, Tcfk_virtual cty) -> Pcf_method (lab, priv, Cfk_virtual (untype_core_type cty)) | Tcf_method (lab, priv, Tcfk_concrete (o, exp)) -> + let remove_fun_self = function + | { exp_desc = Texp_function("", [case], _) } when is_self_pat case.c_lhs && case.c_guard = None -> case.c_rhs + | e -> e + in + let exp = remove_fun_self exp in Pcf_method (lab, priv, Cfk_concrete (o, untype_expression exp)) - | Tcf_initializer exp -> Pcf_initializer (untype_expression exp) + | Tcf_initializer exp -> + let remove_fun_self = function + | { exp_desc = Texp_function("", [case], _) } when is_self_pat case.c_lhs && case.c_guard = None -> case.c_rhs + | e -> e + in + let exp = remove_fun_self exp in + Pcf_initializer (untype_expression exp) | Tcf_attribute x -> Pcf_attribute x in { pcf_desc = desc; pcf_loc = cf.cf_loc; pcf_attributes = cf.cf_attributes } |
