summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/.depend66
-rw-r--r--tools/.ignore2
-rw-r--r--tools/Makefile.shared55
-rw-r--r--tools/depend.ml6
-rw-r--r--tools/eqparsetree.ml2
-rw-r--r--tools/objinfo.ml28
-rw-r--r--tools/ocamlcp.ml1
-rw-r--r--tools/ocamlmklib.ml (renamed from tools/ocamlmklib.mlp)2
-rw-r--r--tools/ocamloptp.ml1
-rw-r--r--tools/tast_iter.ml5
-rw-r--r--tools/untypeast.ml16
11 files changed, 72 insertions, 112 deletions
diff --git a/tools/.depend b/tools/.depend
index bc45dc7616..a058ee37f3 100644
--- a/tools/.depend
+++ b/tools/.depend
@@ -27,14 +27,6 @@ depend.cmo : ../parsing/parsetree.cmi ../utils/misc.cmi \
depend.cmx : ../parsing/parsetree.cmi ../utils/misc.cmx \
../parsing/longident.cmx ../parsing/location.cmx ../parsing/asttypes.cmi \
depend.cmi
-dump_ast.cmo : ../typing/typetexp.cmi ../typing/typedtree.cmi \
- ../toplevel/toploop.cmi ../parsing/parse.cmi ../typing/outcometree.cmi \
- ../typing/oprint.cmi ../driver/errors.cmi ../typing/env.cmi \
- ../utils/config.cmi
-dump_ast.cmx : ../typing/typetexp.cmx ../typing/typedtree.cmx \
- ../toplevel/toploop.cmx ../parsing/parse.cmx ../typing/outcometree.cmi \
- ../typing/oprint.cmx ../driver/errors.cmx ../typing/env.cmx \
- ../utils/config.cmx
dumpobj.cmo : ../utils/tbl.cmi opnames.cmo ../bytecomp/opcodes.cmo \
../utils/misc.cmi ../parsing/location.cmi ../bytecomp/lambda.cmi \
../bytecomp/instruct.cmi ../typing/ident.cmi ../utils/config.cmi \
@@ -49,40 +41,34 @@ eqparsetree.cmo : ../parsing/parsetree.cmi ../parsing/longident.cmi \
../parsing/location.cmi ../parsing/asttypes.cmi
eqparsetree.cmx : ../parsing/parsetree.cmi ../parsing/longident.cmx \
../parsing/location.cmx ../parsing/asttypes.cmi
-myocamlbuild_config.cmo :
-myocamlbuild_config.cmx :
-objinfo.cmo : ../utils/misc.cmi ../utils/config.cmi \
- ../asmcomp/cmx_format.cmi ../bytecomp/cmo_format.cmi \
- ../typing/cmi_format.cmi ../asmcomp/clambda.cmi \
- ../bytecomp/bytesections.cmi
-objinfo.cmx : ../utils/misc.cmx ../utils/config.cmx \
- ../asmcomp/cmx_format.cmi ../bytecomp/cmo_format.cmi \
- ../typing/cmi_format.cmx ../asmcomp/clambda.cmx \
- ../bytecomp/bytesections.cmx
+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
+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
ocaml299to3.cmo :
ocaml299to3.cmx :
ocamlcp.cmo : ../driver/main_args.cmi
ocamlcp.cmx : ../driver/main_args.cmx
-ocamldep.cmo : ../parsing/syntaxerr.cmi ../driver/pparse.cmi \
- ../parsing/parsetree.cmi ../parsing/parse.cmi ../utils/misc.cmi \
- ../parsing/location.cmi ../parsing/lexer.cmi depend.cmi \
+ocamldep.cmo : ../driver/pparse.cmi ../parsing/parsetree.cmi \
+ ../parsing/parse.cmi ../utils/misc.cmi ../parsing/location.cmi depend.cmi \
../utils/config.cmi ../driver/compenv.cmi ../utils/clflags.cmi
-ocamldep.cmx : ../parsing/syntaxerr.cmx ../driver/pparse.cmx \
- ../parsing/parsetree.cmi ../parsing/parse.cmx ../utils/misc.cmx \
- ../parsing/location.cmx ../parsing/lexer.cmx depend.cmx \
+ocamldep.cmx : ../driver/pparse.cmx ../parsing/parsetree.cmi \
+ ../parsing/parse.cmx ../utils/misc.cmx ../parsing/location.cmx depend.cmx \
../utils/config.cmx ../driver/compenv.cmx ../utils/clflags.cmx
-ocamlmklib.cmo : myocamlbuild_config.cmo
-ocamlmklib.cmx : myocamlbuild_config.cmx
+ocamlmklib.cmo : ocamlmklibconfig.cmo
+ocamlmklib.cmx : ocamlmklibconfig.cmx
+ocamlmklibconfig.cmo :
+ocamlmklibconfig.cmx :
ocamlmktop.cmo : ../utils/ccomp.cmi
ocamlmktop.cmx : ../utils/ccomp.cmx
ocamloptp.cmo : ../driver/main_args.cmi
ocamloptp.cmx : ../driver/main_args.cmx
-ocamlprof.cmo : ../utils/warnings.cmi ../parsing/syntaxerr.cmi \
- ../parsing/parsetree.cmi ../parsing/parse.cmi ../parsing/location.cmi \
- ../parsing/lexer.cmi
-ocamlprof.cmx : ../utils/warnings.cmx ../parsing/syntaxerr.cmx \
- ../parsing/parsetree.cmi ../parsing/parse.cmx ../parsing/location.cmx \
- ../parsing/lexer.cmx
+ocamlprof.cmo : ../utils/warnings.cmi ../parsing/parsetree.cmi \
+ ../parsing/parse.cmi ../parsing/location.cmi
+ocamlprof.cmx : ../utils/warnings.cmx ../parsing/parsetree.cmi \
+ ../parsing/parse.cmx ../parsing/location.cmx
opnames.cmo :
opnames.cmx :
primreq.cmo : ../utils/config.cmi ../bytecomp/cmo_format.cmi
@@ -93,13 +79,13 @@ read_cmt.cmo : ../typing/cmt_format.cmi cmt2annot.cmo ../utils/clflags.cmi
read_cmt.cmx : ../typing/cmt_format.cmx cmt2annot.cmx ../utils/clflags.cmx
scrapelabels.cmo :
scrapelabels.cmx :
-tast_iter.cmo : ../typing/typedtree.cmi ../parsing/asttypes.cmi \
- tast_iter.cmi
-tast_iter.cmx : ../typing/typedtree.cmx ../parsing/asttypes.cmi \
- tast_iter.cmi
+tast_iter.cmo : ../typing/typedtree.cmi ../utils/misc.cmi tast_iter.cmi
+tast_iter.cmx : ../typing/typedtree.cmx ../utils/misc.cmx tast_iter.cmi
untypeast.cmo : ../typing/typedtree.cmi ../typing/path.cmi \
- ../parsing/parsetree.cmi ../parsing/longident.cmi ../typing/ident.cmi \
- ../parsing/asttypes.cmi untypeast.cmi
+ ../parsing/parsetree.cmi ../utils/misc.cmi ../parsing/longident.cmi \
+ ../typing/ident.cmi ../parsing/asttypes.cmi ../parsing/ast_helper.cmi \
+ untypeast.cmi
untypeast.cmx : ../typing/typedtree.cmx ../typing/path.cmx \
- ../parsing/parsetree.cmi ../parsing/longident.cmx ../typing/ident.cmx \
- ../parsing/asttypes.cmi untypeast.cmi
+ ../parsing/parsetree.cmi ../utils/misc.cmx ../parsing/longident.cmx \
+ ../typing/ident.cmx ../parsing/asttypes.cmi ../parsing/ast_helper.cmx \
+ untypeast.cmi
diff --git a/tools/.ignore b/tools/.ignore
index ce14846de2..5f3f25bf13 100644
--- a/tools/.ignore
+++ b/tools/.ignore
@@ -18,11 +18,9 @@ keywords
lexer299.ml
ocaml299to3
ocamlmklib
-ocamlmklib.ml
lexer301.ml
scrapelabels
addlabels
-myocamlbuild_config.ml
objinfo_helper
read_cmt
read_cmt.opt
diff --git a/tools/Makefile.shared b/tools/Makefile.shared
index 28ecac8288..39be1db4e9 100644
--- a/tools/Makefile.shared
+++ b/tools/Makefile.shared
@@ -12,12 +12,13 @@
include ../config/Makefile
-CAMLC=../boot/ocamlrun ../boot/ocamlc -strict-sequence -nostdlib -I ../boot
-CAMLOPT=../boot/ocamlrun ../ocamlopt -nostdlib -I ../stdlib
+CAMLRUN=../boot/ocamlrun
+CAMLC=$(CAMLRUN) ../boot/ocamlc -strict-sequence -nostdlib -I ../boot
+CAMLOPT=$(CAMLRUN) ../ocamlopt -nostdlib -I ../stdlib
CAMLLEX=$(CAMLRUN) ../boot/ocamllex
INCLUDES=-I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp \
-I ../driver -I ../toplevel
-COMPFLAGS= -w +33..39 -warn-error A $(INCLUDES)
+COMPFLAGS= -w +32..39 -warn-error A $(INCLUDES)
LINKFLAGS=$(INCLUDES)
all: ocamldep ocamlprof ocamlcp ocamloptp ocamlmktop ocamlmklib dumpobj \
@@ -92,17 +93,8 @@ clean::
# To help building mixed-mode libraries (OCaml + C)
-ocamlmklib: myocamlbuild_config.cmo ocamlmklib.cmo
- $(CAMLC) $(LINKFLAGS) -o ocamlmklib myocamlbuild_config.cmo \
- ocamlmklib.cmo
-
-ocamlmklib.cmo: myocamlbuild_config.cmi
-
-myocamlbuild_config.cmi: myocamlbuild_config.cmo
-
-myocamlbuild_config.ml: ../config/Makefile ../build/mk_shell_and_ocamlbuild_config.sh
- ../build/mk_shell_and_ocamlbuild_config.sh
- cp ../myocamlbuild_config.ml .
+ocamlmklib: ocamlmklibconfig.cmo ocamlmklib.cmo
+ $(CAMLC) $(LINKFLAGS) -o ocamlmklib ocamlmklibconfig.cmo ocamlmklib.cmo
install::
cp ocamlmklib $(BINDIR)/ocamlmklib$(EXE)
@@ -110,22 +102,23 @@ install::
clean::
rm -f ocamlmklib
-ocamlmklib.ml: ocamlmklib.mlp ../config/Makefile
- echo '(* THIS FILE IS GENERATED FROM ocamlmklib.mlp *)' >ocamlmklib.ml
- sed -e "s|%%BINDIR%%|$(BINDIR)|" \
- -e "s|%%SUPPORTS_SHARED_LIBRARIES%%|$(SUPPORTS_SHARED_LIBRARIES)|" \
- -e "s|%%MKSHAREDLIB%%|$(MKSHAREDLIB)|" \
- -e "s|%%BYTECCRPATH%%|$(BYTECCRPATH)|" \
- -e "s|%%NATIVECCRPATH%%|$(NATIVECCRPATH)|" \
- -e "s|%%MKSHAREDLIBRPATH%%|$(MKSHAREDLIBRPATH)|" \
- -e "s|%%RANLIB%%|$(RANLIB)|" \
- ocamlmklib.mlp >> ocamlmklib.ml
-
-beforedepend:: ocamlmklib.ml
+ocamlmklibconfig.ml: ../config/Makefile
+ (echo 'let bindir = "$(BINDIR)"'; \
+ echo 'let ext_lib = "$(EXT_LIB)"'; \
+ echo 'let ext_dll = "$(EXT_DLL)"'; \
+ echo 'let supports_shared_libraries = $(SUPPORTS_SHARED_LIBRARIES)';\
+ echo 'let mkdll = "$(MKDLL)"'; \
+ echo 'let byteccrpath = "$(BYTECCRPATH)"'; \
+ echo 'let nativeccrpath = "$(NATIVECCRPATH)"'; \
+ echo 'let mksharedlibrpath = "$(MKSHAREDLIBRPATH)"'; \
+ echo 'let toolpref = "$(TOOLPREF)"'; \
+ sed -n -e 's/^#ml //p' ../config/Makefile) \
+ > ocamlmklibconfig.ml
+
+beforedepend:: ocamlmklibconfig.ml
clean::
- rm -f ocamlmklib.ml
-
+ rm -f ocamlmklibconfig.ml
# Converter olabl/ocaml 2.99 to ocaml 3
@@ -283,9 +276,9 @@ objinfo_helper$(EXE): objinfo_helper.c ../config/s.h
$(BYTECC) -o objinfo_helper$(EXE) $(BYTECCCOMPOPTS) \
objinfo_helper.c $(LIBBFD_LINK)
-OBJINFO=../utils/misc.cmo ../utils/config.cmo \
- ../utils/warnings.cmo ../parsing/location.cmo \
- ../typing/cmi_format.cmo ../bytecomp/bytesections.cmo \
+OBJINFO=../compilerlibs/ocamlcommon.cma \
+ ../compilerlibs/ocamlbytecomp.cma \
+ ../asmcomp/printclambda.cmo \
objinfo.cmo
objinfo: objinfo_helper$(EXE) $(OBJINFO)
diff --git a/tools/depend.ml b/tools/depend.ml
index a1b851e24d..7ff6704f70 100644
--- a/tools/depend.ml
+++ b/tools/depend.ml
@@ -199,9 +199,11 @@ and add_bindings recf bv pel =
and add_modtype bv mty =
match mty.pmty_desc with
Pmty_ident l -> add bv l
+ | Pmty_alias l -> addmodule bv l
| Pmty_signature s -> add_signature bv s
| Pmty_functor(id, mty1, mty2) ->
- add_modtype bv mty1; add_modtype (StringSet.add id.txt bv) mty2
+ Misc.may (add_modtype bv) mty1;
+ add_modtype (StringSet.add id.txt bv) mty2
| Pmty_with(mty, cstrl) ->
add_modtype bv mty;
List.iter
@@ -258,7 +260,7 @@ and add_module bv modl =
Pmod_ident l -> addmodule bv l
| Pmod_structure s -> ignore (add_structure bv s)
| Pmod_functor(id, mty, modl) ->
- add_modtype bv mty;
+ Misc.may (add_modtype bv) mty;
add_module (StringSet.add id.txt bv) modl
| Pmod_apply(mod1, mod2) ->
add_module bv mod1; add_module bv mod2
diff --git a/tools/eqparsetree.ml b/tools/eqparsetree.ml
index 6326d67e02..332efa3e14 100644
--- a/tools/eqparsetree.ml
+++ b/tools/eqparsetree.ml
@@ -666,7 +666,7 @@ and eq_expression_desc :
eq_list
(fun ((a0, a1), (b0, b1)) ->
(eq_pattern (a0, b0)) && (eq_expression (a1, b1)))
- (a2, b2))
+ (a2, b2)
| (Pexp_apply (a0, a1), Pexp_apply (b0, b1)) ->
(eq_expression (a0, b0)) &&
(eq_list
diff --git a/tools/objinfo.ml b/tools/objinfo.ml
index eb88a8b29c..6f3ec75665 100644
--- a/tools/objinfo.ml
+++ b/tools/objinfo.ml
@@ -20,7 +20,6 @@ open Printf
open Misc
open Config
open Cmo_format
-open Clambda
let input_stringlist ic len =
let get_string_list sect len =
@@ -54,31 +53,6 @@ let print_cmo_infos cu =
List.iter print_line l);
printf "Force link: %s\n" (if cu.cu_force_link then "YES" else "no")
-let rec print_approx_infos ppf = function
- Value_closure(fundesc, approx) ->
- Format.fprintf ppf "@[<2>function %s@ arity %i"
- fundesc.fun_label fundesc.fun_arity;
- if fundesc.fun_closed then begin
- Format.fprintf ppf "@ (closed)"
- end;
- if fundesc.fun_inline <> None then begin
- Format.fprintf ppf "@ (inline)"
- end;
- Format.fprintf ppf "@ -> @ %a@]" print_approx_infos approx
- | Value_tuple approx ->
- let tuple ppf approx =
- for i = 0 to Array.length approx - 1 do
- if i > 0 then Format.fprintf ppf ";@ ";
- Format.fprintf ppf "%i: %a" i print_approx_infos approx.(i)
- done in
- Format.fprintf ppf "@[<hov 1>(%a)@]" tuple approx
- | Value_unknown ->
- Format.fprintf ppf "_"
- | Value_integer n ->
- Format.fprintf ppf "%d" n
- | Value_constptr n ->
- Format.fprintf ppf "%dp" n
-
let print_spaced_string s =
printf " %s" s
@@ -116,7 +90,7 @@ let print_cmx_infos (ui, crc) =
print_general_infos
ui.ui_name crc ui.ui_defines ui.ui_imports_cmi ui.ui_imports_cmx;
printf "Approximation:\n";
- Format.fprintf Format.std_formatter " %a@." print_approx_infos ui.ui_approx;
+ Format.fprintf Format.std_formatter " %a@." Printclambda.approx ui.ui_approx;
let pr_funs _ fns =
List.iter (fun arity -> printf " %d" arity) fns in
printf "Currying functions:%a\n" pr_funs ui.ui_curry_fun;
diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml
index 82b0174a87..bca5ae63c5 100644
--- a/tools/ocamlcp.ml
+++ b/tools/ocamlcp.ml
@@ -79,6 +79,7 @@ module Options = Main_args.Make_bytecomp_options (struct
let _runtime_variant s = option_with_arg "-runtime-variant" s
let _short_paths = option "-short-paths"
let _strict_sequence = option "-strict-sequence"
+ let _trans_mod = option "-trans-mod"
let _thread () = option "-thread" ()
let _vmthread () = option "-vmthread" ()
let _unsafe = option "-unsafe"
diff --git a/tools/ocamlmklib.mlp b/tools/ocamlmklib.ml
index 9a47d1b5e6..0ef86979b9 100644
--- a/tools/ocamlmklib.mlp
+++ b/tools/ocamlmklib.ml
@@ -11,7 +11,7 @@
(***********************************************************************)
open Printf
-open Myocamlbuild_config
+open Ocamlmklibconfig
(* PR#4783: under Windows, don't use absolute paths because we do
not know where the binary distribution will be installed. *)
diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml
index 23a439a11b..6d730f2c3c 100644
--- a/tools/ocamloptp.ml
+++ b/tools/ocamloptp.ml
@@ -84,6 +84,7 @@ module Options = Main_args.Make_optcomp_options (struct
let _strict_sequence = option "-strict-sequence"
let _shared = option "-shared"
let _thread = option "-thread"
+ let _trans_mod = option "-trans-mod"
let _unsafe = option "-unsafe"
let _v = option "-v"
let _version = option "-version"
diff --git a/tools/tast_iter.ml b/tools/tast_iter.ml
index 776e33522f..c8af136701 100644
--- a/tools/tast_iter.ml
+++ b/tools/tast_iter.ml
@@ -191,9 +191,10 @@ let class_type_declaration sub cd =
let module_type sub mty =
match mty.mty_desc with
| Tmty_ident (_path, _) -> ()
+ | Tmty_alias (_path, _) -> ()
| Tmty_signature sg -> sub # signature sg
| Tmty_functor (_id, _, mtype1, mtype2) ->
- sub # module_type mtype1; sub # module_type mtype2
+ Misc.may (sub # module_type) mtype1; sub # module_type mtype2
| Tmty_with (mtype, list) ->
sub # module_type mtype;
List.iter (fun (_, _, withc) -> sub # with_constraint withc) list
@@ -212,7 +213,7 @@ let module_expr sub mexpr =
| Tmod_ident (_p, _) -> ()
| Tmod_structure st -> sub # structure st
| Tmod_functor (_id, _, mtype, mexpr) ->
- sub # module_type mtype;
+ Misc.may (sub # module_type) mtype;
sub # module_expr mexpr
| Tmod_apply (mexp1, mexp2, _) ->
sub # module_expr mexp1;
diff --git a/tools/untypeast.ml b/tools/untypeast.ml
index 75f7ebdecc..26993440ae 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; pmtd_attributes=mtd.mtd_attributes}
+ 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 ->
Pstr_class (List.map (fun (ci, _, _) ->
@@ -106,6 +107,7 @@ and untype_module_binding mb =
pmb_name = mb.mb_name;
pmb_expr = untype_module_expr mb.mb_expr;
pmb_attributes = mb.mb_attributes;
+ pmb_loc = mb.mb_loc;
}
and untype_type_declaration decl =
@@ -330,14 +332,15 @@ and untype_signature_item item =
Psig_exception (untype_constructor_declaration decl)
| Tsig_module md ->
Psig_module {pmd_name = md.md_name; pmd_type = untype_module_type md.md_type;
- pmd_attributes = md.md_attributes;
+ pmd_attributes = md.md_attributes; pmd_loc = md.md_loc;
}
| Tsig_recmodule list ->
Psig_recmodule (List.map (fun md ->
{pmd_name = md.md_name; pmd_type = untype_module_type md.md_type;
- pmd_attributes = md.md_attributes}) list)
+ 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; pmtd_attributes=mtd.mtd_attributes}
+ 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_class list ->
@@ -374,9 +377,10 @@ and untype_class_type_declaration cd =
and untype_module_type mty =
let desc = match mty.mty_desc with
Tmty_ident (_path, lid) -> Pmty_ident (lid)
+ | Tmty_alias (_path, lid) -> Pmty_alias (lid)
| Tmty_signature sg -> Pmty_signature (untype_signature sg)
| Tmty_functor (_id, name, mtype1, mtype2) ->
- Pmty_functor (name, untype_module_type mtype1,
+ Pmty_functor (name, Misc.may_map untype_module_type mtype1,
untype_module_type mtype2)
| Tmty_with (mtype, list) ->
Pmty_with (untype_module_type mtype,
@@ -405,7 +409,7 @@ and untype_module_expr mexpr =
Tmod_ident (_p, lid) -> Pmod_ident (lid)
| Tmod_structure st -> Pmod_structure (untype_structure st)
| Tmod_functor (_id, name, mtype, mexpr) ->
- Pmod_functor (name, untype_module_type mtype,
+ Pmod_functor (name, Misc.may_map untype_module_type mtype,
untype_module_expr mexpr)
| Tmod_apply (mexp1, mexp2, _) ->
Pmod_apply (untype_module_expr mexp1, untype_module_expr mexp2)