summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2014-08-22 13:45:02 +0000
committerDamien Doligez <damien.doligez-inria.fr>2014-08-22 13:45:02 +0000
commitcbfe627f925ab2bab93bae7a7bc9f6ee6afb8637 (patch)
treeaf5ec283ac3175b1ab95dd745dbd05f2298b9da6 /tools
parent09ad9c1abbe6bee443a55379223280dab3de4749 (diff)
downloadocaml-cbfe627f925ab2bab93bae7a7bc9f6ee6afb8637.tar.gz
merge changes from branch 4.02 from branching (rev 14852) to 4.02.0+rc1 (rev 15121)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15125 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'tools')
-rw-r--r--tools/.depend10
-rwxr-xr-xtools/check-typo6
-rw-r--r--tools/cmt2annot.ml8
-rw-r--r--tools/dumpobj.ml2
-rwxr-xr-xtools/make-package-macosx2
-rw-r--r--tools/ocamlprof.ml6
-rw-r--r--tools/untypeast.ml30
7 files changed, 47 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/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 19cf6bdc90..7641c91d0a 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)
@@ -284,7 +287,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)
@@ -582,7 +585,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;
}
@@ -592,6 +600,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) ->
@@ -605,8 +618,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 }