summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2014-04-14 11:52:29 +0000
committerAlain Frisch <alain@frisch.fr>2014-04-14 11:52:29 +0000
commit6346154d4bc690c7909d5cff4bf7fc1bc57bbcc6 (patch)
tree7faa3541ad30d103e071e850f5bfe2f66bfe2e0a /tools
parent907c477c02450deb9b452b47599dc1d16806395c (diff)
parent5f5bd08abc667d67762e80f1febded27a99842b9 (diff)
downloadocaml-6346154d4bc690c7909d5cff4bf7fc1bc57bbcc6.tar.gz
Synchronize with trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record3@14587 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'tools')
-rw-r--r--tools/.ignore3
-rw-r--r--tools/Makefile2
-rw-r--r--tools/Makefile.nt2
-rw-r--r--tools/Makefile.shared30
-rwxr-xr-xtools/check-typo14
-rw-r--r--tools/dumpobj.ml2
-rw-r--r--tools/eqparsetree.ml10
-rw-r--r--tools/read_cmt.ml31
-rw-r--r--tools/untypeast.ml15
-rw-r--r--tools/untypeast.mli3
10 files changed, 63 insertions, 49 deletions
diff --git a/tools/.ignore b/tools/.ignore
index ce14846de2..94fac02fbc 100644
--- a/tools/.ignore
+++ b/tools/.ignore
@@ -18,11 +18,10 @@ keywords
lexer299.ml
ocaml299to3
ocamlmklib
-ocamlmklib.ml
+ocamlmklibconfig.ml
lexer301.ml
scrapelabels
addlabels
-myocamlbuild_config.ml
objinfo_helper
read_cmt
read_cmt.opt
diff --git a/tools/Makefile b/tools/Makefile
index e2f3cb26e7..b5cc10109b 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -19,7 +19,7 @@ ocamlmktop: ocamlmktop.tpl ../config/Makefile
chmod +x ocamlmktop
install::
- cp ocamlmktop $(BINDIR)
+ cp ocamlmktop $(INSTALL_BINDIR)
clean::
rm -f ocamlmktop
diff --git a/tools/Makefile.nt b/tools/Makefile.nt
index 052af81c22..ed9b35946d 100644
--- a/tools/Makefile.nt
+++ b/tools/Makefile.nt
@@ -21,7 +21,7 @@ ocamlmktop: $(OCAMLMKTOP)
$(CAMLC) $(LINKFLAGS) -o ocamlmktop $(OCAMLMKTOP_IMPORTS) $(OCAMLMKTOP)
install::
- cp ocamlmktop $(BINDIR)/ocamlmktop$(EXE)
+ cp ocamlmktop $(INSTALL_BINDIR)/ocamlmktop$(EXE)
clean::
rm -f ocamlmktop$(EXE)
diff --git a/tools/Makefile.shared b/tools/Makefile.shared
index 39be1db4e9..6b33a5b047 100644
--- a/tools/Makefile.shared
+++ b/tools/Makefile.shared
@@ -54,10 +54,14 @@ clean::
if test -f ocamldep; then mv -f ocamldep ocamldep.bak; else :; fi
rm -f ocamldep.opt
+
+INSTALL_BINDIR=$(DESTDIR)$(BINDIR)
+INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
+
install::
- cp ocamldep $(BINDIR)/ocamldep$(EXE)
+ cp ocamldep $(INSTALL_BINDIR)/ocamldep$(EXE)
if test -f ocamldep.opt; \
- then cp ocamldep.opt $(BINDIR)/ocamldep.opt$(EXE); else :; fi
+ then cp ocamldep.opt $(INSTALL_BINDIR)/ocamldep.opt$(EXE); else :; fi
# The profiler
@@ -79,13 +83,13 @@ ocamloptp: ocamloptp.cmo
opt:: profiling.cmx
install::
- cp ocamlprof $(BINDIR)/ocamlprof$(EXE)
- cp ocamlcp $(BINDIR)/ocamlcp$(EXE)
- cp ocamloptp $(BINDIR)/ocamloptp$(EXE)
- cp profiling.cmi profiling.cmo $(LIBDIR)
+ cp ocamlprof $(INSTALL_BINDIR)/ocamlprof$(EXE)
+ cp ocamlcp $(INSTALL_BINDIR)/ocamlcp$(EXE)
+ cp ocamloptp $(INSTALL_BINDIR)/ocamloptp$(EXE)
+ cp profiling.cmi profiling.cmo $(INSTALL_LIBDIR)
installopt::
- cp profiling.cmx profiling.o $(LIBDIR)
+ cp profiling.cmx profiling.$(O) $(INSTALL_LIBDIR)
clean::
rm -f ocamlprof ocamlcp ocamloptp
@@ -97,7 +101,7 @@ ocamlmklib: ocamlmklibconfig.cmo ocamlmklib.cmo
$(CAMLC) $(LINKFLAGS) -o ocamlmklib ocamlmklibconfig.cmo ocamlmklib.cmo
install::
- cp ocamlmklib $(BINDIR)/ocamlmklib$(EXE)
+ cp ocamlmklib $(INSTALL_BINDIR)/ocamlmklib$(EXE)
clean::
rm -f ocamlmklib
@@ -132,7 +136,7 @@ lexer299.ml: lexer299.mll
$(CAMLLEX) lexer299.mll
#install::
-# cp ocaml299to3 $(BINDIR)/ocaml299to3$(EXE)
+# cp ocaml299to3 $(INSTALL_BINDIR)/ocaml299to3$(EXE)
clean::
rm -f ocaml299to3 lexer299.ml
@@ -148,7 +152,7 @@ lexer301.ml: lexer301.mll
$(CAMLLEX) lexer301.mll
#install::
-# cp scrapelabels $(LIBDIR)
+# cp scrapelabels $(INSTALL_LIBDIR)
clean::
rm -f scrapelabels lexer301.ml
@@ -164,7 +168,7 @@ addlabels: addlabels.cmo
$(ADDLABELS_IMPORTS) addlabels.cmo
#install::
-# cp addlabels $(LIBDIR)
+# cp addlabels $(INSTALL_LIBDIR)
clean::
rm -f addlabels
@@ -285,8 +289,8 @@ objinfo: objinfo_helper$(EXE) $(OBJINFO)
$(CAMLC) -o objinfo $(OBJINFO)
install::
- cp objinfo $(BINDIR)/ocamlobjinfo$(EXE)
- cp objinfo_helper$(EXE) $(LIBDIR)/objinfo_helper$(EXE)
+ cp objinfo $(INSTALL_BINDIR)/ocamlobjinfo$(EXE)
+ cp objinfo_helper$(EXE) $(INSTALL_LIBDIR)/objinfo_helper$(EXE)
clean::
rm -f objinfo objinfo_helper$(EXE)
diff --git a/tools/check-typo b/tools/check-typo
index 05c7c68c07..93814131e5 100755
--- a/tools/check-typo
+++ b/tools/check-typo
@@ -34,6 +34,10 @@
# Built-in exceptions:
# - Any binary file (i.e. with svn:mime-type = application/octet-stream)
# is automatically exempt from all the rules.
+# - Any file whose name matches one of the following patterns is
+# automatically exempt from all rules
+# *.reference
+# */reference
# - 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
@@ -45,11 +49,6 @@
# *.mltop
# *.odocl
# *.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.
@@ -138,10 +137,7 @@ IGNORE_DIRS="
case "$f" in
*/.depend*|*/.ignore) h;;
*.mlpack|*.mllib|*.mltop|*.odocl|*.itarget|*.clib) h;;
- *.reference|*/reference) h;;
- esac
- case "$f" in
- *.reference) rules="long-line,$rules";;
+ *.reference|*/reference) continue;;
esac
(cat "$f"; echo) \
diff --git a/tools/dumpobj.ml b/tools/dumpobj.ml
index db8494cc26..f1255e9cd2 100644
--- a/tools/dumpobj.ml
+++ b/tools/dumpobj.ml
@@ -493,6 +493,7 @@ let dump_obj filename ic =
if cu.cu_debug > 0 then begin
seek_in ic cu.cu_debug;
let evl = (input_value ic : debug_event list) in
+ ignore (input_value ic); (* Skip the list of absolute directory names *)
record_events 0 evl
end;
seek_in ic cu.cu_pos;
@@ -531,6 +532,7 @@ let dump_exe ic =
for _i = 1 to num_eventlists do
let orig = input_binary_int ic in
let evl = (input_value ic : debug_event list) in
+ ignore (input_value ic); (* Skip the list of absolute directory names *)
record_events orig evl
done
with Not_found -> ()
diff --git a/tools/eqparsetree.ml b/tools/eqparsetree.ml
index 332efa3e14..128453e0c3 100644
--- a/tools/eqparsetree.ml
+++ b/tools/eqparsetree.ml
@@ -120,7 +120,7 @@ module Asttypes = struct
(('all_a0 loc) * ('all_a0 loc)) -> 'result =
fun mf_a ({ txt = a0; loc = a1 }, { txt = b0; loc = b1 }) ->
(mf_a (a0, b0)) && (Location.eq_t (a1, b1))
-
+
end
let rec eq_row_field : (row_field * row_field) -> 'result =
@@ -185,7 +185,7 @@ and eq_core_type : (core_type * core_type) -> 'result =
({ ptyp_desc = a0; ptyp_loc = a1 },
{ ptyp_desc = b0; ptyp_loc = b1 })
-> (eq_core_type_desc (a0, b0)) && (Location.eq_t (a1, b1))
-
+
let eq_class_infos :
'all_a0.
(('all_a0 * 'all_a0) -> 'result) ->
@@ -221,7 +221,7 @@ let eq_class_infos :
(eq_bool (a0, b0)) && (eq_bool (a1, b1)))
(a4, b4)))
&& (Location.eq_t (a5, b5))
-
+
let rec eq_pattern_desc : (pattern_desc * pattern_desc) -> 'result =
function
| (Ppat_any, Ppat_any) -> true
@@ -259,7 +259,7 @@ and eq_pattern : (pattern * pattern) -> 'result =
({ ppat_desc = a0; ppat_loc = a1 },
{ ppat_desc = b0; ppat_loc = b1 })
-> (eq_pattern_desc (a0, b0)) && (Location.eq_t (a1, b1))
-
+
let rec eq_structure_item_desc :
(structure_item_desc * structure_item_desc) -> 'result =
function
@@ -760,7 +760,7 @@ and eq_expression : (expression * expression) -> 'result =
({ pexp_desc = a0; pexp_loc = a1 },
{ pexp_desc = b0; pexp_loc = b1 })
-> (eq_expression_desc (a0, b0)) && (Location.eq_t (a1, b1))
-
+
let rec eq_directive_argument :
(directive_argument * directive_argument) -> 'result =
function
diff --git a/tools/read_cmt.ml b/tools/read_cmt.ml
index c0c5eb09dc..0ff9f3df77 100644
--- a/tools/read_cmt.ml
+++ b/tools/read_cmt.ml
@@ -16,43 +16,49 @@ let print_info_arg = ref false
let target_filename = ref None
let arg_list = [
- "-o", Arg.String (fun s ->
- target_filename := Some s
- ), " FILE (or -) : dump to file FILE (or stdout)";
+ "-o", Arg.String (fun s -> target_filename := Some s),
+ " FILE (or -) : dump to file FILE (or stdout)";
"-annot", Arg.Set gen_annot, " : generate the corresponding .annot file";
- "-src", Arg.Set gen_ml, " : generate an equivalent of the original source file (without comments) from a .cmt or a .cmti file";
+ "-src", Arg.Set gen_ml,
+ " : convert .cmt or .cmti back to source code (without comments)";
"-info", Arg.Set print_info_arg, " : print information on the file";
]
-let arg_usage = "read_cmt [OPTIONS] FILE.cmt : read FILE.cmt and print related information"
+let arg_usage =
+ "read_cmt [OPTIONS] FILE.cmt : read FILE.cmt and print related information"
let print_info cmt =
let open Cmt_format in
Printf.printf "module name: %s\n" cmt.cmt_modname;
begin match cmt.cmt_annots with
- Packed (_, list) -> Printf.printf "pack: %s\n" (String.concat " " list)
+ Packed (_, list) ->
+ Printf.printf "pack: %s\n" (String.concat " " list)
| Implementation _ -> Printf.printf "kind: implementation\n"
| Interface _ -> Printf.printf "kind: interface\n"
- | Partial_implementation _ -> Printf.printf "kind: implementation with errors\n"
+ | Partial_implementation _ ->
+ Printf.printf "kind: implementation with errors\n"
| Partial_interface _ -> Printf.printf "kind: interface with errors\n"
end;
- Printf.printf "command: %s\n" (String.concat " " (Array.to_list cmt.cmt_args));
+ Printf.printf "command: %s\n"
+ (String.concat " " (Array.to_list cmt.cmt_args));
begin match cmt.cmt_sourcefile with
None -> ()
| Some name ->
Printf.printf "sourcefile: %s\n" name;
end;
Printf.printf "build directory: %s\n" cmt.cmt_builddir;
- List.iter (fun dir -> Printf.printf "load path: %s\n%!" dir) cmt.cmt_loadpath;
+ List.iter (Printf.printf "load path: %s\n%!") cmt.cmt_loadpath;
begin
match cmt.cmt_source_digest with
None -> ()
- | Some digest -> Printf.printf "source digest: %s\n" (Digest.to_hex digest);
+ | Some digest ->
+ Printf.printf "source digest: %s\n" (Digest.to_hex digest);
end;
begin
match cmt.cmt_interface_digest with
None -> ()
- | Some digest -> Printf.printf "interface digest: %s\n" (Digest.to_hex digest);
+ | Some digest ->
+ Printf.printf "interface digest: %s\n" (Digest.to_hex digest);
end;
List.iter (fun (name, digest) ->
Printf.printf "import: %s %s\n" name (Digest.to_hex digest);
@@ -74,7 +80,8 @@ let _ =
if !gen_ml then Cmt2annot.gen_ml !target_filename filename cmt;
if !print_info_arg || not (!gen_ml || !gen_annot) then print_info cmt;
end else begin
- Printf.fprintf stderr "Error: the file must have an extension in .cmt or .cmti.\n%!";
+ Printf.fprintf stderr
+ "Error: the file's extension must be .cmt or .cmti.\n%!";
Arg.usage arg_list arg_usage
end
) arg_usage
diff --git a/tools/untypeast.ml b/tools/untypeast.ml
index 931e8cee58..84877bfb29 100644
--- a/tools/untypeast.ml
+++ b/tools/untypeast.ml
@@ -62,7 +62,8 @@ and untype_structure_item item =
| Tstr_recmodule list ->
Pstr_recmodule (List.map untype_module_binding list)
| Tstr_modtype mtd ->
- Pstr_modtype {pmtd_name=mtd.mtd_name; pmtd_type=option untype_module_type mtd.mtd_type;
+ Pstr_modtype {pmtd_name=mtd.mtd_name;
+ pmtd_type=option untype_module_type mtd.mtd_type;
pmtd_loc=mtd.mtd_loc;pmtd_attributes=mtd.mtd_attributes;}
| Tstr_open (ovf, _path, lid, attrs) -> Pstr_open (ovf, lid, attrs)
| Tstr_class list ->
@@ -197,7 +198,8 @@ and untype_pattern pat =
| Tpat_or (p1, p2, _) -> Ppat_or (untype_pattern p1, untype_pattern p2)
| Tpat_lazy p -> Ppat_lazy (untype_pattern p)
in
- Pat.mk ~loc:pat.pat_loc ~attrs:pat.pat_attributes desc (* todo: fix attributes on extras *)
+ Pat.mk ~loc:pat.pat_loc ~attrs:pat.pat_attributes desc
+ (* todo: fix attributes on extras *)
and untype_extra (extra, loc, attrs) sexp =
let desc =
@@ -337,7 +339,8 @@ and untype_signature_item item =
| Tsig_exception decl ->
Psig_exception (untype_constructor_declaration decl)
| Tsig_module md ->
- Psig_module {pmd_name = md.md_name; pmd_type = untype_module_type md.md_type;
+ Psig_module {pmd_name = md.md_name;
+ pmd_type = untype_module_type md.md_type;
pmd_attributes = md.md_attributes; pmd_loc = md.md_loc;
}
| Tsig_recmodule list ->
@@ -345,10 +348,12 @@ and untype_signature_item item =
{pmd_name = md.md_name; pmd_type = untype_module_type md.md_type;
pmd_attributes = md.md_attributes; pmd_loc = md.md_loc}) list)
| Tsig_modtype mtd ->
- Psig_modtype {pmtd_name=mtd.mtd_name; pmtd_type=option untype_module_type mtd.mtd_type;
+ Psig_modtype {pmtd_name=mtd.mtd_name;
+ pmtd_type=option untype_module_type mtd.mtd_type;
pmtd_attributes=mtd.mtd_attributes; pmtd_loc=mtd.mtd_loc}
| Tsig_open (ovf, _path, lid, attrs) -> Psig_open (ovf, lid, attrs)
- | Tsig_include (mty, _, attrs) -> Psig_include (untype_module_type mty, attrs)
+ | Tsig_include (mty, _, attrs) ->
+ Psig_include (untype_module_type mty, attrs)
| Tsig_class list ->
Psig_class (List.map untype_class_description list)
| Tsig_class_type list ->
diff --git a/tools/untypeast.mli b/tools/untypeast.mli
index 0e0351ef9a..efd0a031d5 100644
--- a/tools/untypeast.mli
+++ b/tools/untypeast.mli
@@ -13,7 +13,8 @@
val untype_structure : Typedtree.structure -> Parsetree.structure
val untype_signature : Typedtree.signature -> Parsetree.signature
val untype_expression : Typedtree.expression -> Parsetree.expression
-val untype_type_declaration : Typedtree.type_declaration -> Parsetree.type_declaration
+val untype_type_declaration :
+ Typedtree.type_declaration -> Parsetree.type_declaration
val untype_module_type : Typedtree.module_type -> Parsetree.module_type
val lident_of_path : Path.t -> Longident.t