summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-08-20 16:53:53 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2015-08-20 16:53:53 +0000
commit84ebf792e69acdf88e3490dedf97775a70aaeb1d (patch)
treed01c0da5bd8d269aebfc3a08e9096ef40679d109
parentbcb02e89d4f0beec70cb1f6794c9b3afe22d3927 (diff)
parent08d7a9d403f1731cd8f7c194097e1a83f5fb1713 (diff)
downloadocaml-84ebf792e69acdf88e3490dedf97775a70aaeb1d.tar.gz
Update wrt trunk, revision 16361.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/ppc64@16362 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--.depend158
-rw-r--r--Changes14
-rw-r--r--Makefile5
-rw-r--r--asmrun/.depend90
-rwxr-xr-xboot/ocamlcbin1805465 -> 1809641 bytes
-rwxr-xr-xboot/ocamldepbin567836 -> 571103 bytes
-rwxr-xr-xboot/ocamllexbin259143 -> 259267 bytes
-rw-r--r--byterun/.depend66
-rw-r--r--byterun/backtrace.c88
-rw-r--r--byterun/caml/minor_gc.h3
-rw-r--r--byterun/custom.c10
-rw-r--r--byterun/intern.c10
-rw-r--r--byterun/minor_gc.c13
-rw-r--r--byterun/sys.c22
-rw-r--r--debugger/.depend2
-rw-r--r--driver/compenv.ml11
-rw-r--r--driver/main.ml5
-rw-r--r--driver/main_args.ml17
-rw-r--r--driver/main_args.mli1
-rw-r--r--driver/optmain.ml5
-rw-r--r--lex/.depend6
-rw-r--r--ocamlbuild/.depend50
-rw-r--r--ocamlbuild/main.ml4
-rw-r--r--ocamlbuild/ocaml_specific.ml24
-rw-r--r--ocamlbuild/signatures.mli106
-rw-r--r--ocamldoc/.depend26
-rw-r--r--otherlibs/dynlink/Makefile3
-rw-r--r--otherlibs/num/.depend4
-rw-r--r--otherlibs/unix/.depend20
-rw-r--r--parsing/location.ml72
-rw-r--r--parsing/location.mli15
-rw-r--r--parsing/syntaxerr.ml26
-rw-r--r--stdlib/.depend58
-rw-r--r--testsuite/tests/regression/pr3612/Makefile18
-rw-r--r--testsuite/tests/regression/pr3612/custom_finalize.c62
-rw-r--r--testsuite/tests/regression/pr3612/pr3612.ml32
-rw-r--r--testsuite/tests/regression/pr3612/pr3612.reference1
-rw-r--r--testsuite/tests/typing-recordarg/Makefile1
-rw-r--r--tools/.depend6
-rwxr-xr-xtools/ci-build17
-rw-r--r--tools/ocamlcp.ml1
-rw-r--r--tools/ocamldep.ml9
-rw-r--r--tools/ocamloptp.ml1
-rw-r--r--utils/clflags.ml8
-rw-r--r--utils/clflags.mli4
-rw-r--r--utils/misc.ml120
-rw-r--r--utils/misc.mli41
47 files changed, 881 insertions, 374 deletions
diff --git a/.depend b/.depend
index 8119b088c0..d08269930f 100644
--- a/.depend
+++ b/.depend
@@ -2,7 +2,7 @@ utils/ccomp.cmi :
utils/clflags.cmi :
utils/config.cmi :
utils/consistbl.cmi :
-utils/misc.cmi :
+utils/misc.cmi : utils/clflags.cmi
utils/tbl.cmi :
utils/terminfo.cmi :
utils/warnings.cmi :
@@ -16,8 +16,8 @@ utils/config.cmo : utils/config.cmi
utils/config.cmx : utils/config.cmi
utils/consistbl.cmo : utils/consistbl.cmi
utils/consistbl.cmx : utils/consistbl.cmi
-utils/misc.cmo : utils/misc.cmi
-utils/misc.cmx : utils/misc.cmi
+utils/misc.cmo : utils/clflags.cmi utils/misc.cmi
+utils/misc.cmx : utils/clflags.cmx utils/misc.cmi
utils/tbl.cmo : utils/tbl.cmi
utils/tbl.cmx : utils/tbl.cmi
utils/terminfo.cmo : utils/terminfo.cmi
@@ -63,10 +63,10 @@ parsing/lexer.cmo : utils/warnings.cmi parsing/parser.cmi utils/misc.cmi \
parsing/location.cmi parsing/docstrings.cmi parsing/lexer.cmi
parsing/lexer.cmx : utils/warnings.cmx parsing/parser.cmx utils/misc.cmx \
parsing/location.cmx parsing/docstrings.cmx parsing/lexer.cmi
-parsing/location.cmo : utils/warnings.cmi utils/terminfo.cmi \
- parsing/location.cmi
-parsing/location.cmx : utils/warnings.cmx utils/terminfo.cmx \
- parsing/location.cmi
+parsing/location.cmo : utils/warnings.cmi utils/terminfo.cmi utils/misc.cmi \
+ utils/clflags.cmi parsing/location.cmi
+parsing/location.cmx : utils/warnings.cmx utils/terminfo.cmx utils/misc.cmx \
+ utils/clflags.cmx parsing/location.cmi
parsing/longident.cmo : utils/misc.cmi parsing/longident.cmi
parsing/longident.cmx : utils/misc.cmx parsing/longident.cmi
parsing/parse.cmo : parsing/syntaxerr.cmi parsing/parser.cmi \
@@ -105,10 +105,10 @@ typing/cmt_format.cmi : typing/types.cmi typing/typedtree.cmi \
typing/ctype.cmi : typing/types.cmi typing/path.cmi parsing/longident.cmi \
typing/ident.cmi typing/env.cmi parsing/asttypes.cmi
typing/datarepr.cmi : typing/types.cmi typing/path.cmi typing/ident.cmi
+typing/envaux.cmi : typing/subst.cmi typing/path.cmi typing/env.cmi
typing/env.cmi : utils/warnings.cmi typing/types.cmi typing/subst.cmi \
typing/path.cmi parsing/longident.cmi parsing/location.cmi \
typing/ident.cmi utils/consistbl.cmi parsing/asttypes.cmi
-typing/envaux.cmi : typing/subst.cmi typing/path.cmi typing/env.cmi
typing/ident.cmi :
typing/includeclass.cmi : typing/types.cmi typing/env.cmi typing/ctype.cmi
typing/includecore.cmi : typing/types.cmi typing/typedtree.cmi \
@@ -126,10 +126,10 @@ typing/parmatch.cmi : typing/types.cmi typing/typedtree.cmi \
typing/path.cmi : typing/ident.cmi
typing/predef.cmi : typing/types.cmi typing/path.cmi typing/ident.cmi
typing/primitive.cmi :
+typing/printtyped.cmi : typing/typedtree.cmi
typing/printtyp.cmi : typing/types.cmi typing/path.cmi \
typing/outcometree.cmi parsing/longident.cmi typing/ident.cmi \
typing/env.cmi parsing/asttypes.cmi
-typing/printtyped.cmi : typing/typedtree.cmi
typing/stypes.cmi : typing/typedtree.cmi parsing/location.cmi \
typing/annot.cmi
typing/subst.cmi : typing/types.cmi typing/path.cmi typing/ident.cmi
@@ -145,11 +145,11 @@ typing/typedecl.cmi : typing/types.cmi typing/typedtree.cmi typing/path.cmi \
parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \
typing/includecore.cmi typing/ident.cmi typing/env.cmi \
parsing/asttypes.cmi
+typing/typedtreeIter.cmi : typing/typedtree.cmi parsing/asttypes.cmi
+typing/typedtreeMap.cmi : typing/typedtree.cmi
typing/typedtree.cmi : typing/types.cmi typing/primitive.cmi typing/path.cmi \
parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \
typing/ident.cmi typing/env.cmi parsing/asttypes.cmi
-typing/typedtreeIter.cmi : typing/typedtree.cmi parsing/asttypes.cmi
-typing/typedtreeMap.cmi : typing/typedtree.cmi
typing/typemod.cmi : typing/types.cmi typing/typedtree.cmi typing/path.cmi \
parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \
typing/includemod.cmi typing/ident.cmi typing/env.cmi \
@@ -192,6 +192,12 @@ typing/datarepr.cmo : typing/types.cmi typing/path.cmi parsing/location.cmi \
typing/datarepr.cmx : typing/types.cmx typing/path.cmx parsing/location.cmx \
typing/ident.cmx typing/btype.cmx parsing/asttypes.cmi \
typing/datarepr.cmi
+typing/envaux.cmo : typing/types.cmi typing/subst.cmi typing/printtyp.cmi \
+ typing/path.cmi utils/misc.cmi typing/ident.cmi typing/env.cmi \
+ parsing/asttypes.cmi typing/envaux.cmi
+typing/envaux.cmx : typing/types.cmx typing/subst.cmx typing/printtyp.cmx \
+ typing/path.cmx utils/misc.cmx typing/ident.cmx typing/env.cmx \
+ parsing/asttypes.cmi typing/envaux.cmi
typing/env.cmo : utils/warnings.cmi typing/types.cmi utils/tbl.cmi \
typing/subst.cmi typing/predef.cmi typing/path.cmi utils/misc.cmi \
parsing/longident.cmi parsing/location.cmi typing/ident.cmi \
@@ -204,12 +210,6 @@ typing/env.cmx : utils/warnings.cmx typing/types.cmx utils/tbl.cmx \
typing/datarepr.cmx utils/consistbl.cmx utils/config.cmx \
typing/cmi_format.cmx utils/clflags.cmx typing/btype.cmx \
parsing/asttypes.cmi typing/env.cmi
-typing/envaux.cmo : typing/types.cmi typing/subst.cmi typing/printtyp.cmi \
- typing/path.cmi utils/misc.cmi typing/ident.cmi typing/env.cmi \
- parsing/asttypes.cmi typing/envaux.cmi
-typing/envaux.cmx : typing/types.cmx typing/subst.cmx typing/printtyp.cmx \
- typing/path.cmx utils/misc.cmx typing/ident.cmx typing/env.cmx \
- parsing/asttypes.cmi typing/envaux.cmi
typing/ident.cmo : typing/ident.cmi
typing/ident.cmx : typing/ident.cmi
typing/includeclass.cmo : typing/types.cmi typing/printtyp.cmi \
@@ -268,6 +268,12 @@ typing/predef.cmx : typing/types.cmx typing/path.cmx parsing/location.cmx \
typing/ident.cmx typing/btype.cmx parsing/asttypes.cmi typing/predef.cmi
typing/primitive.cmo : utils/misc.cmi typing/primitive.cmi
typing/primitive.cmx : utils/misc.cmx typing/primitive.cmi
+typing/printtyped.cmo : typing/typedtree.cmi parsing/printast.cmi \
+ typing/path.cmi utils/misc.cmi parsing/longident.cmi parsing/location.cmi \
+ typing/ident.cmi parsing/asttypes.cmi typing/printtyped.cmi
+typing/printtyped.cmx : typing/typedtree.cmx parsing/printast.cmx \
+ typing/path.cmx utils/misc.cmx parsing/longident.cmx parsing/location.cmx \
+ typing/ident.cmx parsing/asttypes.cmi typing/printtyped.cmi
typing/printtyp.cmo : typing/types.cmi typing/primitive.cmi \
typing/predef.cmi typing/path.cmi parsing/parsetree.cmi \
typing/outcometree.cmi typing/oprint.cmi utils/misc.cmi \
@@ -280,12 +286,6 @@ typing/printtyp.cmx : typing/types.cmx typing/primitive.cmx \
parsing/longident.cmx parsing/location.cmx typing/ident.cmx \
typing/env.cmx typing/ctype.cmx utils/clflags.cmx typing/btype.cmx \
parsing/asttypes.cmi typing/printtyp.cmi
-typing/printtyped.cmo : typing/typedtree.cmi parsing/printast.cmi \
- typing/path.cmi utils/misc.cmi parsing/longident.cmi parsing/location.cmi \
- typing/ident.cmi parsing/asttypes.cmi typing/printtyped.cmi
-typing/printtyped.cmx : typing/typedtree.cmx parsing/printast.cmx \
- typing/path.cmx utils/misc.cmx parsing/longident.cmx parsing/location.cmx \
- typing/ident.cmx parsing/asttypes.cmi typing/printtyped.cmi
typing/stypes.cmo : typing/typedtree.cmi typing/printtyp.cmi \
parsing/location.cmi utils/clflags.cmi typing/annot.cmi typing/stypes.cmi
typing/stypes.cmx : typing/typedtree.cmx typing/printtyp.cmx \
@@ -352,14 +352,6 @@ typing/typedecl.cmx : utils/warnings.cmx typing/typetexp.cmx \
typing/ident.cmx typing/env.cmx typing/ctype.cmx utils/config.cmx \
utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmi \
parsing/ast_helper.cmx typing/typedecl.cmi
-typing/typedtree.cmo : typing/types.cmi typing/primitive.cmi typing/path.cmi \
- parsing/parsetree.cmi utils/misc.cmi parsing/longident.cmi \
- parsing/location.cmi typing/ident.cmi typing/env.cmi parsing/asttypes.cmi \
- typing/typedtree.cmi
-typing/typedtree.cmx : typing/types.cmx typing/primitive.cmx typing/path.cmx \
- parsing/parsetree.cmi utils/misc.cmx parsing/longident.cmx \
- parsing/location.cmx typing/ident.cmx typing/env.cmx parsing/asttypes.cmi \
- typing/typedtree.cmi
typing/typedtreeIter.cmo : typing/typedtree.cmi utils/misc.cmi \
parsing/asttypes.cmi typing/typedtreeIter.cmi
typing/typedtreeIter.cmx : typing/typedtree.cmx utils/misc.cmx \
@@ -368,6 +360,14 @@ typing/typedtreeMap.cmo : typing/typedtree.cmi utils/misc.cmi \
typing/typedtreeMap.cmi
typing/typedtreeMap.cmx : typing/typedtree.cmx utils/misc.cmx \
typing/typedtreeMap.cmi
+typing/typedtree.cmo : typing/types.cmi typing/primitive.cmi typing/path.cmi \
+ parsing/parsetree.cmi utils/misc.cmi parsing/longident.cmi \
+ parsing/location.cmi typing/ident.cmi typing/env.cmi parsing/asttypes.cmi \
+ typing/typedtree.cmi
+typing/typedtree.cmx : typing/types.cmx typing/primitive.cmx typing/path.cmx \
+ parsing/parsetree.cmi utils/misc.cmx parsing/longident.cmx \
+ parsing/location.cmx typing/ident.cmx typing/env.cmx parsing/asttypes.cmi \
+ typing/typedtree.cmi
typing/typemod.cmo : utils/warnings.cmi typing/typetexp.cmi typing/types.cmi \
typing/typedtree.cmi typing/typedecl.cmi typing/typecore.cmi \
typing/typeclass.cmi typing/subst.cmi typing/stypes.cmi \
@@ -612,7 +612,6 @@ bytecomp/typeopt.cmo : typing/types.cmi typing/typedtree.cmi \
bytecomp/typeopt.cmx : typing/types.cmx typing/typedtree.cmx \
typing/predef.cmx typing/path.cmx bytecomp/lambda.cmx typing/ident.cmx \
typing/env.cmx typing/ctype.cmx bytecomp/typeopt.cmi
-asmcomp/CSEgen.cmi : asmcomp/mach.cmi
asmcomp/asmgen.cmi : bytecomp/lambda.cmi asmcomp/cmm.cmi
asmcomp/asmlibrarian.cmi :
asmcomp/asmlink.cmi : asmcomp/cmx_format.cmi
@@ -622,19 +621,20 @@ asmcomp/branch_relaxation.cmi : asmcomp/linearize.cmi \
asmcomp/clambda.cmi : bytecomp/lambda.cmi typing/ident.cmi \
asmcomp/debuginfo.cmi parsing/asttypes.cmi
asmcomp/closure.cmi : bytecomp/lambda.cmi asmcomp/clambda.cmi
-asmcomp/cmm.cmi : bytecomp/lambda.cmi typing/ident.cmi asmcomp/debuginfo.cmi
asmcomp/cmmgen.cmi : asmcomp/cmx_format.cmi asmcomp/cmm.cmi \
asmcomp/clambda.cmi
+asmcomp/cmm.cmi : bytecomp/lambda.cmi typing/ident.cmi asmcomp/debuginfo.cmi
asmcomp/cmx_format.cmi : asmcomp/clambda.cmi
asmcomp/codegen.cmi : asmcomp/cmm.cmi
asmcomp/coloring.cmi :
asmcomp/comballoc.cmi : asmcomp/mach.cmi
asmcomp/compilenv.cmi : typing/ident.cmi asmcomp/cmx_format.cmi \
asmcomp/clambda.cmi
+asmcomp/CSEgen.cmi : asmcomp/mach.cmi
asmcomp/deadcode.cmi : asmcomp/mach.cmi
asmcomp/debuginfo.cmi : parsing/location.cmi bytecomp/lambda.cmi
-asmcomp/emit.cmi : asmcomp/linearize.cmi asmcomp/cmm.cmi
asmcomp/emitaux.cmi : asmcomp/debuginfo.cmi
+asmcomp/emit.cmi : asmcomp/linearize.cmi asmcomp/cmm.cmi
asmcomp/interf.cmi : asmcomp/mach.cmi
asmcomp/linearize.cmi : asmcomp/reg.cmi asmcomp/mach.cmi bytecomp/lambda.cmi \
asmcomp/debuginfo.cmi
@@ -647,8 +647,8 @@ asmcomp/printlinear.cmi : asmcomp/linearize.cmi
asmcomp/printmach.cmi : asmcomp/reg.cmi asmcomp/mach.cmi
asmcomp/proc.cmi : asmcomp/reg.cmi asmcomp/mach.cmi
asmcomp/reg.cmi : typing/ident.cmi asmcomp/cmm.cmi
-asmcomp/reload.cmi : asmcomp/mach.cmi
asmcomp/reloadgen.cmi : asmcomp/reg.cmi asmcomp/mach.cmi
+asmcomp/reload.cmi : asmcomp/mach.cmi
asmcomp/schedgen.cmi : asmcomp/mach.cmi asmcomp/linearize.cmi
asmcomp/scheduling.cmi : asmcomp/linearize.cmi
asmcomp/selectgen.cmi : utils/tbl.cmi asmcomp/reg.cmi asmcomp/mach.cmi \
@@ -662,14 +662,8 @@ asmcomp/x86_dsl.cmi : asmcomp/x86_ast.cmi
asmcomp/x86_gas.cmi : asmcomp/x86_ast.cmi
asmcomp/x86_masm.cmi : asmcomp/x86_ast.cmi
asmcomp/x86_proc.cmi : asmcomp/x86_ast.cmi
-asmcomp/CSE.cmo : asmcomp/mach.cmi asmcomp/CSEgen.cmi asmcomp/arch.cmo
-asmcomp/CSE.cmx : asmcomp/mach.cmx asmcomp/CSEgen.cmx asmcomp/arch.cmx
-asmcomp/CSEgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
- asmcomp/cmm.cmi asmcomp/CSEgen.cmi
-asmcomp/CSEgen.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \
- asmcomp/cmm.cmx asmcomp/CSEgen.cmi
-asmcomp/arch.cmo : utils/config.cmi
-asmcomp/arch.cmx : utils/config.cmx
+asmcomp/arch.cmo : utils/clflags.cmi
+asmcomp/arch.cmx : utils/clflags.cmx
asmcomp/asmgen.cmo : bytecomp/translmod.cmi asmcomp/split.cmi \
asmcomp/spill.cmi asmcomp/selection.cmi asmcomp/scheduling.cmi \
asmcomp/reload.cmi asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/printmach.cmi \
@@ -718,14 +712,14 @@ asmcomp/asmpackager.cmx : typing/typemod.cmx bytecomp/translmod.cmx \
utils/config.cmx asmcomp/compilenv.cmx asmcomp/cmx_format.cmi \
utils/clflags.cmx utils/ccomp.cmx asmcomp/asmlink.cmx asmcomp/asmgen.cmx \
asmcomp/asmpackager.cmi
+asmcomp/branch_relaxation_intf.cmo : asmcomp/linearize.cmi asmcomp/arch.cmo
+asmcomp/branch_relaxation_intf.cmx : asmcomp/linearize.cmx asmcomp/arch.cmx
asmcomp/branch_relaxation.cmo : utils/misc.cmi asmcomp/mach.cmi \
asmcomp/linearize.cmi asmcomp/cmm.cmi asmcomp/branch_relaxation_intf.cmo \
asmcomp/branch_relaxation.cmi
asmcomp/branch_relaxation.cmx : utils/misc.cmx asmcomp/mach.cmx \
asmcomp/linearize.cmx asmcomp/cmm.cmx asmcomp/branch_relaxation_intf.cmx \
asmcomp/branch_relaxation.cmi
-asmcomp/branch_relaxation_intf.cmo : asmcomp/linearize.cmi asmcomp/arch.cmo
-asmcomp/branch_relaxation_intf.cmx : asmcomp/linearize.cmx asmcomp/arch.cmx
asmcomp/clambda.cmo : bytecomp/lambda.cmi typing/ident.cmi \
asmcomp/debuginfo.cmi parsing/asttypes.cmi asmcomp/clambda.cmi
asmcomp/clambda.cmx : bytecomp/lambda.cmx typing/ident.cmx \
@@ -738,10 +732,6 @@ asmcomp/closure.cmx : utils/tbl.cmx bytecomp/switch.cmx typing/primitive.cmx \
utils/misc.cmx bytecomp/lambda.cmx typing/ident.cmx asmcomp/debuginfo.cmx \
asmcomp/compilenv.cmx utils/clflags.cmx asmcomp/clambda.cmx \
parsing/asttypes.cmi asmcomp/arch.cmx asmcomp/closure.cmi
-asmcomp/cmm.cmo : bytecomp/lambda.cmi typing/ident.cmi asmcomp/debuginfo.cmi \
- asmcomp/arch.cmo asmcomp/cmm.cmi
-asmcomp/cmm.cmx : bytecomp/lambda.cmx typing/ident.cmx asmcomp/debuginfo.cmx \
- asmcomp/arch.cmx asmcomp/cmm.cmi
asmcomp/cmmgen.cmo : typing/types.cmi bytecomp/switch.cmi \
asmcomp/strmatch.cmi asmcomp/proc.cmi typing/primitive.cmi utils/misc.cmi \
bytecomp/lambda.cmi typing/ident.cmi asmcomp/debuginfo.cmi \
@@ -754,6 +744,10 @@ asmcomp/cmmgen.cmx : typing/types.cmx bytecomp/switch.cmx \
utils/config.cmx asmcomp/compilenv.cmx asmcomp/cmx_format.cmi \
asmcomp/cmm.cmx utils/clflags.cmx asmcomp/clambda.cmx \
parsing/asttypes.cmi asmcomp/arch.cmx asmcomp/cmmgen.cmi
+asmcomp/cmm.cmo : bytecomp/lambda.cmi typing/ident.cmi asmcomp/debuginfo.cmi \
+ asmcomp/arch.cmo asmcomp/cmm.cmi
+asmcomp/cmm.cmx : bytecomp/lambda.cmx typing/ident.cmx asmcomp/debuginfo.cmx \
+ asmcomp/arch.cmx asmcomp/cmm.cmi
asmcomp/codegen.cmo : asmcomp/split.cmi asmcomp/spill.cmi asmcomp/reload.cmi \
asmcomp/reg.cmi asmcomp/printmach.cmi asmcomp/printlinear.cmi \
asmcomp/printcmm.cmi asmcomp/liveness.cmi asmcomp/linearize.cmi \
@@ -776,6 +770,12 @@ asmcomp/compilenv.cmo : utils/misc.cmi parsing/location.cmi typing/ident.cmi \
asmcomp/compilenv.cmx : utils/misc.cmx parsing/location.cmx typing/ident.cmx \
typing/env.cmx utils/config.cmx asmcomp/cmx_format.cmi \
asmcomp/clambda.cmx asmcomp/compilenv.cmi
+asmcomp/CSEgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
+ asmcomp/cmm.cmi asmcomp/CSEgen.cmi
+asmcomp/CSEgen.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \
+ asmcomp/cmm.cmx asmcomp/CSEgen.cmi
+asmcomp/CSE.cmo : asmcomp/mach.cmi asmcomp/CSEgen.cmi asmcomp/arch.cmo
+asmcomp/CSE.cmx : asmcomp/mach.cmx asmcomp/CSEgen.cmx asmcomp/arch.cmx
asmcomp/deadcode.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
asmcomp/deadcode.cmi
asmcomp/deadcode.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \
@@ -784,20 +784,24 @@ asmcomp/debuginfo.cmo : parsing/location.cmi bytecomp/lambda.cmi \
asmcomp/debuginfo.cmi
asmcomp/debuginfo.cmx : parsing/location.cmx bytecomp/lambda.cmx \
asmcomp/debuginfo.cmi
-asmcomp/emit.cmo : asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi \
- asmcomp/mach.cmi asmcomp/linearize.cmi bytecomp/lambda.cmi \
- asmcomp/emitaux.cmi asmcomp/debuginfo.cmi asmcomp/compilenv.cmi \
- asmcomp/cmm.cmi utils/clflags.cmi asmcomp/branch_relaxation.cmi \
- asmcomp/arch.cmo asmcomp/emit.cmi
-asmcomp/emit.cmx : asmcomp/reg.cmx asmcomp/proc.cmx utils/misc.cmx \
- asmcomp/mach.cmx asmcomp/linearize.cmx bytecomp/lambda.cmx \
- asmcomp/emitaux.cmx asmcomp/debuginfo.cmx asmcomp/compilenv.cmx \
- asmcomp/cmm.cmx utils/clflags.cmx asmcomp/branch_relaxation.cmx \
- asmcomp/arch.cmx asmcomp/emit.cmi
asmcomp/emitaux.cmo : asmcomp/linearize.cmi asmcomp/debuginfo.cmi \
utils/config.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/emitaux.cmi
asmcomp/emitaux.cmx : asmcomp/linearize.cmx asmcomp/debuginfo.cmx \
utils/config.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/emitaux.cmi
+asmcomp/emit.cmo : asmcomp/x86_proc.cmi asmcomp/x86_masm.cmi \
+ asmcomp/x86_gas.cmi asmcomp/x86_dsl.cmi asmcomp/x86_ast.cmi \
+ asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi asmcomp/mach.cmi \
+ asmcomp/linearize.cmi bytecomp/lambda.cmi asmcomp/emitaux.cmi \
+ asmcomp/debuginfo.cmi utils/config.cmi asmcomp/compilenv.cmi \
+ asmcomp/cmm.cmi utils/clflags.cmi asmcomp/branch_relaxation.cmi \
+ asmcomp/arch.cmo asmcomp/emit.cmi
+asmcomp/emit.cmx : asmcomp/x86_proc.cmx asmcomp/x86_masm.cmx \
+ asmcomp/x86_gas.cmx asmcomp/x86_dsl.cmx asmcomp/x86_ast.cmi \
+ asmcomp/reg.cmx asmcomp/proc.cmx utils/misc.cmx asmcomp/mach.cmx \
+ asmcomp/linearize.cmx bytecomp/lambda.cmx asmcomp/emitaux.cmx \
+ asmcomp/debuginfo.cmx utils/config.cmx asmcomp/compilenv.cmx \
+ asmcomp/cmm.cmx utils/clflags.cmx asmcomp/branch_relaxation.cmx \
+ asmcomp/arch.cmx asmcomp/emit.cmi
asmcomp/interf.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
asmcomp/interf.cmi
asmcomp/interf.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \
@@ -842,30 +846,30 @@ asmcomp/printmach.cmx : asmcomp/reg.cmx asmcomp/proc.cmx \
asmcomp/printcmm.cmx asmcomp/mach.cmx bytecomp/lambda.cmx \
asmcomp/debuginfo.cmx asmcomp/cmm.cmx asmcomp/arch.cmx \
asmcomp/printmach.cmi
-asmcomp/proc.cmo : asmcomp/reg.cmi utils/misc.cmi asmcomp/mach.cmi \
- utils/config.cmi asmcomp/cmm.cmi utils/ccomp.cmi asmcomp/arch.cmo \
+asmcomp/proc.cmo : asmcomp/x86_proc.cmi asmcomp/reg.cmi utils/misc.cmi \
+ asmcomp/mach.cmi utils/config.cmi asmcomp/cmm.cmi asmcomp/arch.cmo \
asmcomp/proc.cmi
-asmcomp/proc.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \
- utils/config.cmx asmcomp/cmm.cmx utils/ccomp.cmx asmcomp/arch.cmx \
+asmcomp/proc.cmx : asmcomp/x86_proc.cmx asmcomp/reg.cmx utils/misc.cmx \
+ asmcomp/mach.cmx utils/config.cmx asmcomp/cmm.cmx asmcomp/arch.cmx \
asmcomp/proc.cmi
asmcomp/reg.cmo : typing/ident.cmi asmcomp/cmm.cmi asmcomp/reg.cmi
asmcomp/reg.cmx : typing/ident.cmx asmcomp/cmm.cmx asmcomp/reg.cmi
-asmcomp/reload.cmo : asmcomp/reloadgen.cmi asmcomp/reload.cmi
-asmcomp/reload.cmx : asmcomp/reloadgen.cmx asmcomp/reload.cmi
asmcomp/reloadgen.cmo : asmcomp/reg.cmi utils/misc.cmi asmcomp/mach.cmi \
asmcomp/reloadgen.cmi
asmcomp/reloadgen.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \
asmcomp/reloadgen.cmi
+asmcomp/reload.cmo : asmcomp/reloadgen.cmi asmcomp/reg.cmi asmcomp/mach.cmi \
+ asmcomp/cmm.cmi utils/clflags.cmi asmcomp/reload.cmi
+asmcomp/reload.cmx : asmcomp/reloadgen.cmx asmcomp/reg.cmx asmcomp/mach.cmx \
+ asmcomp/cmm.cmx utils/clflags.cmx asmcomp/reload.cmi
asmcomp/schedgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
asmcomp/linearize.cmi asmcomp/cmm.cmi asmcomp/arch.cmo \
asmcomp/schedgen.cmi
asmcomp/schedgen.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \
asmcomp/linearize.cmx asmcomp/cmm.cmx asmcomp/arch.cmx \
asmcomp/schedgen.cmi
-asmcomp/scheduling.cmo : asmcomp/schedgen.cmi asmcomp/mach.cmi \
- asmcomp/arch.cmo asmcomp/scheduling.cmi
-asmcomp/scheduling.cmx : asmcomp/schedgen.cmx asmcomp/mach.cmx \
- asmcomp/arch.cmx asmcomp/scheduling.cmi
+asmcomp/scheduling.cmo : asmcomp/schedgen.cmi asmcomp/scheduling.cmi
+asmcomp/scheduling.cmx : asmcomp/schedgen.cmx asmcomp/scheduling.cmi
asmcomp/selectgen.cmo : utils/tbl.cmi bytecomp/simplif.cmi asmcomp/reg.cmi \
asmcomp/proc.cmi utils/misc.cmi asmcomp/mach.cmi bytecomp/lambda.cmi \
typing/ident.cmi asmcomp/debuginfo.cmi asmcomp/cmm.cmi utils/clflags.cmi \
@@ -874,10 +878,12 @@ asmcomp/selectgen.cmx : utils/tbl.cmx bytecomp/simplif.cmx asmcomp/reg.cmx \
asmcomp/proc.cmx utils/misc.cmx asmcomp/mach.cmx bytecomp/lambda.cmx \
typing/ident.cmx asmcomp/debuginfo.cmx asmcomp/cmm.cmx utils/clflags.cmx \
asmcomp/arch.cmx asmcomp/selectgen.cmi
-asmcomp/selection.cmo : asmcomp/selectgen.cmi asmcomp/mach.cmi \
- asmcomp/cmm.cmi asmcomp/arch.cmo asmcomp/selection.cmi
-asmcomp/selection.cmx : asmcomp/selectgen.cmx asmcomp/mach.cmx \
- asmcomp/cmm.cmx asmcomp/arch.cmx asmcomp/selection.cmi
+asmcomp/selection.cmo : asmcomp/selectgen.cmi asmcomp/proc.cmi \
+ asmcomp/mach.cmi asmcomp/cmm.cmi utils/clflags.cmi asmcomp/arch.cmo \
+ asmcomp/selection.cmi
+asmcomp/selection.cmx : asmcomp/selectgen.cmx asmcomp/proc.cmx \
+ asmcomp/mach.cmx asmcomp/cmm.cmx utils/clflags.cmx asmcomp/arch.cmx \
+ asmcomp/selection.cmi
asmcomp/spill.cmo : asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi \
asmcomp/mach.cmi asmcomp/spill.cmi
asmcomp/spill.cmx : asmcomp/reg.cmx asmcomp/proc.cmx utils/misc.cmx \
@@ -910,8 +916,8 @@ driver/compenv.cmi :
driver/compile.cmi :
driver/compmisc.cmi : typing/env.cmi
driver/errors.cmi :
-driver/main.cmi :
driver/main_args.cmi :
+driver/main.cmi :
driver/optcompile.cmi :
driver/opterrors.cmi :
driver/optmain.cmi :
@@ -946,6 +952,8 @@ driver/compmisc.cmx : typing/typemod.cmx utils/misc.cmx \
parsing/asttypes.cmi driver/compmisc.cmi
driver/errors.cmo : parsing/location.cmi driver/errors.cmi
driver/errors.cmx : parsing/location.cmx driver/errors.cmi
+driver/main_args.cmo : utils/warnings.cmi driver/main_args.cmi
+driver/main_args.cmx : utils/warnings.cmx driver/main_args.cmi
driver/main.cmo : utils/warnings.cmi utils/misc.cmi driver/main_args.cmi \
parsing/location.cmi utils/config.cmi driver/compmisc.cmi \
driver/compile.cmi driver/compenv.cmi utils/clflags.cmi \
@@ -956,8 +964,6 @@ driver/main.cmx : utils/warnings.cmx utils/misc.cmx driver/main_args.cmx \
driver/compile.cmx driver/compenv.cmx utils/clflags.cmx \
bytecomp/bytepackager.cmx bytecomp/bytelink.cmx \
bytecomp/bytelibrarian.cmx driver/main.cmi
-driver/main_args.cmo : utils/warnings.cmi driver/main_args.cmi
-driver/main_args.cmx : utils/warnings.cmx driver/main_args.cmi
driver/optcompile.cmo : utils/warnings.cmi typing/typemod.cmi \
typing/typedtree.cmi typing/typecore.cmi bytecomp/translmod.cmi \
typing/stypes.cmi bytecomp/simplif.cmi typing/printtyped.cmi \
diff --git a/Changes b/Changes
index c933a1201e..cd1c6bdf21 100644
--- a/Changes
+++ b/Changes
@@ -42,8 +42,12 @@ Compilers:
(Vladimir Brankov, review by Alain Frisch)
- GPR#115: More precise typing of values at the C-- and Mach level,.
(Xavier Leroy, review by Pierre Chambart)
+- GPR#207: Colors in compiler messages (warnings, errors)
+ (Simon Cruanes, review by Gabriel Scherer)
Runtime system:
+- PR#3612: allow allocating custom block with finalizers in the minor heap
+ (Pierre Chambart)
- PR#6517: use ISO C99 types {,u}int{32,64}_t in preference to our homegrown
types {,u}int{32,64}.
(Xavier Leroy)
@@ -108,6 +112,8 @@ OCamlbuild:
(ygrek)
Bug fixes:
+- PR#3612: memory leak in bigarray read from file
+ (Pierre Chambart, report by Gary Huber)
* PR#4539: change exception string raised when comparing functional values
(Nicolas Braud-Santoni, report by Eric Cooper)
- PR#4832: Filling bigarrays may block out runtime
@@ -156,6 +162,8 @@ Bug fixes:
and fix by Frederic Bour)
- GPR#220: minor -dsource error on recursive modules
(Hongbo Zhang)
+- GPR#228: fix a dangling internal pointer in (bytecode )debug_info
+ (Gabriel Scherer and Mark Shinwell and Xavier Leroy)
Features wishes:
- PR#4714: List.cons
@@ -203,8 +211,8 @@ Features wishes:
- GPR#165, GPR#221: fix windows compilation warnings
(Bernhard Schommer, Gabriel Scherer, report by Alain Frisch)
-OCaml 4.02.3:
--------------
+OCaml 4.02.3 (27 Jul 2015):
+---------------------------
Bug fixes:
- PR#6908: Top-level custom printing for GADTs: interface change in 4.02.2
@@ -223,7 +231,7 @@ Feature wishes:
(Hugo Heuzard)
OCaml 4.02.2 (17 Jun 2015):
--------------
+---------------------------
(Changes that can break existing programs are marked with a "*")
diff --git a/Makefile b/Makefile
index b87b2aab08..19b4a2accc 100644
--- a/Makefile
+++ b/Makefile
@@ -38,8 +38,9 @@ OCAMLDOC_OPT=$(WITH_OCAMLDOC:=.opt)
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver \
-I toplevel
-UTILS=utils/misc.cmo utils/tbl.cmo utils/config.cmo \
- utils/clflags.cmo utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo \
+UTILS=utils/config.cmo utils/clflags.cmo \
+ utils/misc.cmo utils/tbl.cmo \
+ utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo \
utils/consistbl.cmo
PARSING=parsing/location.cmo parsing/longident.cmo \
diff --git a/asmrun/.depend b/asmrun/.depend
index 3f858b644d..f08687a9d5 100644
--- a/asmrun/.depend
+++ b/asmrun/.depend
@@ -282,6 +282,14 @@ roots.o: roots.c ../byterun/caml/finalise.h ../byterun/caml/roots.h \
../byterun/caml/major_gc.h ../byterun/caml/minor_gc.h \
../byterun/caml/misc.h ../byterun/caml/mlvalues.h stack.h \
../byterun/caml/roots.h
+signals_asm.o: signals_asm.c ../byterun/caml/fail.h \
+ ../byterun/caml/misc.h ../byterun/caml/config.h \
+ ../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
+ ../byterun/caml/mlvalues.h ../byterun/caml/memory.h ../byterun/caml/gc.h \
+ ../byterun/caml/major_gc.h ../byterun/caml/freelist.h \
+ ../byterun/caml/minor_gc.h ../byterun/caml/address_class.h \
+ ../byterun/caml/osdeps.h ../byterun/caml/signals.h \
+ ../byterun/caml/signals_machdep.h signals_osdep.h stack.h
signals.o: signals.c ../byterun/caml/alloc.h ../byterun/caml/misc.h \
../byterun/caml/config.h ../byterun/caml/../../config/m.h \
../byterun/caml/../../config/s.h ../byterun/caml/mlvalues.h \
@@ -293,14 +301,13 @@ signals.o: signals.c ../byterun/caml/alloc.h ../byterun/caml/misc.h \
../byterun/caml/roots.h ../byterun/caml/memory.h \
../byterun/caml/signals.h ../byterun/caml/signals_machdep.h \
../byterun/caml/sys.h
-signals_asm.o: signals_asm.c ../byterun/caml/fail.h \
- ../byterun/caml/misc.h ../byterun/caml/config.h \
+startup_aux.o: startup_aux.c ../byterun/caml/backtrace.h \
+ ../byterun/caml/mlvalues.h ../byterun/caml/config.h \
../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
- ../byterun/caml/mlvalues.h ../byterun/caml/memory.h ../byterun/caml/gc.h \
- ../byterun/caml/major_gc.h ../byterun/caml/freelist.h \
- ../byterun/caml/minor_gc.h ../byterun/caml/address_class.h \
- ../byterun/caml/osdeps.h ../byterun/caml/signals.h \
- ../byterun/caml/signals_machdep.h signals_osdep.h stack.h
+ ../byterun/caml/misc.h ../byterun/caml/exec.h ../byterun/caml/memory.h \
+ ../byterun/caml/gc.h ../byterun/caml/major_gc.h \
+ ../byterun/caml/freelist.h ../byterun/caml/minor_gc.h \
+ ../byterun/caml/address_class.h ../byterun/caml/startup_aux.h
startup.o: startup.c ../byterun/caml/callback.h \
../byterun/caml/mlvalues.h ../byterun/caml/config.h \
../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
@@ -315,13 +322,6 @@ startup.o: startup.c ../byterun/caml/callback.h \
../byterun/caml/mlvalues.h ../byterun/caml/osdeps.h \
../byterun/caml/printexc.h stack.h ../byterun/caml/startup_aux.h \
../byterun/caml/sys.h
-startup_aux.o: startup_aux.c ../byterun/caml/backtrace.h \
- ../byterun/caml/mlvalues.h ../byterun/caml/config.h \
- ../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
- ../byterun/caml/misc.h ../byterun/caml/exec.h ../byterun/caml/memory.h \
- ../byterun/caml/gc.h ../byterun/caml/major_gc.h \
- ../byterun/caml/freelist.h ../byterun/caml/minor_gc.h \
- ../byterun/caml/address_class.h ../byterun/caml/startup_aux.h
str.o: str.c ../byterun/caml/alloc.h ../byterun/caml/misc.h \
../byterun/caml/config.h ../byterun/caml/../../config/m.h \
../byterun/caml/../../config/s.h ../byterun/caml/mlvalues.h \
@@ -336,7 +336,7 @@ sys.o: sys.c ../byterun/caml/config.h ../byterun/caml/../../config/m.h \
../byterun/caml/memory.h ../byterun/caml/gc.h ../byterun/caml/major_gc.h \
../byterun/caml/freelist.h ../byterun/caml/minor_gc.h \
../byterun/caml/address_class.h ../byterun/caml/sys.h \
- ../byterun/caml/gc_ctrl.h
+ ../byterun/caml/gc_ctrl.h ../byterun/caml/io.h
terminfo.o: terminfo.c ../byterun/caml/config.h \
../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
../byterun/caml/alloc.h ../byterun/caml/misc.h ../byterun/caml/config.h \
@@ -640,6 +640,14 @@ roots.d.o: roots.c ../byterun/caml/finalise.h ../byterun/caml/roots.h \
../byterun/caml/major_gc.h ../byterun/caml/minor_gc.h \
../byterun/caml/misc.h ../byterun/caml/mlvalues.h stack.h \
../byterun/caml/roots.h
+signals_asm.d.o: signals_asm.c ../byterun/caml/fail.h \
+ ../byterun/caml/misc.h ../byterun/caml/config.h \
+ ../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
+ ../byterun/caml/mlvalues.h ../byterun/caml/memory.h ../byterun/caml/gc.h \
+ ../byterun/caml/major_gc.h ../byterun/caml/freelist.h \
+ ../byterun/caml/minor_gc.h ../byterun/caml/address_class.h \
+ ../byterun/caml/osdeps.h ../byterun/caml/signals.h \
+ ../byterun/caml/signals_machdep.h signals_osdep.h stack.h
signals.d.o: signals.c ../byterun/caml/alloc.h ../byterun/caml/misc.h \
../byterun/caml/config.h ../byterun/caml/../../config/m.h \
../byterun/caml/../../config/s.h ../byterun/caml/mlvalues.h \
@@ -651,14 +659,13 @@ signals.d.o: signals.c ../byterun/caml/alloc.h ../byterun/caml/misc.h \
../byterun/caml/roots.h ../byterun/caml/memory.h \
../byterun/caml/signals.h ../byterun/caml/signals_machdep.h \
../byterun/caml/sys.h
-signals_asm.d.o: signals_asm.c ../byterun/caml/fail.h \
- ../byterun/caml/misc.h ../byterun/caml/config.h \
+startup_aux.d.o: startup_aux.c ../byterun/caml/backtrace.h \
+ ../byterun/caml/mlvalues.h ../byterun/caml/config.h \
../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
- ../byterun/caml/mlvalues.h ../byterun/caml/memory.h ../byterun/caml/gc.h \
- ../byterun/caml/major_gc.h ../byterun/caml/freelist.h \
- ../byterun/caml/minor_gc.h ../byterun/caml/address_class.h \
- ../byterun/caml/osdeps.h ../byterun/caml/signals.h \
- ../byterun/caml/signals_machdep.h signals_osdep.h stack.h
+ ../byterun/caml/misc.h ../byterun/caml/exec.h ../byterun/caml/memory.h \
+ ../byterun/caml/gc.h ../byterun/caml/major_gc.h \
+ ../byterun/caml/freelist.h ../byterun/caml/minor_gc.h \
+ ../byterun/caml/address_class.h ../byterun/caml/startup_aux.h
startup.d.o: startup.c ../byterun/caml/callback.h \
../byterun/caml/mlvalues.h ../byterun/caml/config.h \
../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
@@ -673,13 +680,6 @@ startup.d.o: startup.c ../byterun/caml/callback.h \
../byterun/caml/mlvalues.h ../byterun/caml/osdeps.h \
../byterun/caml/printexc.h stack.h ../byterun/caml/startup_aux.h \
../byterun/caml/sys.h
-startup_aux.d.o: startup_aux.c ../byterun/caml/backtrace.h \
- ../byterun/caml/mlvalues.h ../byterun/caml/config.h \
- ../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
- ../byterun/caml/misc.h ../byterun/caml/exec.h ../byterun/caml/memory.h \
- ../byterun/caml/gc.h ../byterun/caml/major_gc.h \
- ../byterun/caml/freelist.h ../byterun/caml/minor_gc.h \
- ../byterun/caml/address_class.h ../byterun/caml/startup_aux.h
str.d.o: str.c ../byterun/caml/alloc.h ../byterun/caml/misc.h \
../byterun/caml/config.h ../byterun/caml/../../config/m.h \
../byterun/caml/../../config/s.h ../byterun/caml/mlvalues.h \
@@ -694,7 +694,7 @@ sys.d.o: sys.c ../byterun/caml/config.h ../byterun/caml/../../config/m.h \
../byterun/caml/memory.h ../byterun/caml/gc.h ../byterun/caml/major_gc.h \
../byterun/caml/freelist.h ../byterun/caml/minor_gc.h \
../byterun/caml/address_class.h ../byterun/caml/sys.h \
- ../byterun/caml/gc_ctrl.h
+ ../byterun/caml/gc_ctrl.h ../byterun/caml/io.h
terminfo.d.o: terminfo.c ../byterun/caml/config.h \
../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
../byterun/caml/alloc.h ../byterun/caml/misc.h ../byterun/caml/config.h \
@@ -998,6 +998,14 @@ roots.p.o: roots.c ../byterun/caml/finalise.h ../byterun/caml/roots.h \
../byterun/caml/major_gc.h ../byterun/caml/minor_gc.h \
../byterun/caml/misc.h ../byterun/caml/mlvalues.h stack.h \
../byterun/caml/roots.h
+signals_asm.p.o: signals_asm.c ../byterun/caml/fail.h \
+ ../byterun/caml/misc.h ../byterun/caml/config.h \
+ ../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
+ ../byterun/caml/mlvalues.h ../byterun/caml/memory.h ../byterun/caml/gc.h \
+ ../byterun/caml/major_gc.h ../byterun/caml/freelist.h \
+ ../byterun/caml/minor_gc.h ../byterun/caml/address_class.h \
+ ../byterun/caml/osdeps.h ../byterun/caml/signals.h \
+ ../byterun/caml/signals_machdep.h signals_osdep.h stack.h
signals.p.o: signals.c ../byterun/caml/alloc.h ../byterun/caml/misc.h \
../byterun/caml/config.h ../byterun/caml/../../config/m.h \
../byterun/caml/../../config/s.h ../byterun/caml/mlvalues.h \
@@ -1009,14 +1017,13 @@ signals.p.o: signals.c ../byterun/caml/alloc.h ../byterun/caml/misc.h \
../byterun/caml/roots.h ../byterun/caml/memory.h \
../byterun/caml/signals.h ../byterun/caml/signals_machdep.h \
../byterun/caml/sys.h
-signals_asm.p.o: signals_asm.c ../byterun/caml/fail.h \
- ../byterun/caml/misc.h ../byterun/caml/config.h \
+startup_aux.p.o: startup_aux.c ../byterun/caml/backtrace.h \
+ ../byterun/caml/mlvalues.h ../byterun/caml/config.h \
../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
- ../byterun/caml/mlvalues.h ../byterun/caml/memory.h ../byterun/caml/gc.h \
- ../byterun/caml/major_gc.h ../byterun/caml/freelist.h \
- ../byterun/caml/minor_gc.h ../byterun/caml/address_class.h \
- ../byterun/caml/osdeps.h ../byterun/caml/signals.h \
- ../byterun/caml/signals_machdep.h signals_osdep.h stack.h
+ ../byterun/caml/misc.h ../byterun/caml/exec.h ../byterun/caml/memory.h \
+ ../byterun/caml/gc.h ../byterun/caml/major_gc.h \
+ ../byterun/caml/freelist.h ../byterun/caml/minor_gc.h \
+ ../byterun/caml/address_class.h ../byterun/caml/startup_aux.h
startup.p.o: startup.c ../byterun/caml/callback.h \
../byterun/caml/mlvalues.h ../byterun/caml/config.h \
../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
@@ -1031,13 +1038,6 @@ startup.p.o: startup.c ../byterun/caml/callback.h \
../byterun/caml/mlvalues.h ../byterun/caml/osdeps.h \
../byterun/caml/printexc.h stack.h ../byterun/caml/startup_aux.h \
../byterun/caml/sys.h
-startup_aux.p.o: startup_aux.c ../byterun/caml/backtrace.h \
- ../byterun/caml/mlvalues.h ../byterun/caml/config.h \
- ../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
- ../byterun/caml/misc.h ../byterun/caml/exec.h ../byterun/caml/memory.h \
- ../byterun/caml/gc.h ../byterun/caml/major_gc.h \
- ../byterun/caml/freelist.h ../byterun/caml/minor_gc.h \
- ../byterun/caml/address_class.h ../byterun/caml/startup_aux.h
str.p.o: str.c ../byterun/caml/alloc.h ../byterun/caml/misc.h \
../byterun/caml/config.h ../byterun/caml/../../config/m.h \
../byterun/caml/../../config/s.h ../byterun/caml/mlvalues.h \
@@ -1052,7 +1052,7 @@ sys.p.o: sys.c ../byterun/caml/config.h ../byterun/caml/../../config/m.h \
../byterun/caml/memory.h ../byterun/caml/gc.h ../byterun/caml/major_gc.h \
../byterun/caml/freelist.h ../byterun/caml/minor_gc.h \
../byterun/caml/address_class.h ../byterun/caml/sys.h \
- ../byterun/caml/gc_ctrl.h
+ ../byterun/caml/gc_ctrl.h ../byterun/caml/io.h
terminfo.p.o: terminfo.c ../byterun/caml/config.h \
../byterun/caml/../../config/m.h ../byterun/caml/../../config/s.h \
../byterun/caml/alloc.h ../byterun/caml/misc.h ../byterun/caml/config.h \
diff --git a/boot/ocamlc b/boot/ocamlc
index 5775fc43f7..f56d5c8bf8 100755
--- a/boot/ocamlc
+++ b/boot/ocamlc
Binary files differ
diff --git a/boot/ocamldep b/boot/ocamldep
index 98083c596f..a69e2e49ec 100755
--- a/boot/ocamldep
+++ b/boot/ocamldep
Binary files differ
diff --git a/boot/ocamllex b/boot/ocamllex
index 043c76967f..ae152f7d30 100755
--- a/boot/ocamllex
+++ b/boot/ocamllex
Binary files differ
diff --git a/byterun/.depend b/byterun/.depend
index e81e118dc0..8ffd2448c8 100644
--- a/byterun/.depend
+++ b/byterun/.depend
@@ -188,22 +188,27 @@ roots.o: roots.c caml/finalise.h caml/roots.h caml/misc.h \
caml/major_gc.h caml/freelist.h caml/minor_gc.h caml/address_class.h \
caml/globroots.h caml/major_gc.h caml/memory.h caml/minor_gc.h \
caml/misc.h caml/mlvalues.h caml/roots.h caml/stacks.h
+signals_byt.o: signals_byt.c caml/config.h caml/../../config/m.h \
+ caml/../../config/s.h caml/compatibility.h caml/memory.h caml/config.h \
+ caml/gc.h caml/mlvalues.h caml/misc.h caml/major_gc.h caml/freelist.h \
+ caml/minor_gc.h caml/address_class.h caml/osdeps.h caml/signals.h \
+ caml/signals_machdep.h
signals.o: signals.c caml/alloc.h caml/compatibility.h caml/misc.h \
caml/config.h caml/../../config/m.h caml/../../config/s.h \
caml/mlvalues.h caml/callback.h caml/config.h caml/fail.h caml/memory.h \
caml/gc.h caml/major_gc.h caml/freelist.h caml/minor_gc.h \
caml/address_class.h caml/misc.h caml/mlvalues.h caml/roots.h \
caml/memory.h caml/signals.h caml/signals_machdep.h caml/sys.h
-signals_byt.o: signals_byt.c caml/config.h caml/../../config/m.h \
- caml/../../config/s.h caml/compatibility.h caml/memory.h caml/config.h \
- caml/gc.h caml/mlvalues.h caml/misc.h caml/major_gc.h caml/freelist.h \
- caml/minor_gc.h caml/address_class.h caml/osdeps.h caml/signals.h \
- caml/signals_machdep.h
stacks.o: stacks.c caml/config.h caml/../../config/m.h \
caml/../../config/s.h caml/compatibility.h caml/fail.h caml/misc.h \
caml/config.h caml/mlvalues.h caml/misc.h caml/mlvalues.h caml/stacks.h \
caml/memory.h caml/gc.h caml/major_gc.h caml/freelist.h caml/minor_gc.h \
caml/address_class.h
+startup_aux.o: startup_aux.c caml/backtrace.h caml/mlvalues.h \
+ caml/compatibility.h caml/config.h caml/../../config/m.h \
+ caml/../../config/s.h caml/misc.h caml/exec.h caml/memory.h caml/gc.h \
+ caml/major_gc.h caml/freelist.h caml/minor_gc.h caml/address_class.h \
+ caml/startup_aux.h
startup.o: startup.c caml/config.h caml/../../config/m.h \
caml/../../config/s.h caml/compatibility.h caml/alloc.h caml/misc.h \
caml/config.h caml/mlvalues.h caml/backtrace.h caml/exec.h \
@@ -215,11 +220,6 @@ startup.o: startup.c caml/config.h caml/../../config/m.h \
caml/osdeps.h caml/prims.h caml/printexc.h caml/reverse.h caml/signals.h \
caml/stacks.h caml/memory.h caml/sys.h caml/startup.h caml/startup_aux.h \
caml/version.h
-startup_aux.o: startup_aux.c caml/backtrace.h caml/mlvalues.h \
- caml/compatibility.h caml/config.h caml/../../config/m.h \
- caml/../../config/s.h caml/misc.h caml/exec.h caml/memory.h caml/gc.h \
- caml/major_gc.h caml/freelist.h caml/minor_gc.h caml/address_class.h \
- caml/startup_aux.h
str.o: str.c caml/alloc.h caml/compatibility.h caml/misc.h caml/config.h \
caml/../../config/m.h caml/../../config/s.h caml/mlvalues.h caml/fail.h \
caml/mlvalues.h caml/misc.h
@@ -228,7 +228,7 @@ sys.o: sys.c caml/config.h caml/../../config/m.h caml/../../config/s.h \
caml/mlvalues.h caml/debugger.h caml/fail.h caml/instruct.h \
caml/mlvalues.h caml/osdeps.h caml/signals.h caml/stacks.h caml/memory.h \
caml/gc.h caml/major_gc.h caml/freelist.h caml/minor_gc.h \
- caml/address_class.h caml/sys.h caml/gc_ctrl.h
+ caml/address_class.h caml/sys.h caml/gc_ctrl.h caml/io.h
terminfo.o: terminfo.c caml/config.h caml/../../config/m.h \
caml/../../config/s.h caml/compatibility.h caml/alloc.h caml/misc.h \
caml/config.h caml/mlvalues.h caml/fail.h caml/io.h caml/mlvalues.h
@@ -440,22 +440,27 @@ roots.d.o: roots.c caml/finalise.h caml/roots.h caml/misc.h \
caml/major_gc.h caml/freelist.h caml/minor_gc.h caml/address_class.h \
caml/globroots.h caml/major_gc.h caml/memory.h caml/minor_gc.h \
caml/misc.h caml/mlvalues.h caml/roots.h caml/stacks.h
+signals_byt.d.o: signals_byt.c caml/config.h caml/../../config/m.h \
+ caml/../../config/s.h caml/compatibility.h caml/memory.h caml/config.h \
+ caml/gc.h caml/mlvalues.h caml/misc.h caml/major_gc.h caml/freelist.h \
+ caml/minor_gc.h caml/address_class.h caml/osdeps.h caml/signals.h \
+ caml/signals_machdep.h
signals.d.o: signals.c caml/alloc.h caml/compatibility.h caml/misc.h \
caml/config.h caml/../../config/m.h caml/../../config/s.h \
caml/mlvalues.h caml/callback.h caml/config.h caml/fail.h caml/memory.h \
caml/gc.h caml/major_gc.h caml/freelist.h caml/minor_gc.h \
caml/address_class.h caml/misc.h caml/mlvalues.h caml/roots.h \
caml/memory.h caml/signals.h caml/signals_machdep.h caml/sys.h
-signals_byt.d.o: signals_byt.c caml/config.h caml/../../config/m.h \
- caml/../../config/s.h caml/compatibility.h caml/memory.h caml/config.h \
- caml/gc.h caml/mlvalues.h caml/misc.h caml/major_gc.h caml/freelist.h \
- caml/minor_gc.h caml/address_class.h caml/osdeps.h caml/signals.h \
- caml/signals_machdep.h
stacks.d.o: stacks.c caml/config.h caml/../../config/m.h \
caml/../../config/s.h caml/compatibility.h caml/fail.h caml/misc.h \
caml/config.h caml/mlvalues.h caml/misc.h caml/mlvalues.h caml/stacks.h \
caml/memory.h caml/gc.h caml/major_gc.h caml/freelist.h caml/minor_gc.h \
caml/address_class.h
+startup_aux.d.o: startup_aux.c caml/backtrace.h caml/mlvalues.h \
+ caml/compatibility.h caml/config.h caml/../../config/m.h \
+ caml/../../config/s.h caml/misc.h caml/exec.h caml/memory.h caml/gc.h \
+ caml/major_gc.h caml/freelist.h caml/minor_gc.h caml/address_class.h \
+ caml/startup_aux.h
startup.d.o: startup.c caml/config.h caml/../../config/m.h \
caml/../../config/s.h caml/compatibility.h caml/alloc.h caml/misc.h \
caml/config.h caml/mlvalues.h caml/backtrace.h caml/exec.h \
@@ -467,11 +472,6 @@ startup.d.o: startup.c caml/config.h caml/../../config/m.h \
caml/osdeps.h caml/prims.h caml/printexc.h caml/reverse.h caml/signals.h \
caml/stacks.h caml/memory.h caml/sys.h caml/startup.h caml/startup_aux.h \
caml/version.h
-startup_aux.d.o: startup_aux.c caml/backtrace.h caml/mlvalues.h \
- caml/compatibility.h caml/config.h caml/../../config/m.h \
- caml/../../config/s.h caml/misc.h caml/exec.h caml/memory.h caml/gc.h \
- caml/major_gc.h caml/freelist.h caml/minor_gc.h caml/address_class.h \
- caml/startup_aux.h
str.d.o: str.c caml/alloc.h caml/compatibility.h caml/misc.h caml/config.h \
caml/../../config/m.h caml/../../config/s.h caml/mlvalues.h caml/fail.h \
caml/mlvalues.h caml/misc.h
@@ -480,7 +480,7 @@ sys.d.o: sys.c caml/config.h caml/../../config/m.h caml/../../config/s.h \
caml/mlvalues.h caml/debugger.h caml/fail.h caml/instruct.h \
caml/mlvalues.h caml/osdeps.h caml/signals.h caml/stacks.h caml/memory.h \
caml/gc.h caml/major_gc.h caml/freelist.h caml/minor_gc.h \
- caml/address_class.h caml/sys.h caml/gc_ctrl.h
+ caml/address_class.h caml/sys.h caml/gc_ctrl.h caml/io.h
terminfo.d.o: terminfo.c caml/config.h caml/../../config/m.h \
caml/../../config/s.h caml/compatibility.h caml/alloc.h caml/misc.h \
caml/config.h caml/mlvalues.h caml/fail.h caml/io.h caml/mlvalues.h
@@ -688,22 +688,27 @@ roots.pic.o: roots.c caml/finalise.h caml/roots.h caml/misc.h \
caml/major_gc.h caml/freelist.h caml/minor_gc.h caml/address_class.h \
caml/globroots.h caml/major_gc.h caml/memory.h caml/minor_gc.h \
caml/misc.h caml/mlvalues.h caml/roots.h caml/stacks.h
+signals_byt.pic.o: signals_byt.c caml/config.h caml/../../config/m.h \
+ caml/../../config/s.h caml/compatibility.h caml/memory.h caml/config.h \
+ caml/gc.h caml/mlvalues.h caml/misc.h caml/major_gc.h caml/freelist.h \
+ caml/minor_gc.h caml/address_class.h caml/osdeps.h caml/signals.h \
+ caml/signals_machdep.h
signals.pic.o: signals.c caml/alloc.h caml/compatibility.h caml/misc.h \
caml/config.h caml/../../config/m.h caml/../../config/s.h \
caml/mlvalues.h caml/callback.h caml/config.h caml/fail.h caml/memory.h \
caml/gc.h caml/major_gc.h caml/freelist.h caml/minor_gc.h \
caml/address_class.h caml/misc.h caml/mlvalues.h caml/roots.h \
caml/memory.h caml/signals.h caml/signals_machdep.h caml/sys.h
-signals_byt.pic.o: signals_byt.c caml/config.h caml/../../config/m.h \
- caml/../../config/s.h caml/compatibility.h caml/memory.h caml/config.h \
- caml/gc.h caml/mlvalues.h caml/misc.h caml/major_gc.h caml/freelist.h \
- caml/minor_gc.h caml/address_class.h caml/osdeps.h caml/signals.h \
- caml/signals_machdep.h
stacks.pic.o: stacks.c caml/config.h caml/../../config/m.h \
caml/../../config/s.h caml/compatibility.h caml/fail.h caml/misc.h \
caml/config.h caml/mlvalues.h caml/misc.h caml/mlvalues.h caml/stacks.h \
caml/memory.h caml/gc.h caml/major_gc.h caml/freelist.h caml/minor_gc.h \
caml/address_class.h
+startup_aux.pic.o: startup_aux.c caml/backtrace.h caml/mlvalues.h \
+ caml/compatibility.h caml/config.h caml/../../config/m.h \
+ caml/../../config/s.h caml/misc.h caml/exec.h caml/memory.h caml/gc.h \
+ caml/major_gc.h caml/freelist.h caml/minor_gc.h caml/address_class.h \
+ caml/startup_aux.h
startup.pic.o: startup.c caml/config.h caml/../../config/m.h \
caml/../../config/s.h caml/compatibility.h caml/alloc.h caml/misc.h \
caml/config.h caml/mlvalues.h caml/backtrace.h caml/exec.h \
@@ -715,11 +720,6 @@ startup.pic.o: startup.c caml/config.h caml/../../config/m.h \
caml/osdeps.h caml/prims.h caml/printexc.h caml/reverse.h caml/signals.h \
caml/stacks.h caml/memory.h caml/sys.h caml/startup.h caml/startup_aux.h \
caml/version.h
-startup_aux.pic.o: startup_aux.c caml/backtrace.h caml/mlvalues.h \
- caml/compatibility.h caml/config.h caml/../../config/m.h \
- caml/../../config/s.h caml/misc.h caml/exec.h caml/memory.h caml/gc.h \
- caml/major_gc.h caml/freelist.h caml/minor_gc.h caml/address_class.h \
- caml/startup_aux.h
str.pic.o: str.c caml/alloc.h caml/compatibility.h caml/misc.h caml/config.h \
caml/../../config/m.h caml/../../config/s.h caml/mlvalues.h caml/fail.h \
caml/mlvalues.h caml/misc.h
@@ -728,7 +728,7 @@ sys.pic.o: sys.c caml/config.h caml/../../config/m.h caml/../../config/s.h \
caml/mlvalues.h caml/debugger.h caml/fail.h caml/instruct.h \
caml/mlvalues.h caml/osdeps.h caml/signals.h caml/stacks.h caml/memory.h \
caml/gc.h caml/major_gc.h caml/freelist.h caml/minor_gc.h \
- caml/address_class.h caml/sys.h caml/gc_ctrl.h
+ caml/address_class.h caml/sys.h caml/gc_ctrl.h caml/io.h
terminfo.pic.o: terminfo.c caml/config.h caml/../../config/m.h \
caml/../../config/s.h caml/compatibility.h caml/alloc.h caml/misc.h \
caml/config.h caml/mlvalues.h caml/fail.h caml/io.h caml/mlvalues.h
diff --git a/byterun/backtrace.c b/byterun/backtrace.c
index 14f45f5bf8..c76cf5d2d0 100644
--- a/byterun/backtrace.c
+++ b/byterun/backtrace.c
@@ -38,11 +38,13 @@
#include "caml/backtrace.h"
#include "caml/fail.h"
+/* The table of debug information fragments */
+struct ext_table caml_debug_info;
+
CAMLexport int caml_backtrace_active = 0;
CAMLexport int caml_backtrace_pos = 0;
CAMLexport code_t * caml_backtrace_buffer = NULL;
CAMLexport value caml_backtrace_last_exn = Val_unit;
-CAMLexport value caml_debug_info = Val_emptylist;
CAMLexport char * caml_cds_file = NULL;
#define BACKTRACE_BUFFER_SIZE 1024
@@ -82,37 +84,13 @@ struct debug_info {
struct ev_info *events;
int already_read;
};
-
-#define Debug_info_val(v) ((struct debug_info *) Data_custom_val(v))
-
-static void caml_finalize_debug_info(value di) {
- free(Debug_info_val(di)->events);
- Debug_info_val(di)->events = NULL;
-}
-
-static struct custom_operations caml_debug_info_ops = {
- "_debug",
- caml_finalize_debug_info,
- custom_compare_default,
- custom_hash_default,
- custom_serialize_default,
- custom_deserialize_default,
- custom_compare_ext_default
-};
-
-static value caml_alloc_debug_info() {
- return caml_alloc_custom(&caml_debug_info_ops, sizeof (struct debug_info), 0, 1);
-}
-
static struct debug_info *find_debug_info(code_t pc) {
- value dis = caml_debug_info;
- while (dis != Val_emptylist) {
- struct debug_info *di = Debug_info_val(Field(dis, 0));
+ int i;
+ for (i = 0; i < caml_debug_info.size; i++) {
+ struct debug_info *di = caml_debug_info.contents[i];
if (pc >= di->start && pc < di->end)
return di;
- dis = Field(dis, 1);
}
-
return NULL;
}
@@ -186,29 +164,24 @@ struct ev_info *process_debug_events(code_t code_start, value events_heap, mlsiz
CAMLprim value caml_add_debug_info(code_t code_start, value code_size, value events_heap)
{
CAMLparam1(events_heap);
- CAMLlocal1(debug_info);
+ struct debug_info *debug_info;
/* build the OCaml-side debug_info value */
- debug_info = caml_alloc_debug_info();
- Debug_info_val(debug_info)->start = code_start;
- Debug_info_val(debug_info)->end = (code_t)((char*) code_start + Long_val(code_size));
+ debug_info = caml_stat_alloc(sizeof(struct debug_info));
+
+ debug_info->start = code_start;
+ debug_info->end = (code_t)((char*) code_start + Long_val(code_size));
if (events_heap == Val_unit) {
- Debug_info_val(debug_info)->events = NULL;
- Debug_info_val(debug_info)->num_events = 0;
- Debug_info_val(debug_info)->already_read = 0;
+ debug_info->events = NULL;
+ debug_info->num_events = 0;
+ debug_info->already_read = 0;
} else {
- Debug_info_val(debug_info)->events =
- process_debug_events(code_start, events_heap, &Debug_info_val(debug_info)->num_events);
- Debug_info_val(debug_info)->already_read = 1;
+ debug_info->events =
+ process_debug_events(code_start, events_heap, &debug_info->num_events);
+ debug_info->already_read = 1;
}
- /* prepend it to the global caml_debug_info root (an OCaml list) */
- {
- value cons = caml_alloc(2, 0);
- Store_field(cons, 0, debug_info);
- Store_field(cons, 1, caml_debug_info);
- caml_debug_info = cons;
- }
+ caml_ext_table_add(&caml_debug_info, debug_info);
CAMLreturn(Val_unit);
}
@@ -218,19 +191,16 @@ CAMLprim value caml_remove_debug_info(code_t start)
CAMLparam0();
CAMLlocal2(dis, prev);
- dis = caml_debug_info;
- while (dis != Val_emptylist) {
- struct debug_info *di = Debug_info_val(Field(dis, 0));
+ int i;
+ for (i = 0; i < caml_debug_info.size; i++) {
+ struct debug_info *di = caml_debug_info.contents[i];
if (di->start == start) {
- if (prev != Val_unit) {
- Store_field(prev, 1, Field(dis, 1));
- } else {
- caml_debug_info = Field(dis, 1);
- }
+ /* note that caml_ext_table_remove calls caml_stat_free on the
+ removed resource, bracketing the caml_stat_alloc call in
+ caml_add_debug_info. */
+ caml_ext_table_remove(&caml_debug_info, di);
break;
}
- prev = dis;
- dis = Field(dis, 1);
}
CAMLreturn(Val_unit);
@@ -432,7 +402,7 @@ void read_main_debug_info(struct debug_info *di)
CAMLexport void caml_init_debug_info()
{
- caml_register_global_root(&caml_debug_info);
+ caml_ext_table_init(&caml_debug_info, 1);
caml_add_debug_info(caml_start_code, Val_long(caml_code_size), Val_unit);
}
@@ -536,7 +506,7 @@ CAMLexport void caml_print_exception_backtrace(void)
int i;
struct loc_info li;
- if (caml_debug_info == Val_emptylist) {
+ if (caml_debug_info.size == 0) {
fprintf(stderr, "(Cannot print stack backtrace: no debug information available)\n");
return;
}
@@ -554,7 +524,7 @@ CAMLprim value caml_convert_raw_backtrace_slot(value backtrace_slot) {
CAMLlocal2(p, fname);
struct loc_info li;
- if (caml_debug_info == Val_emptylist)
+ if (caml_debug_info.size == 0)
caml_failwith("No debug information available");
extract_location_info(Codet_Val(backtrace_slot), &li);
@@ -605,7 +575,7 @@ CAMLprim value caml_get_exception_backtrace(value unit)
CAMLparam0();
CAMLlocal4(arr, raw_slot, slot, res);
- if (caml_debug_info == Val_emptylist) {
+ if (caml_debug_info.size == 0) {
res = Val_int(0); /* None */
} else {
arr = caml_alloc(caml_backtrace_pos, 0);
diff --git a/byterun/caml/minor_gc.h b/byterun/caml/minor_gc.h
index 9077cab9ff..281e0b5e5e 100644
--- a/byterun/caml/minor_gc.h
+++ b/byterun/caml/minor_gc.h
@@ -31,7 +31,8 @@ struct caml_ref_table {
asize_t size;
asize_t reserve;
};
-CAMLextern struct caml_ref_table caml_ref_table, caml_weak_ref_table;
+CAMLextern struct caml_ref_table caml_ref_table, caml_weak_ref_table,
+ caml_finalize_table;
extern void caml_set_minor_heap_size (asize_t); /* size in bytes */
extern void caml_empty_minor_heap (void);
diff --git a/byterun/custom.c b/byterun/custom.c
index ec304eaf04..ffdfd972c0 100644
--- a/byterun/custom.c
+++ b/byterun/custom.c
@@ -29,9 +29,17 @@ CAMLexport value caml_alloc_custom(struct custom_operations * ops,
value result;
wosize = 1 + (size + sizeof(value) - 1) / sizeof(value);
- if (ops->finalize == NULL && wosize <= Max_young_wosize) {
+ if (wosize <= Max_young_wosize) {
result = caml_alloc_small(wosize, Custom_tag);
Custom_ops_val(result) = ops;
+ if (ops->finalize != NULL) {
+ /* Remembered that the block has a finalizer */
+ if (caml_finalize_table.ptr >= caml_finalize_table.limit){
+ CAMLassert (caml_finalize_table.ptr == caml_finalize_table.limit);
+ caml_realloc_ref_table (&caml_finalize_table);
+ }
+ *caml_finalize_table.ptr++ = (value *)result;
+ }
} else {
result = caml_alloc_shr(wosize, Custom_tag);
Custom_ops_val(result) = ops;
diff --git a/byterun/intern.c b/byterun/intern.c
index 36c011f120..89d13d1169 100644
--- a/byterun/intern.c
+++ b/byterun/intern.c
@@ -473,6 +473,16 @@ static void intern_rec(value *dest)
if (intern_obj_table != NULL) intern_obj_table[obj_counter++] = v;
*intern_dest = Make_header(size, Custom_tag, intern_color);
Custom_ops_val(v) = ops;
+
+ if (ops->finalize != NULL && Is_young(v)) {
+ /* Remembered that the block has a finalizer */
+ if (caml_finalize_table.ptr >= caml_finalize_table.limit){
+ CAMLassert (caml_finalize_table.ptr == caml_finalize_table.limit);
+ caml_realloc_ref_table (&caml_finalize_table);
+ }
+ *caml_finalize_table.ptr++ = (value *)v;
+ }
+
intern_dest += 1 + size;
break;
default:
diff --git a/byterun/minor_gc.c b/byterun/minor_gc.c
index 451c35fd2b..54bb473320 100644
--- a/byterun/minor_gc.c
+++ b/byterun/minor_gc.c
@@ -12,6 +12,7 @@
/***********************************************************************/
#include <string.h>
+#include "caml/custom.h"
#include "caml/config.h"
#include "caml/fail.h"
#include "caml/finalise.h"
@@ -33,7 +34,9 @@ CAMLexport value *caml_young_ptr = NULL, *caml_young_limit = NULL;
CAMLexport struct caml_ref_table
caml_ref_table = { NULL, NULL, NULL, NULL, NULL, 0, 0},
- caml_weak_ref_table = { NULL, NULL, NULL, NULL, NULL, 0, 0};
+ caml_weak_ref_table = { NULL, NULL, NULL, NULL, NULL, 0, 0},
+ caml_finalize_table = { NULL, NULL, NULL, NULL, NULL, 0, 0};
+/* table of custom blocks containing finalizers in the minor heap */
int caml_in_minor_collection = 0;
@@ -248,12 +251,20 @@ void caml_empty_minor_heap (void)
}
}
}
+ for (r = caml_finalize_table.base; r < caml_finalize_table.ptr; r++){
+ int hd = Hd_val ((value)*r);
+ if (hd != 0){ /* If not oldified the finalizer must be called */
+ void (*final_fun)(value) = Custom_ops_val((value)*r)->finalize;
+ final_fun((value)*r);
+ }
+ }
if (caml_young_ptr < caml_young_start) caml_young_ptr = caml_young_start;
caml_stat_minor_words += caml_young_end - caml_young_ptr;
caml_young_ptr = caml_young_end;
caml_young_limit = caml_young_start;
clear_table (&caml_ref_table);
clear_table (&caml_weak_ref_table);
+ clear_table (&caml_finalize_table);
caml_gc_message (0x02, ">", 0);
caml_in_minor_collection = 0;
caml_stat_promoted_words += caml_allocated_words - prev_alloc_words;
diff --git a/byterun/sys.c b/byterun/sys.c
index 97c576dd59..4a890a18e4 100644
--- a/byterun/sys.c
+++ b/byterun/sys.c
@@ -22,7 +22,9 @@
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
-#if !_WIN32
+#if _WIN32
+#include <io.h> /* for isatty */
+#else
#include <sys/wait.h>
#endif
#include "caml/config.h"
@@ -49,6 +51,7 @@
#include "caml/stacks.h"
#include "caml/sys.h"
#include "caml/gc_ctrl.h"
+#include "caml/io.h"
static char * error_message(void)
{
@@ -485,3 +488,20 @@ CAMLprim value caml_sys_read_directory(value path)
caml_ext_table_free(&tbl, 1);
CAMLreturn(result);
}
+
+/* Return true if the value is a filedescriptor (int) that is
+ * (presumably) open on an interactive terminal */
+CAMLprim value caml_sys_isatty(value chan)
+{
+ int fd;
+ value ret;
+
+ fd = (Channel(chan))->fd;
+#ifdef _WIN32
+ ret = Val_bool(_isatty(fd)); /* https://msdn.microsoft.com/en-us/library/f4s0ddew.aspx */
+#else
+ ret = Val_bool(isatty(fd));
+#endif
+
+ return ret;
+}
diff --git a/debugger/.depend b/debugger/.depend
index b62541619a..c9a56ac144 100644
--- a/debugger/.depend
+++ b/debugger/.depend
@@ -16,8 +16,8 @@ int64ops.cmi :
lexer.cmi : parser.cmi
loadprinter.cmi : ../parsing/longident.cmi dynlink.cmi
parameters.cmi :
-parser.cmi : parser_aux.cmi ../parsing/longident.cmi
parser_aux.cmi : primitives.cmi ../parsing/longident.cmi
+parser.cmi : parser_aux.cmi ../parsing/longident.cmi
pattern_matching.cmi : ../typing/typedtree.cmi parser_aux.cmi debugcom.cmi
pos.cmi : ../bytecomp/instruct.cmi
primitives.cmi : $(UNIXDIR)/unix.cmi
diff --git a/driver/compenv.ml b/driver/compenv.ml
index 6f3567e882..32d5f7e91c 100644
--- a/driver/compenv.ml
+++ b/driver/compenv.ml
@@ -212,6 +212,17 @@ let read_OCAMLPARAM ppf position =
"non-integer parameter for \"inline\""))
end
+ (* color output *)
+ | "color" ->
+ begin match parse_color_setting v with
+ | None ->
+ Location.print_warning Location.none ppf
+ (Warnings.Bad_env_variable ("OCAMLPARAM",
+ "bad value for \"color\", \
+ (expected \"auto\", \"always\" or \"never\")"))
+ | Some setting -> color := setting
+ end
+
| "intf-suffix" -> Config.interface_suffix := v
| "I" -> begin
diff --git a/driver/main.ml b/driver/main.ml
index 9835284989..e765d2eedd 100644
--- a/driver/main.ml
+++ b/driver/main.ml
@@ -128,6 +128,11 @@ module Options = Main_args.Make_bytecomp_options (struct
let _w = (Warnings.parse_options false)
let _warn_error = (Warnings.parse_options true)
let _warn_help = Warnings.help_warnings
+ let _color option =
+ begin match Clflags.parse_color_setting option with
+ | None -> ()
+ | Some setting -> Clflags.color := setting
+ end
let _where = print_standard_library
let _verbose = set verbose
let _nopervasives = set nopervasives
diff --git a/driver/main_args.ml b/driver/main_args.ml
index 7bf4c4945b..b44941f9f7 100644
--- a/driver/main_args.ml
+++ b/driver/main_args.ml
@@ -368,6 +368,19 @@ let mk_warn_help f =
"-warn-help", Arg.Unit f, " Show description of warning numbers"
;;
+let mk_color f =
+ "-color", Arg.Symbol (["auto"; "always"; "never"], f),
+ Printf.sprintf
+ " Enable or disable colors in compiler messages\n\
+ \ The following settings are supported:\n\
+ \ auto use heuristics to enable colors only if supported\n\
+ \ always enable colors\n\
+ \ never disable colors\n\
+ \ The default setting is 'auto', and the current heuristic\n\
+ \ checks that the TERM environment variable exists and is\n\
+ \ not empty or \"dumb\", and that isatty(stderr) holds."
+;;
+
let mk_where f =
"-where", Arg.Unit f, " Print location of standard library and exit"
;;
@@ -551,6 +564,8 @@ module type Compiler_options = sig
val _v : unit -> unit
val _verbose : unit -> unit
val _where : unit -> unit
+ val _color : string -> unit
+
val _nopervasives : unit -> unit
end
;;
@@ -659,6 +674,7 @@ struct
mk_cc F._cc;
mk_cclib F._cclib;
mk_ccopt F._ccopt;
+ mk_color F._color;
mk_compat_32 F._compat_32;
mk_config F._config;
mk_custom F._custom;
@@ -783,6 +799,7 @@ struct
mk_cc F._cc;
mk_cclib F._cclib;
mk_ccopt F._ccopt;
+ mk_color F._color;
mk_compact F._compact;
mk_config F._config;
mk_dtypes F._annot;
diff --git a/driver/main_args.mli b/driver/main_args.mli
index ddee921d4b..04f0c6d713 100644
--- a/driver/main_args.mli
+++ b/driver/main_args.mli
@@ -80,6 +80,7 @@ module type Compiler_options = sig
val _v : unit -> unit
val _verbose : unit -> unit
val _where : unit -> unit
+ val _color : string -> unit
val _nopervasives : unit -> unit
end
diff --git a/driver/optmain.ml b/driver/optmain.ml
index 84c27b7866..bef8d86b4f 100644
--- a/driver/optmain.ml
+++ b/driver/optmain.ml
@@ -129,6 +129,11 @@ module Options = Main_args.Make_optcomp_options (struct
let _w s = Warnings.parse_options false s
let _warn_error s = Warnings.parse_options true s
let _warn_help = Warnings.help_warnings
+ let _color option =
+ begin match Clflags.parse_color_setting option with
+ | None -> ()
+ | Some setting -> Clflags.color := setting
+ end
let _where () = print_standard_library ()
let _nopervasives = set nopervasives
diff --git a/lex/.depend b/lex/.depend
index 455421e708..10f90c22c6 100644
--- a/lex/.depend
+++ b/lex/.depend
@@ -3,8 +3,8 @@ compact.cmi : lexgen.cmi
cset.cmi :
lexer.cmi : parser.cmi
lexgen.cmi : syntax.cmi
-output.cmi : syntax.cmi lexgen.cmi compact.cmi common.cmi
outputbis.cmi : syntax.cmi lexgen.cmi common.cmi
+output.cmi : syntax.cmi lexgen.cmi compact.cmi common.cmi
parser.cmi : syntax.cmi
syntax.cmi : cset.cmi
table.cmi :
@@ -22,10 +22,10 @@ main.cmo : syntax.cmi parser.cmi outputbis.cmi output.cmi lexgen.cmi \
lexer.cmi cset.cmi compact.cmi common.cmi
main.cmx : syntax.cmx parser.cmx outputbis.cmx output.cmx lexgen.cmx \
lexer.cmx cset.cmx compact.cmx common.cmx
-output.cmo : lexgen.cmi compact.cmi common.cmi output.cmi
-output.cmx : lexgen.cmx compact.cmx common.cmx output.cmi
outputbis.cmo : lexgen.cmi common.cmi outputbis.cmi
outputbis.cmx : lexgen.cmx common.cmx outputbis.cmi
+output.cmo : lexgen.cmi compact.cmi common.cmi output.cmi
+output.cmx : lexgen.cmx compact.cmx common.cmx output.cmi
parser.cmo : syntax.cmi cset.cmi parser.cmi
parser.cmx : syntax.cmx cset.cmx parser.cmi
syntax.cmo : cset.cmi syntax.cmi
diff --git a/ocamlbuild/.depend b/ocamlbuild/.depend
index 3b67d873d4..d6dda722ed 100644
--- a/ocamlbuild/.depend
+++ b/ocamlbuild/.depend
@@ -8,9 +8,9 @@ exit_codes.cmi :
fda.cmi : slurp.cmi
findlib.cmi : signatures.cmi command.cmi
flags.cmi : tags.cmi command.cmi
-glob.cmi : signatures.cmi glob_ast.cmi bool.cmi
glob_ast.cmi : bool.cmi
glob_lexer.cmi : glob_ast.cmi
+glob.cmi : signatures.cmi glob_ast.cmi bool.cmi
hooks.cmi :
hygiene.cmi : slurp.cmi
lexers.cmi : loc.cmi glob.cmi
@@ -20,17 +20,17 @@ main.cmi :
my_std.cmi : signatures.cmi
my_unix.cmi :
ocaml_arch.cmi : signatures.cmi command.cmi
+ocamlbuild_executor.cmi :
+ocamlbuildlight.cmi :
+ocamlbuild.cmi :
+ocamlbuild_plugin.cmi :
+ocamlbuild_unix_plugin.cmi :
+ocamlbuild_where.cmi :
ocaml_compiler.cmi : tags.cmi rule.cmi pathname.cmi command.cmi
ocaml_dependencies.cmi : pathname.cmi
ocaml_specific.cmi :
ocaml_tools.cmi : tags.cmi rule.cmi pathname.cmi command.cmi
ocaml_utils.cmi : tags.cmi pathname.cmi command.cmi
-ocamlbuild.cmi :
-ocamlbuild_executor.cmi :
-ocamlbuild_plugin.cmi :
-ocamlbuild_unix_plugin.cmi :
-ocamlbuild_where.cmi :
-ocamlbuildlight.cmi :
options.cmi : slurp.cmi signatures.cmi command.cmi
param_tags.cmi : tags.cmi loc.cmi
pathname.cmi : signatures.cmi
@@ -75,12 +75,12 @@ findlib.cmx : my_unix.cmx my_std.cmx lexers.cmx const.cmx command.cmx \
findlib.cmi
flags.cmo : tags.cmi param_tags.cmi log.cmi command.cmi bool.cmi flags.cmi
flags.cmx : tags.cmx param_tags.cmx log.cmx command.cmx bool.cmx flags.cmi
-glob.cmo : my_std.cmi glob_lexer.cmi glob_ast.cmi bool.cmi glob.cmi
-glob.cmx : my_std.cmx glob_lexer.cmx glob_ast.cmx bool.cmx glob.cmi
glob_ast.cmo : bool.cmi glob_ast.cmi
glob_ast.cmx : bool.cmx glob_ast.cmi
glob_lexer.cmo : glob_ast.cmi bool.cmi glob_lexer.cmi
glob_lexer.cmx : glob_ast.cmx bool.cmx glob_lexer.cmi
+glob.cmo : my_std.cmi glob_lexer.cmi glob_ast.cmi bool.cmi glob.cmi
+glob.cmx : my_std.cmx glob_lexer.cmx glob_ast.cmx bool.cmx glob.cmi
hooks.cmo : hooks.cmi
hooks.cmx : hooks.cmi
hygiene.cmo : slurp.cmi shell.cmi pathname.cmi options.cmi my_std.cmi \
@@ -111,6 +111,22 @@ my_unix.cmo : my_std.cmi my_unix.cmi
my_unix.cmx : my_std.cmx my_unix.cmi
ocaml_arch.cmo : pathname.cmi my_std.cmi command.cmi ocaml_arch.cmi
ocaml_arch.cmx : pathname.cmx my_std.cmx command.cmx ocaml_arch.cmi
+ocamlbuild_config.cmo :
+ocamlbuild_config.cmx :
+ocamlbuild_executor.cmo : ocamlbuild_executor.cmi
+ocamlbuild_executor.cmx : ocamlbuild_executor.cmi
+ocamlbuildlight.cmo : ocamlbuildlight.cmi
+ocamlbuildlight.cmx : ocamlbuildlight.cmi
+ocamlbuild.cmo : ocamlbuild_unix_plugin.cmi ocamlbuild.cmi
+ocamlbuild.cmx : ocamlbuild_unix_plugin.cmx ocamlbuild.cmi
+ocamlbuild_plugin.cmo : ocamlbuild_plugin.cmi
+ocamlbuild_plugin.cmx : ocamlbuild_plugin.cmi
+ocamlbuild_unix_plugin.cmo : ocamlbuild_executor.cmi my_unix.cmi my_std.cmi \
+ exit_codes.cmi ocamlbuild_unix_plugin.cmi
+ocamlbuild_unix_plugin.cmx : ocamlbuild_executor.cmx my_unix.cmx my_std.cmx \
+ exit_codes.cmx ocamlbuild_unix_plugin.cmi
+ocamlbuild_where.cmo : ocamlbuild_config.cmo ocamlbuild_where.cmi
+ocamlbuild_where.cmx : ocamlbuild_config.cmx ocamlbuild_where.cmi
ocaml_compiler.cmo : tools.cmi tags.cmi rule.cmi resource.cmi pathname.cmi \
options.cmi ocaml_utils.cmi ocaml_dependencies.cmi ocaml_arch.cmi \
my_std.cmi log.cmi command.cmi ocaml_compiler.cmi
@@ -141,22 +157,6 @@ ocaml_utils.cmo : tools.cmi tags.cmi pathname.cmi param_tags.cmi options.cmi \
ocaml_utils.cmx : tools.cmx tags.cmx pathname.cmx param_tags.cmx options.cmx \
my_std.cmx log.cmx lexers.cmx flags.cmx const.cmx command.cmx \
ocaml_utils.cmi
-ocamlbuild.cmo : ocamlbuild_unix_plugin.cmi ocamlbuild.cmi
-ocamlbuild.cmx : ocamlbuild_unix_plugin.cmx ocamlbuild.cmi
-ocamlbuild_config.cmo :
-ocamlbuild_config.cmx :
-ocamlbuild_executor.cmo : ocamlbuild_executor.cmi
-ocamlbuild_executor.cmx : ocamlbuild_executor.cmi
-ocamlbuild_plugin.cmo : ocamlbuild_plugin.cmi
-ocamlbuild_plugin.cmx : ocamlbuild_plugin.cmi
-ocamlbuild_unix_plugin.cmo : ocamlbuild_executor.cmi my_unix.cmi my_std.cmi \
- exit_codes.cmi ocamlbuild_unix_plugin.cmi
-ocamlbuild_unix_plugin.cmx : ocamlbuild_executor.cmx my_unix.cmx my_std.cmx \
- exit_codes.cmx ocamlbuild_unix_plugin.cmi
-ocamlbuild_where.cmo : ocamlbuild_config.cmo ocamlbuild_where.cmi
-ocamlbuild_where.cmx : ocamlbuild_config.cmx ocamlbuild_where.cmi
-ocamlbuildlight.cmo : ocamlbuildlight.cmi
-ocamlbuildlight.cmx : ocamlbuildlight.cmi
options.cmo : shell.cmi ocamlbuild_where.cmi ocamlbuild_config.cmo \
my_std.cmi log.cmi lexers.cmi const.cmo command.cmi options.cmi
options.cmx : shell.cmx ocamlbuild_where.cmx ocamlbuild_config.cmx \
diff --git a/ocamlbuild/main.ml b/ocamlbuild/main.ml
index 52be0027cf..f64a4ba281 100644
--- a/ocamlbuild/main.ml
+++ b/ocamlbuild/main.ml
@@ -250,7 +250,9 @@ let proceed () =
List.fold_right begin fun (target, ext) acc ->
let cmd = !Options.build_dir/target in
let link x =
- if !Options.make_links then ignore (call (S [A"ln"; A"-sf"; P x; A Pathname.current_dir_name])) in
+ if !Options.make_links then
+ ignore (call (S [A"ln"; A"-sf"; P x; A Pathname.pwd]))
+ in
match ext with
| "byte" | "native" | "top" ->
link cmd; cmd :: acc
diff --git a/ocamlbuild/ocaml_specific.ml b/ocamlbuild/ocaml_specific.ml
index 9f2f67fb0e..b902810ad7 100644
--- a/ocamlbuild/ocaml_specific.ml
+++ b/ocamlbuild/ocaml_specific.ml
@@ -74,15 +74,20 @@ rule "target files"
build each of those targets in turn."
begin fun env build ->
let itarget = env "%.itarget" in
- let dir = Pathname.dirname itarget in
- let targets = string_list_of_file itarget in
- List.iter ignore_good (build (List.map (fun x -> [dir/x]) targets));
- if !Options.make_links then
- let link x =
- Cmd (S [A"ln"; A"-sf"; P (!Options.build_dir/x); A Pathname.parent_dir_name]) in
- Seq (List.map (fun x -> link (dir/x)) targets)
- else
- Nop
+ let targets =
+ let dir = Pathname.dirname itarget in
+ let files = string_list_of_file itarget in
+ List.map (fun file -> [Pathname.concat dir file]) files
+ in
+ let results = List.map Outcome.good (build targets) in
+ let link_command result =
+ Cmd (S [A "ln"; A "-sf";
+ P (Pathname.concat !Options.build_dir result);
+ A Pathname.pwd])
+ in
+ if not !Options.make_links
+ then Nop
+ else Seq (List.map link_command results)
end;;
rule "ocaml: mli -> cmi"
@@ -638,6 +643,7 @@ let () =
(fun param -> S [A "-for-pack"; A param]);
pflag ["ocaml"; "native"; "compile"] "inline"
(fun param -> S [A "-inline"; A param]);
+ pflag ["ocaml"; "compile"] "color" (fun setting -> S[A "-color"; A setting]);
List.iter (fun pp ->
pflag ["ocaml"; "compile"] pp
(fun param -> S [A ("-" ^ pp); A param]);
diff --git a/ocamlbuild/signatures.mli b/ocamlbuild/signatures.mli
index 6b77836809..c75ca2a6eb 100644
--- a/ocamlbuild/signatures.mli
+++ b/ocamlbuild/signatures.mli
@@ -574,49 +574,131 @@ module type PLUGIN = sig
set of tags if the given option is Some. *)
val ( --- ) : Tags.t -> Tags.elt option -> Tags.t
- (** The type of the builder environments. Here an environment is just the
- lookup function of it. Basically this function will resolve path variables
- like % or more generally %(var_name). *)
+ (** Targets and dependencies in rules are patterns, which are
+ matched by the actual targets requested by the user. For
+ example, if a rule explains how to build "%.cmo" from "%.ml", it
+ will be fired if the user tries to build "foo.cmo".
+
+ The environment records the value of the pattern variables
+ (here "%") in this matching. In the context of our example, the
+ environment will be a function substituting "%" by "foo";
+ calling it on "%.cmo" will return "foo.cmo", and calling it on
+ "%.ml" will return "foo.ml".
+
+ For a typical example of use of the environment, see the
+ [ocamldep_ml_command] example in the documentation of {!action}
+ below. *)
type env = Pathname.t -> Pathname.t
(** A builder is a function that waits for conjonction of alternative targets.
The alternatives are here to support some choices, for instance for an
OCaml module an alternatives can be foo.cmo, foo.cmi, Foo.cmo, Foo.cmi.
Conjonctions are here to help making parallelism, indeed commands that are
- independant will be run concurently. *)
+ independant will be run concurently.
+
+ For an example of use of a builder function, see the [targets]
+ function given as an example in the documentation of the
+ {!action} type below.
+ *)
type builder = Pathname.t list list -> (Pathname.t, exn) Outcome.t list
(** This is the type for rule actions. An action receive as argument, the
environment lookup function (see {!env}), and a function to dynamically
build more targets (see {!builder}). An action should return the command
to run in order to build the rule productions using the rule dependencies.
- *)
+
+ For example, here is an action to build an [ocamldep] command,
+ for use in the example of rule given in the documentation of
+ {!rule} below:
+{[
+let ocamldep_ml_command env _build =
+ let arg = env "%.ml" and out = env "%.ml.depends" in
+ let tags = tags_of_pathname arg ++ "ocaml" ++ "ocamldep" in
+ Cmd(S[A "ocamldep"; T tags; A "-modules"; P arg; Sh ">"; Px out])
+]}
+
+ In the example above, the build function is not used, as there
+ are no dynamic dependencies. There are in the example below: we
+ build a list of targets dynamically read from a "foo.itarget"
+ file. The final command returned by the action links each of
+ them in the current directory.
+
+{[
+let target_list env build =
+ let itarget = env "%.itarget" in
+ let targets =
+ let dir = Pathname.dirname itarget in
+ let files = string_list_of_file itarget in
+ List.map (fun file -> [Pathname.concat dir file]) files
+ in
+ let results = List.map Outcome.good (build targets) in
+ let link_command result =
+ Cmd (S [A "ln"; A "-sf";
+ P (Pathname.concat !Options.build_dir result);
+ A Pathname.pwd])
+ in
+ Seq (List.map link_command results)
+]}
+ *)
type action = env -> builder -> Command.t
(** This is the main function for adding a rule to the ocamlbuild engine.
- The first argument is the name of the rule (should be unique).
- It takes files that the rule produces.
- Use ~prod for one file, ~prods for list of files.
+ Use [~prod] for one file, [~prods] for list of files.
- It also takes files that the rule uses.
- Use ~dep for one file, ~deps for list of files.
+ Use [~dep] for one file, [~deps] for list of files.
- It finally takes the action to perform in order to produce the
productions files using the dependencies (see [action]).
There are some more optional parameters:
- - The ~insert argument allow to insert the rules precisely between other
+ - The [~insert] argument allows to insert the rules precisely between other
rules.
- - The ~stamp argument specify the name of a file that will be
+ - The [~stamp] argument specifies the name of a file that will be
automatically produced by ocamlbuild. This file can serve as a virtual
target (or phony target), since it will be filled up by a digest of
it dependencies.
- - The ~tags argument in deprecated, don't use it.
+ - The [~tags] argument in deprecated, don't use it.
- Finally, the optional ~doc argument allows to give an informal
+ Finally, the optional [~doc] argument allows to give an informal
explanation of the rule purpose and behavior, that will be
displayed by [ocamlbuild -documentation]. For example, it is
a good place to specify the commands that will be called, any
new tags introduced by the rule, and dynamic dependencies.
- *)
+
+ For example, here is how a rule producing [foo.ml.depends] from
+ [foo.ml] (calling [ocamldep]) is defined, slightly simplified from
+ the built-in definition.
+
+{[
+rule "ocaml dependencies ml"
+ ~prod:"%.ml.depends"
+ ~dep:"%.ml"
+ (ocamldep_ml_command)
+]}
+
+ The rule that builds a list of targets from a [%.itarget] file is
+ an example of use of the [?stamp] argument. It uses the
+ [target_list] action provided in the documentation of {!action}
+ above. Besides the targets listed in the [%.itarget] file, this
+ command will also produce a [%.otarget] file (the "stamp") that
+ contains the digest of all the [%.itarget] dependencies. This stamp
+ file is the name to use when you want to ask OCamlbuild to build
+ the targets listed: invoking [ocamlbuild foo.otarget] will build
+ the the targets listed in [foo.itarget]. Similarly, new rules
+ that would depend on that list of targets should depend on
+ [%.otarget] (output), not [%.itarget] (input).
+
+{[
+rule "target files"
+ ~dep:"%.itarget"
+ ~stamp:"%.otarget"
+ ~doc:"If foo.itarget contains a list of ocamlbuild targets, \
+ asking ocamlbuild to produce foo.otarget will \
+ build each of those targets in turn."
+ target_list
+]}
+ *)
val rule : string ->
?tags:string list ->
?prods:string list ->
diff --git a/ocamldoc/.depend b/ocamldoc/.depend
index 5a2df26c54..ec461d73de 100644
--- a/ocamldoc/.depend
+++ b/ocamldoc/.depend
@@ -1,11 +1,3 @@
-odoc.cmo : ../typing/typedtree.cmi odoc_messages.cmo odoc_info.cmi \
- odoc_global.cmi odoc_gen.cmi odoc_config.cmi odoc_args.cmi \
- odoc_analyse.cmi ../utils/misc.cmi ../utils/config.cmi \
- ../utils/clflags.cmi
-odoc.cmx : ../typing/typedtree.cmx odoc_messages.cmx odoc_info.cmx \
- odoc_global.cmx odoc_gen.cmx odoc_config.cmx odoc_args.cmx \
- odoc_analyse.cmx ../utils/misc.cmx ../utils/config.cmx \
- ../utils/clflags.cmx
odoc_analyse.cmo : ../utils/warnings.cmi ../typing/types.cmi \
../typing/typemod.cmi ../typing/typedtree.cmi ../parsing/syntaxerr.cmi \
../driver/pparse.cmi ../parsing/parse.cmi odoc_types.cmi odoc_text.cmi \
@@ -52,6 +44,8 @@ odoc_class.cmo : ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
odoc_parameter.cmo odoc_name.cmi
odoc_class.cmx : ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
odoc_parameter.cmx odoc_name.cmx
+odoc_comments_global.cmo : odoc_comments_global.cmi
+odoc_comments_global.cmx : odoc_comments_global.cmi
odoc_comments.cmo : odoc_types.cmi odoc_text.cmi odoc_see_lexer.cmo \
odoc_parser.cmi odoc_misc.cmi odoc_messages.cmo odoc_merge.cmi \
odoc_lexer.cmo odoc_global.cmi odoc_cross.cmi odoc_comments_global.cmi \
@@ -60,8 +54,6 @@ odoc_comments.cmx : odoc_types.cmx odoc_text.cmx odoc_see_lexer.cmx \
odoc_parser.cmx odoc_misc.cmx odoc_messages.cmx odoc_merge.cmx \
odoc_lexer.cmx odoc_global.cmx odoc_cross.cmx odoc_comments_global.cmx \
odoc_comments.cmi
-odoc_comments_global.cmo : odoc_comments_global.cmi
-odoc_comments_global.cmx : odoc_comments_global.cmi
odoc_config.cmo : ../utils/config.cmi odoc_config.cmi
odoc_config.cmx : ../utils/config.cmx odoc_config.cmi
odoc_control.cmo :
@@ -152,6 +144,14 @@ odoc_misc.cmo : ../typing/types.cmi ../typing/predef.cmi ../typing/path.cmi \
odoc_misc.cmx : ../typing/types.cmx ../typing/predef.cmx ../typing/path.cmx \
odoc_types.cmx odoc_messages.cmx ../parsing/longident.cmx \
../typing/ctype.cmx ../typing/btype.cmx odoc_misc.cmi
+odoc.cmo : ../typing/typedtree.cmi odoc_messages.cmo odoc_info.cmi \
+ odoc_global.cmi odoc_gen.cmi odoc_config.cmi odoc_args.cmi \
+ odoc_analyse.cmi ../utils/misc.cmi ../utils/config.cmi \
+ ../utils/clflags.cmi
+odoc.cmx : ../typing/typedtree.cmx odoc_messages.cmx odoc_info.cmx \
+ odoc_global.cmx odoc_gen.cmx odoc_config.cmx odoc_args.cmx \
+ odoc_analyse.cmx ../utils/misc.cmx ../utils/config.cmx \
+ ../utils/clflags.cmx
odoc_module.cmo : ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
odoc_type.cmo odoc_name.cmi odoc_extension.cmo odoc_exception.cmo \
odoc_class.cmo
@@ -214,12 +214,12 @@ odoc_texi.cmo : ../typing/types.cmi odoc_to_text.cmo odoc_messages.cmo \
odoc_info.cmi ../parsing/asttypes.cmi
odoc_texi.cmx : ../typing/types.cmx odoc_to_text.cmx odoc_messages.cmx \
odoc_info.cmx ../parsing/asttypes.cmi
+odoc_text_lexer.cmo : odoc_text_parser.cmi odoc_misc.cmi
+odoc_text_lexer.cmx : odoc_text_parser.cmx odoc_misc.cmx
odoc_text.cmo : odoc_types.cmi odoc_text_parser.cmi odoc_text_lexer.cmo \
odoc_text.cmi
odoc_text.cmx : odoc_types.cmx odoc_text_parser.cmx odoc_text_lexer.cmx \
odoc_text.cmi
-odoc_text_lexer.cmo : odoc_text_parser.cmi odoc_misc.cmi
-odoc_text_lexer.cmx : odoc_text_parser.cmx odoc_misc.cmx
odoc_text_parser.cmo : odoc_types.cmi odoc_misc.cmi odoc_text_parser.cmi
odoc_text_parser.cmx : odoc_types.cmx odoc_misc.cmx odoc_text_parser.cmi
odoc_to_text.cmo : odoc_module.cmo odoc_messages.cmo odoc_info.cmi
@@ -238,8 +238,8 @@ odoc_analyse.cmi : odoc_module.cmo odoc_global.cmi
odoc_args.cmi : odoc_gen.cmi
odoc_ast.cmi : ../typing/types.cmi ../typing/typedtree.cmi \
../parsing/parsetree.cmi odoc_sig.cmi odoc_name.cmi odoc_module.cmo
-odoc_comments.cmi : odoc_types.cmi odoc_module.cmo
odoc_comments_global.cmi :
+odoc_comments.cmi : odoc_types.cmi odoc_module.cmo
odoc_config.cmi :
odoc_cross.cmi : odoc_types.cmi odoc_module.cmo
odoc_dag2html.cmi : odoc_info.cmi
diff --git a/otherlibs/dynlink/Makefile b/otherlibs/dynlink/Makefile
index acff7a7a68..1c422983b2 100644
--- a/otherlibs/dynlink/Makefile
+++ b/otherlibs/dynlink/Makefile
@@ -105,5 +105,6 @@ clean: partialclean
depend:
-dynlink.cmo: dynlinkaux.cmi dynlink.cmi
+dynlink.cmi: dynlinkaux.cmi
+dynlink.cmo: dynlink.cmi dynlinkaux.cmo
extract_crc.cmo: dynlink.cmi
diff --git a/otherlibs/num/.depend b/otherlibs/num/.depend
index ce46355d11..c885abf051 100644
--- a/otherlibs/num/.depend
+++ b/otherlibs/num/.depend
@@ -1,8 +1,8 @@
+bng_amd64.o: bng_amd64.c
+bng_arm64.o: bng_arm64.c
bng.o: bng.c bng.h ../../byterun/caml/config.h \
../../byterun/caml/../../config/m.h ../../byterun/caml/../../config/s.h \
../../byterun/caml/compatibility.h bng_amd64.c bng_digit.c
-bng_amd64.o: bng_amd64.c
-bng_arm64.o: bng_arm64.c
bng_digit.o: bng_digit.c
bng_ia32.o: bng_ia32.c
bng_ppc.o: bng_ppc.c
diff --git a/otherlibs/unix/.depend b/otherlibs/unix/.depend
index 1d6fd45b10..4f6a638740 100644
--- a/otherlibs/unix/.depend
+++ b/otherlibs/unix/.depend
@@ -100,11 +100,11 @@ cstringv.o: cstringv.c ../../byterun/caml/mlvalues.h \
../../byterun/caml/major_gc.h ../../byterun/caml/freelist.h \
../../byterun/caml/minor_gc.h ../../byterun/caml/address_class.h \
unixsupport.h
-dup.o: dup.c ../../byterun/caml/mlvalues.h \
+dup2.o: dup2.c ../../byterun/caml/mlvalues.h \
../../byterun/caml/compatibility.h ../../byterun/caml/config.h \
../../byterun/caml/../../config/m.h ../../byterun/caml/../../config/s.h \
../../byterun/caml/misc.h unixsupport.h
-dup2.o: dup2.c ../../byterun/caml/mlvalues.h \
+dup.o: dup.c ../../byterun/caml/mlvalues.h \
../../byterun/caml/compatibility.h ../../byterun/caml/config.h \
../../byterun/caml/../../config/m.h ../../byterun/caml/../../config/s.h \
../../byterun/caml/misc.h unixsupport.h
@@ -510,11 +510,6 @@ sleep.o: sleep.c ../../byterun/caml/mlvalues.h \
../../byterun/caml/../../config/m.h ../../byterun/caml/../../config/s.h \
../../byterun/caml/misc.h ../../byterun/caml/signals.h \
../../byterun/caml/mlvalues.h unixsupport.h
-socket.o: socket.c ../../byterun/caml/fail.h \
- ../../byterun/caml/compatibility.h ../../byterun/caml/misc.h \
- ../../byterun/caml/config.h ../../byterun/caml/../../config/m.h \
- ../../byterun/caml/../../config/s.h ../../byterun/caml/mlvalues.h \
- ../../byterun/caml/mlvalues.h unixsupport.h
socketaddr.o: socketaddr.c ../../byterun/caml/mlvalues.h \
../../byterun/caml/compatibility.h ../../byterun/caml/config.h \
../../byterun/caml/../../config/m.h ../../byterun/caml/../../config/s.h \
@@ -524,6 +519,11 @@ socketaddr.o: socketaddr.c ../../byterun/caml/mlvalues.h \
../../byterun/caml/freelist.h ../../byterun/caml/minor_gc.h \
../../byterun/caml/address_class.h unixsupport.h socketaddr.h \
../../byterun/caml/misc.h
+socket.o: socket.c ../../byterun/caml/fail.h \
+ ../../byterun/caml/compatibility.h ../../byterun/caml/misc.h \
+ ../../byterun/caml/config.h ../../byterun/caml/../../config/m.h \
+ ../../byterun/caml/../../config/s.h ../../byterun/caml/mlvalues.h \
+ ../../byterun/caml/mlvalues.h unixsupport.h
socketpair.o: socketpair.c ../../byterun/caml/mlvalues.h \
../../byterun/caml/compatibility.h ../../byterun/caml/config.h \
../../byterun/caml/../../config/m.h ../../byterun/caml/../../config/s.h \
@@ -636,9 +636,9 @@ write.o: write.c ../../byterun/caml/mlvalues.h \
../../byterun/caml/major_gc.h ../../byterun/caml/freelist.h \
../../byterun/caml/minor_gc.h ../../byterun/caml/address_class.h \
../../byterun/caml/signals.h unixsupport.h
-unix.cmi :
unixLabels.cmi : unix.cmi
-unix.cmo : unix.cmi
-unix.cmx : unix.cmi
+unix.cmi :
unixLabels.cmo : unix.cmi unixLabels.cmi
unixLabels.cmx : unix.cmx unixLabels.cmi
+unix.cmo : unix.cmi
+unix.cmx : unix.cmi
diff --git a/parsing/location.ml b/parsing/location.ml
index a4910bdc2f..ec85cf233c 100644
--- a/parsing/location.ml
+++ b/parsing/location.ml
@@ -250,7 +250,11 @@ let get_pos_info pos =
(pos.pos_fname, pos.pos_lnum, pos.pos_cnum - pos.pos_bol)
;;
+let setup_colors () =
+ Misc.Color.setup !Clflags.color
+
let print_loc ppf loc =
+ setup_colors ();
let (file, line, startchar) = get_pos_info loc.loc_start in
let endchar = loc.loc_end.pos_cnum - loc.loc_start.pos_cnum + startchar in
if file = "//toplevel//" then begin
@@ -258,29 +262,41 @@ let print_loc ppf loc =
fprintf ppf "Characters %i-%i"
loc.loc_start.pos_cnum loc.loc_end.pos_cnum
end else begin
- fprintf ppf "%s%a%s%i" msg_file print_filename file msg_line line;
+ fprintf ppf "%s@{<loc>%a%s%i" msg_file print_filename file msg_line line;
if startchar >= 0 then
- fprintf ppf "%s%i%s%i" msg_chars startchar msg_to endchar
+ fprintf ppf "%s%i%s%i" msg_chars startchar msg_to endchar;
+ fprintf ppf "@}"
end
;;
let print ppf loc =
+ setup_colors ();
if loc.loc_start.pos_fname = "//toplevel//"
&& highlight_locations ppf [loc] then ()
- else fprintf ppf "%a%s@." print_loc loc msg_colon
+ else fprintf ppf "@{<loc>%a@}%s@." print_loc loc msg_colon
+;;
+
+let error_prefix = "Error"
+let warning_prefix = "Warning"
+
+let print_error_prefix ppf () =
+ setup_colors ();
+ fprintf ppf "@{<error>%s@}:" error_prefix;
+ ()
;;
let print_error ppf loc =
print ppf loc;
- fprintf ppf "Error: ";
+ print_error_prefix ppf ()
;;
-let print_error_cur_file ppf = print_error ppf (in_file !input_name);;
+let print_error_cur_file ppf () = print_error ppf (in_file !input_name);;
let default_warning_printer loc ppf w =
if Warnings.is_active w then begin
+ setup_colors ();
print ppf loc;
- fprintf ppf "Warning %a@." Warnings.print w
+ fprintf ppf "@{<warning>%s@} %a@." warning_prefix Warnings.print w
end
;;
@@ -314,8 +330,31 @@ type error =
if_highlight: string; (* alternative message if locations are highlighted *)
}
-let errorf ?(loc = none) ?(sub = []) ?(if_highlight = "") =
- Printf.ksprintf (fun msg -> {loc; msg; sub; if_highlight})
+let pp_ksprintf ?before k fmt =
+ let buf = Buffer.create 64 in
+ let ppf = Format.formatter_of_buffer buf in
+ Misc.Color.set_color_tag_handling ppf;
+ begin match before with
+ | None -> ()
+ | Some f -> f ppf
+ end;
+ kfprintf
+ (fun _ ->
+ pp_print_flush ppf ();
+ let msg = Buffer.contents buf in
+ k msg)
+ ppf fmt
+
+let errorf ?(loc = none) ?(sub = []) ?(if_highlight = "") fmt =
+ pp_ksprintf
+ (fun msg -> {loc; msg; sub; if_highlight})
+ fmt
+
+let errorf_prefixed ?(loc=none) ?(sub=[]) ?(if_highlight="") fmt =
+ pp_ksprintf
+ ~before:(fun ppf -> fprintf ppf "%a " print_error_prefix ())
+ (fun msg -> {loc; msg; sub; if_highlight})
+ fmt
let error ?(loc = none) ?(sub = []) ?(if_highlight = "") msg =
{loc; msg; sub; if_highlight}
@@ -361,13 +400,7 @@ let report_error ppf err =
;;
let error_of_printer loc print x =
- let buf = Buffer.create 64 in
- let ppf = Format.formatter_of_buffer buf in
- pp_print_string ppf "Error: ";
- print ppf x;
- pp_print_flush ppf ();
- let msg = Buffer.contents buf in
- errorf ~loc "%s" msg
+ errorf_prefixed ~loc "%a@?" print x
let error_of_printer_file print x =
error_of_printer (in_file !input_name) print x
@@ -376,11 +409,12 @@ let () =
register_error_of_exn
(function
| Sys_error msg ->
- Some (errorf ~loc:(in_file !input_name) "Error: I/O error: %s" msg)
+ Some (errorf_prefixed ~loc:(in_file !input_name)
+ "I/O error: %s" msg)
| Warnings.Errors n ->
Some
- (errorf ~loc:(in_file !input_name)
- "Error: Some fatal warnings were triggered (%d occurrences)" n)
+ (errorf_prefixed ~loc:(in_file !input_name)
+ "Some fatal warnings were triggered (%d occurrences)" n)
| _ ->
None
)
@@ -407,4 +441,4 @@ let () =
)
let raise_errorf ?(loc = none) ?(sub = []) ?(if_highlight = "") =
- Printf.ksprintf (fun msg -> raise (Error ({loc; msg; sub; if_highlight})))
+ pp_ksprintf (fun msg -> raise (Error ({loc; msg; sub; if_highlight})))
diff --git a/parsing/location.mli b/parsing/location.mli
index 77b754f731..9c7421f09d 100644
--- a/parsing/location.mli
+++ b/parsing/location.mli
@@ -53,7 +53,7 @@ val input_lexbuf: Lexing.lexbuf option ref
val get_pos_info: Lexing.position -> string * int * int (* file, line, char *)
val print_loc: formatter -> t -> unit
val print_error: formatter -> t -> unit
-val print_error_cur_file: formatter -> unit
+val print_error_cur_file: formatter -> unit -> unit
val print_warning: t -> formatter -> Warnings.t -> unit
val formatter_for_warnings : formatter ref
val prerr_warning: t -> Warnings.t -> unit
@@ -88,7 +88,6 @@ val show_filename: string -> string
val absname: bool ref
-
(* Support for located errors *)
type error =
@@ -101,13 +100,21 @@ type error =
exception Error of error
+val print_error_prefix: formatter -> unit -> unit
+ (* print the prefix "Error:" possibly with style *)
+
val error: ?loc:t -> ?sub:error list -> ?if_highlight:string -> string -> error
val errorf: ?loc:t -> ?sub:error list -> ?if_highlight:string
- -> ('a, unit, string, error) format4 -> 'a
+ -> ('a, Format.formatter, unit, error) format4 -> 'a
+
+val errorf_prefixed : ?loc:t -> ?sub:error list -> ?if_highlight:string
+ -> ('a, Format.formatter, unit, error) format4 -> 'a
+ (* same as {!errorf}, but prints the error prefix "Error:" before yielding
+ * to the format string *)
val raise_errorf: ?loc:t -> ?sub:error list -> ?if_highlight:string
- -> ('a, unit, string, 'b) format4 -> 'a
+ -> ('a, Format.formatter, unit, 'b) format4 -> 'a
val error_of_printer: t -> (formatter -> 'a -> unit) -> 'a -> error
diff --git a/parsing/syntaxerr.ml b/parsing/syntaxerr.ml
index 8c2f37b35d..cedfc36c1b 100644
--- a/parsing/syntaxerr.ml
+++ b/parsing/syntaxerr.ml
@@ -26,34 +26,34 @@ exception Escape_error
let prepare_error = function
| Unclosed(opening_loc, opening, closing_loc, closing) ->
- Location.errorf ~loc:closing_loc
+ Location.errorf_prefixed ~loc:closing_loc
~sub:[
- Location.error ~loc:opening_loc
- (Printf.sprintf "Error: This '%s' might be unmatched" opening)
+ Location.errorf_prefixed ~loc:opening_loc
+ "This '%s' might be unmatched" opening
]
~if_highlight:
(Printf.sprintf "Syntax error: '%s' expected, \
the highlighted '%s' might be unmatched"
closing opening)
- "Error: Syntax error: '%s' expected" closing
+ "Syntax error: '%s' expected" closing
| Expecting (loc, nonterm) ->
- Location.errorf ~loc "Error: Syntax error: %s expected." nonterm
+ Location.errorf_prefixed ~loc "Syntax error: %s expected." nonterm
| Not_expecting (loc, nonterm) ->
- Location.errorf ~loc "Error: Syntax error: %s not expected." nonterm
+ Location.errorf_prefixed ~loc "Syntax error: %s not expected." nonterm
| Applicative_path loc ->
- Location.errorf ~loc
- "Error: Syntax error: applicative paths of the form F(X).t \
+ Location.errorf_prefixed ~loc
+ "Syntax error: applicative paths of the form F(X).t \
are not supported when the option -no-app-func is set."
| Variable_in_scope (loc, var) ->
- Location.errorf ~loc
- "Error: In this scoped type, variable '%s \
+ Location.errorf_prefixed ~loc
+ "In this scoped type, variable '%s \
is reserved for the local type %s."
- var var
+ var var
| Other loc ->
- Location.error ~loc "Error: Syntax error"
+ Location.errorf_prefixed ~loc "Syntax error"
| Ill_formed_ast (loc, s) ->
- Location.errorf ~loc "Error: broken invariant in parsetree: %s" s
+ Location.errorf_prefixed ~loc "broken invariant in parsetree: %s" s
let () =
Location.register_error_of_exn
diff --git a/stdlib/.depend b/stdlib/.depend
index 3b6ebbda75..a3bbd65b3b 100644
--- a/stdlib/.depend
+++ b/stdlib/.depend
@@ -1,12 +1,12 @@
arg.cmi :
-array.cmi :
arrayLabels.cmi :
+array.cmi :
buffer.cmi :
-bytes.cmi :
bytesLabels.cmi :
+bytes.cmi :
callback.cmi :
-camlinternalFormat.cmi : camlinternalFormatBasics.cmi buffer.cmi
camlinternalFormatBasics.cmi :
+camlinternalFormat.cmi : camlinternalFormatBasics.cmi buffer.cmi
camlinternalLazy.cmi :
camlinternalMod.cmi : obj.cmi
camlinternalOO.cmi : obj.cmi
@@ -22,8 +22,8 @@ int32.cmi :
int64.cmi :
lazy.cmi :
lexing.cmi :
-list.cmi :
listLabels.cmi :
+list.cmi :
map.cmi :
marshal.cmi :
moreLabels.cmi : set.cmi map.cmi hashtbl.cmi
@@ -43,32 +43,32 @@ stack.cmi :
stdLabels.cmi : stringLabels.cmi listLabels.cmi bytesLabels.cmi \
arrayLabels.cmi
stream.cmi :
-string.cmi :
stringLabels.cmi :
+string.cmi :
sys.cmi :
weak.cmi : hashtbl.cmi
arg.cmo : sys.cmi string.cmi printf.cmi list.cmi buffer.cmi array.cmi \
arg.cmi
arg.cmx : sys.cmx string.cmx printf.cmx list.cmx buffer.cmx array.cmx \
arg.cmi
-array.cmo : array.cmi
-array.cmx : array.cmi
arrayLabels.cmo : array.cmi arrayLabels.cmi
arrayLabels.cmx : array.cmx arrayLabels.cmi
+array.cmo : array.cmi
+array.cmx : array.cmi
buffer.cmo : sys.cmi string.cmi bytes.cmi buffer.cmi
buffer.cmx : sys.cmx string.cmx bytes.cmx buffer.cmi
-bytes.cmo : pervasives.cmi list.cmi char.cmi bytes.cmi
-bytes.cmx : pervasives.cmx list.cmx char.cmx bytes.cmi
bytesLabels.cmo : bytes.cmi bytesLabels.cmi
bytesLabels.cmx : bytes.cmx bytesLabels.cmi
+bytes.cmo : pervasives.cmi list.cmi char.cmi bytes.cmi
+bytes.cmx : pervasives.cmx list.cmx char.cmx bytes.cmi
callback.cmo : obj.cmi callback.cmi
callback.cmx : obj.cmx callback.cmi
+camlinternalFormatBasics.cmo : camlinternalFormatBasics.cmi
+camlinternalFormatBasics.cmx : camlinternalFormatBasics.cmi
camlinternalFormat.cmo : sys.cmi string.cmi char.cmi \
camlinternalFormatBasics.cmi bytes.cmi buffer.cmi camlinternalFormat.cmi
camlinternalFormat.cmx : sys.cmx string.cmx char.cmx \
camlinternalFormatBasics.cmx bytes.cmx buffer.cmx camlinternalFormat.cmi
-camlinternalFormatBasics.cmo : camlinternalFormatBasics.cmi
-camlinternalFormatBasics.cmx : camlinternalFormatBasics.cmi
camlinternalLazy.cmo : obj.cmi camlinternalLazy.cmi
camlinternalLazy.cmx : obj.cmx camlinternalLazy.cmi
camlinternalMod.cmo : obj.cmi camlinternalOO.cmi array.cmi \
@@ -111,10 +111,10 @@ lazy.cmo : obj.cmi camlinternalLazy.cmi lazy.cmi
lazy.cmx : obj.cmx camlinternalLazy.cmx lazy.cmi
lexing.cmo : sys.cmi string.cmi bytes.cmi array.cmi lexing.cmi
lexing.cmx : sys.cmx string.cmx bytes.cmx array.cmx lexing.cmi
-list.cmo : list.cmi
-list.cmx : list.cmi
listLabels.cmo : list.cmi listLabels.cmi
listLabels.cmx : list.cmx listLabels.cmi
+list.cmo : list.cmi
+list.cmx : list.cmi
map.cmo : map.cmi
map.cmx : map.cmi
marshal.cmo : bytes.cmi marshal.cmi
@@ -157,18 +157,18 @@ sort.cmo : array.cmi sort.cmi
sort.cmx : array.cmx sort.cmi
stack.cmo : list.cmi stack.cmi
stack.cmx : list.cmx stack.cmi
+std_exit.cmo :
+std_exit.cmx :
stdLabels.cmo : stringLabels.cmi listLabels.cmi bytesLabels.cmi \
arrayLabels.cmi stdLabels.cmi
stdLabels.cmx : stringLabels.cmx listLabels.cmx bytesLabels.cmx \
arrayLabels.cmx stdLabels.cmi
-std_exit.cmo :
-std_exit.cmx :
stream.cmo : string.cmi obj.cmi list.cmi lazy.cmi bytes.cmi stream.cmi
stream.cmx : string.cmx obj.cmx list.cmx lazy.cmx bytes.cmx stream.cmi
-string.cmo : pervasives.cmi list.cmi bytes.cmi string.cmi
-string.cmx : pervasives.cmx list.cmx bytes.cmx string.cmi
stringLabels.cmo : string.cmi stringLabels.cmi
stringLabels.cmx : string.cmx stringLabels.cmi
+string.cmo : pervasives.cmi list.cmi bytes.cmi string.cmi
+string.cmx : pervasives.cmx list.cmx bytes.cmx string.cmi
sys.cmo : sys.cmi
sys.cmx : sys.cmi
weak.cmo : sys.cmi obj.cmi hashtbl.cmi array.cmi weak.cmi
@@ -177,24 +177,24 @@ arg.cmo : sys.cmi string.cmi printf.cmi list.cmi buffer.cmi array.cmi \
arg.cmi
arg.p.cmx : sys.p.cmx string.p.cmx printf.p.cmx list.p.cmx buffer.p.cmx array.p.cmx \
arg.cmi
-array.cmo : array.cmi
-array.p.cmx : array.cmi
arrayLabels.cmo : array.cmi arrayLabels.cmi
arrayLabels.p.cmx : array.p.cmx arrayLabels.cmi
+array.cmo : array.cmi
+array.p.cmx : array.cmi
buffer.cmo : sys.cmi string.cmi bytes.cmi buffer.cmi
buffer.p.cmx : sys.p.cmx string.p.cmx bytes.p.cmx buffer.cmi
-bytes.cmo : pervasives.cmi list.cmi char.cmi bytes.cmi
-bytes.p.cmx : pervasives.p.cmx list.p.cmx char.p.cmx bytes.cmi
bytesLabels.cmo : bytes.cmi bytesLabels.cmi
bytesLabels.p.cmx : bytes.p.cmx bytesLabels.cmi
+bytes.cmo : pervasives.cmi list.cmi char.cmi bytes.cmi
+bytes.p.cmx : pervasives.p.cmx list.p.cmx char.p.cmx bytes.cmi
callback.cmo : obj.cmi callback.cmi
callback.p.cmx : obj.p.cmx callback.cmi
+camlinternalFormatBasics.cmo : camlinternalFormatBasics.cmi
+camlinternalFormatBasics.p.cmx : camlinternalFormatBasics.cmi
camlinternalFormat.cmo : sys.cmi string.cmi char.cmi \
camlinternalFormatBasics.cmi bytes.cmi buffer.cmi camlinternalFormat.cmi
camlinternalFormat.p.cmx : sys.p.cmx string.p.cmx char.p.cmx \
camlinternalFormatBasics.p.cmx bytes.p.cmx buffer.p.cmx camlinternalFormat.cmi
-camlinternalFormatBasics.cmo : camlinternalFormatBasics.cmi
-camlinternalFormatBasics.p.cmx : camlinternalFormatBasics.cmi
camlinternalLazy.cmo : obj.cmi camlinternalLazy.cmi
camlinternalLazy.p.cmx : obj.p.cmx camlinternalLazy.cmi
camlinternalMod.cmo : obj.cmi camlinternalOO.cmi array.cmi \
@@ -237,10 +237,10 @@ lazy.cmo : obj.cmi camlinternalLazy.cmi lazy.cmi
lazy.p.cmx : obj.p.cmx camlinternalLazy.p.cmx lazy.cmi
lexing.cmo : sys.cmi string.cmi bytes.cmi array.cmi lexing.cmi
lexing.p.cmx : sys.p.cmx string.p.cmx bytes.p.cmx array.p.cmx lexing.cmi
-list.cmo : list.cmi
-list.p.cmx : list.cmi
listLabels.cmo : list.cmi listLabels.cmi
listLabels.p.cmx : list.p.cmx listLabels.cmi
+list.cmo : list.cmi
+list.p.cmx : list.cmi
map.cmo : map.cmi
map.p.cmx : map.cmi
marshal.cmo : bytes.cmi marshal.cmi
@@ -283,18 +283,18 @@ sort.cmo : array.cmi sort.cmi
sort.p.cmx : array.p.cmx sort.cmi
stack.cmo : list.cmi stack.cmi
stack.p.cmx : list.p.cmx stack.cmi
+std_exit.cmo :
+std_exit.p.cmx :
stdLabels.cmo : stringLabels.cmi listLabels.cmi bytesLabels.cmi \
arrayLabels.cmi stdLabels.cmi
stdLabels.p.cmx : stringLabels.p.cmx listLabels.p.cmx bytesLabels.p.cmx \
arrayLabels.p.cmx stdLabels.cmi
-std_exit.cmo :
-std_exit.p.cmx :
stream.cmo : string.cmi obj.cmi list.cmi lazy.cmi bytes.cmi stream.cmi
stream.p.cmx : string.p.cmx obj.p.cmx list.p.cmx lazy.p.cmx bytes.p.cmx stream.cmi
-string.cmo : pervasives.cmi list.cmi bytes.cmi string.cmi
-string.p.cmx : pervasives.p.cmx list.p.cmx bytes.p.cmx string.cmi
stringLabels.cmo : string.cmi stringLabels.cmi
stringLabels.p.cmx : string.p.cmx stringLabels.cmi
+string.cmo : pervasives.cmi list.cmi bytes.cmi string.cmi
+string.p.cmx : pervasives.p.cmx list.p.cmx bytes.p.cmx string.cmi
sys.cmo : sys.cmi
sys.p.cmx : sys.cmi
weak.cmo : sys.cmi obj.cmi hashtbl.cmi array.cmi weak.cmi
diff --git a/testsuite/tests/regression/pr3612/Makefile b/testsuite/tests/regression/pr3612/Makefile
new file mode 100644
index 0000000000..032420d278
--- /dev/null
+++ b/testsuite/tests/regression/pr3612/Makefile
@@ -0,0 +1,18 @@
+#########################################################################
+# #
+# OCaml #
+# #
+# Pierre Chambart, OCamlPro #
+# #
+# Copyright 2014 Institut National de Recherche en Informatique et #
+# en Automatique. All rights reserved. This file is distributed #
+# under the terms of the Q Public License version 1.0. #
+# #
+#########################################################################
+
+MAIN_MODULE=pr3612
+C_FILES=custom_finalize
+
+BASEDIR=../../..
+include $(BASEDIR)/makefiles/Makefile.one
+include $(BASEDIR)/makefiles/Makefile.common
diff --git a/testsuite/tests/regression/pr3612/custom_finalize.c b/testsuite/tests/regression/pr3612/custom_finalize.c
new file mode 100644
index 0000000000..ad117409a9
--- /dev/null
+++ b/testsuite/tests/regression/pr3612/custom_finalize.c
@@ -0,0 +1,62 @@
+/***********************************************************************/
+/* */
+/* OCaml */
+/* */
+/* Pierre Chambart, OCamlPro */
+/* */
+/* Copyright 2014 Institut National de Recherche en Informatique et */
+/* en Automatique. All rights reserved. This file is distributed */
+/* under the terms of the Q Public License version 1.0. */
+/* */
+/***********************************************************************/
+
+#include <caml/mlvalues.h>
+#include <caml/custom.h>
+
+static int free_counter = 0;
+static int alloc_counter = 0;
+
+static void caml_test_finalize(value v)
+{
+ free_counter++;
+}
+
+static void caml_test_serialize(value v,
+ uintnat * wsize_32,
+ uintnat * wsize_64)
+{
+ *wsize_32 = 0;
+ *wsize_64 = 0;
+}
+
+uintnat caml_test_deserialize(void * dst)
+{
+ alloc_counter++;
+ return 0;
+}
+
+static struct custom_operations caml_test_ops = {
+ "_test",
+ caml_test_finalize,
+ custom_compare_default,
+ custom_hash_default,
+ caml_test_serialize,
+ caml_test_deserialize,
+ custom_compare_ext_default
+};
+
+value caml_test_pr3612_alloc(value unit)
+{
+ return caml_alloc_custom(&caml_test_ops, 0, 0, 1);
+}
+
+value caml_test_pr3612_counter(value unit)
+{
+ return Val_int(alloc_counter-free_counter);
+}
+
+CAMLprim value caml_test_pr3612_init(value unit)
+{
+ caml_register_custom_operations(&caml_test_ops);
+ return Val_unit;
+}
diff --git a/testsuite/tests/regression/pr3612/pr3612.ml b/testsuite/tests/regression/pr3612/pr3612.ml
new file mode 100644
index 0000000000..8369a59178
--- /dev/null
+++ b/testsuite/tests/regression/pr3612/pr3612.ml
@@ -0,0 +1,32 @@
+(***********************************************************************)
+(* *)
+(* OCaml *)
+(* *)
+(* Pierre Chambart, OCamlPro *)
+(* *)
+(* Copyright 2014 Institut National de Recherche en Informatique et *)
+(* en Automatique. All rights reserved. This file is distributed *)
+(* under the terms of the Q Public License version 1.0. *)
+(* *)
+(***********************************************************************)
+
+type t
+
+external test_alloc : unit -> t = "caml_test_pr3612_alloc"
+external get_counter : unit -> int = "caml_test_pr3612_counter"
+(* The number of deserialized blocs minus the number of freed blocs *)
+
+external init : unit -> unit = "caml_test_pr3612_init"
+
+let test s =
+ for i = 0 to 1_000_000 do
+ ignore (Marshal.from_string s 0)
+ done
+
+let () =
+ init ();
+ let s = Marshal.to_string (test_alloc ()) [] in
+ test s;
+ Gc.full_major ();
+ print_int (get_counter ());
+ print_newline ()
diff --git a/testsuite/tests/regression/pr3612/pr3612.reference b/testsuite/tests/regression/pr3612/pr3612.reference
new file mode 100644
index 0000000000..3a2e3f4984
--- /dev/null
+++ b/testsuite/tests/regression/pr3612/pr3612.reference
@@ -0,0 +1 @@
+-1
diff --git a/testsuite/tests/typing-recordarg/Makefile b/testsuite/tests/typing-recordarg/Makefile
index 1834e83ab7..c9433b2ecb 100644
--- a/testsuite/tests/typing-recordarg/Makefile
+++ b/testsuite/tests/typing-recordarg/Makefile
@@ -10,5 +10,6 @@
# #
#########################################################################
+BASEDIR=../..
include $(BASEDIR)/makefiles/Makefile.toplevel
include $(BASEDIR)/makefiles/Makefile.common
diff --git a/tools/.depend b/tools/.depend
index 860d190d5f..b3f23fba6f 100644
--- a/tools/.depend
+++ b/tools/.depend
@@ -36,8 +36,6 @@ 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 : ../asmcomp/printclambda.cmi ../utils/misc.cmi \
../utils/config.cmi ../asmcomp/cmx_format.cmi ../typing/cmt_format.cmi \
../bytecomp/cmo_format.cmi ../typing/cmi_format.cmi \
@@ -58,10 +56,10 @@ ocamldep.cmx : ../driver/pparse.cmx ../parsing/parsetree.cmi \
../parsing/parser.cmx ../parsing/parse.cmx ../utils/misc.cmx \
../parsing/longident.cmx ../parsing/location.cmx ../parsing/lexer.cmx \
depend.cmx ../utils/config.cmx ../driver/compenv.cmx ../utils/clflags.cmx
-ocamlmklib.cmo : ocamlmklibconfig.cmo
-ocamlmklib.cmx : ocamlmklibconfig.cmx
ocamlmklibconfig.cmo :
ocamlmklibconfig.cmx :
+ocamlmklib.cmo : ocamlmklibconfig.cmo
+ocamlmklib.cmx : ocamlmklibconfig.cmx
ocamlmktop.cmo : ../utils/ccomp.cmi
ocamlmktop.cmx : ../utils/ccomp.cmx
ocamloptp.cmo : ../driver/main_args.cmi
diff --git a/tools/ci-build b/tools/ci-build
index c4466ce70a..31a2540351 100755
--- a/tools/ci-build
+++ b/tools/ci-build
@@ -28,6 +28,10 @@ error () {
exit 3
}
+quote1 () {
+ printf "'%s'" "`printf %s "$1" | sed -e "s/'/'\\\\\\\\''/g"`";
+}
+
#########################################################################
# be verbose
set -x
@@ -81,8 +85,12 @@ case "$arch" in
bsd)
make=gmake
;;
- macos) ;;
- linux) ;;
+ macos)
+ workdir=.
+ ;;
+ linux)
+ workdir=.
+ ;;
cygwin)
workdir="$HOME/jenkins-workspace/$branch"
docheckout=true
@@ -117,6 +125,7 @@ esac
#########################################################################
# Go to the right directory
+pwd
cd "$workdir"
#########################################################################
@@ -126,7 +135,7 @@ cd "$workdir"
confoptions=""
while [ $# -gt 0 ]; do
case $1 in
- -conf) confoptions="$confoptions $2"; shift 2;;
+ -conf) confoptions="$confoptions `quote1 "$2"`"; shift 2;;
-patch1) patch -f -p1 <"$2"; shift 2;;
*) error "unknown option $1";;
esac
@@ -145,7 +154,7 @@ if $docheckout; then
fi
case $nt in
- "") ./configure -prefix "$instdir" $confoptions;;
+ "") eval "./configure -prefix '$instdir' $confoptions";;
.nt)
cp config/m-nt.h config/m.h
cp config/s-nt.h config/s.h
diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml
index 26ced6c567..74724576db 100644
--- a/tools/ocamlcp.ml
+++ b/tools/ocamlcp.ml
@@ -100,6 +100,7 @@ module Options = Main_args.Make_bytecomp_options (struct
let _w = option_with_arg "-w"
let _warn_error = option_with_arg "-warn-error"
let _warn_help = option "-warn-help"
+ let _color s = option_with_arg "-color" s
let _where = option "-where"
let _nopervasives = option "-nopervasives"
let _dsource = option "-dsource"
diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml
index 0206846547..c57521d22f 100644
--- a/tools/ocamldep.ml
+++ b/tools/ocamldep.ml
@@ -440,14 +440,19 @@ let sort_files_by_dependencies files =
if !worklist <> [] then begin
Format.fprintf Format.err_formatter
"@[Warning: cycle in dependencies. End of list is not sorted.@]@.";
- Hashtbl.iter (fun _ (file, deps) ->
+ let sorted_deps =
+ let li = ref [] in
+ Hashtbl.iter (fun _ file_deps -> li := file_deps :: !li) h;
+ List.sort (fun (file1, _) (file2, _) -> String.compare file1 file2) !li
+ in
+ List.iter (fun (file, deps) ->
Format.fprintf Format.err_formatter "\t@[%s: " file;
List.iter (fun (modname, kind) ->
Format.fprintf Format.err_formatter "%s.%s " modname
(if kind=ML then "ml" else "mli");
) !deps;
Format.fprintf Format.err_formatter "@]@.";
- Printf.printf "%s " file) h;
+ Printf.printf "%s " file) sorted_deps;
end;
Printf.printf "\n%!";
()
diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml
index fd15fe5968..6daaa252ab 100644
--- a/tools/ocamloptp.ml
+++ b/tools/ocamloptp.ml
@@ -100,6 +100,7 @@ module Options = Main_args.Make_optcomp_options (struct
let _w = option_with_arg "-w"
let _warn_error = option_with_arg "-warn-error"
let _warn_help = option "-warn-help"
+ let _color s = option_with_arg "-color" s
let _where = option "-where"
let _nopervasives = option "-nopervasives"
diff --git a/utils/clflags.ml b/utils/clflags.ml
index 4d2010af77..0e6dc345ad 100644
--- a/utils/clflags.ml
+++ b/utils/clflags.ml
@@ -117,3 +117,11 @@ let runtime_variant = ref "";; (* -runtime-variant *)
let keep_docs = ref false (* -keep-docs *)
let keep_locs = ref false (* -keep-locs *)
let unsafe_string = ref true;; (* -safe-string / -unsafe-string *)
+
+type color_setting = Auto | Always | Never
+let parse_color_setting = function
+ | "auto" -> Some Auto
+ | "always" -> Some Always
+ | "never" -> Some Never
+ | _ -> None
+let color = ref Auto ;; (* -color *)
diff --git a/utils/clflags.mli b/utils/clflags.mli
index e62dc8b848..4b6d4786ba 100644
--- a/utils/clflags.mli
+++ b/utils/clflags.mli
@@ -98,3 +98,7 @@ val keep_docs : bool ref
val keep_locs : bool ref
val unsafe_string : bool ref
val opaque : bool ref
+
+type color_setting = Auto | Always | Never
+val parse_color_setting : string -> color_setting option
+val color : color_setting ref
diff --git a/utils/misc.ml b/utils/misc.ml
index 82328ef26a..cbbd472fa4 100644
--- a/utils/misc.ml
+++ b/utils/misc.ml
@@ -391,3 +391,123 @@ let cut_at s c =
module StringSet = Set.Make(struct type t = string let compare = compare end)
module StringMap = Map.Make(struct type t = string let compare = compare end)
+
+(* Color handling *)
+module Color = struct
+ (* use ANSI color codes, see https://en.wikipedia.org/wiki/ANSI_escape_code *)
+ type color =
+ | Black
+ | Red
+ | Green
+ | Yellow
+ | Blue
+ | Magenta
+ | Cyan
+ | White
+ ;;
+
+ type style =
+ | FG of color (* foreground *)
+ | BG of color (* background *)
+ | Bold
+ | Reset
+
+ let ansi_of_color = function
+ | Black -> "0"
+ | Red -> "1"
+ | Green -> "2"
+ | Yellow -> "3"
+ | Blue -> "4"
+ | Magenta -> "5"
+ | Cyan -> "6"
+ | White -> "7"
+
+ let code_of_style = function
+ | FG c -> "3" ^ ansi_of_color c
+ | BG c -> "4" ^ ansi_of_color c
+ | Bold -> "1"
+ | Reset -> "0"
+
+ let ansi_of_style_l l =
+ let s = match l with
+ | [] -> code_of_style Reset
+ | [s] -> code_of_style s
+ | _ -> String.concat ";" (List.map code_of_style l)
+ in
+ "\x1b[" ^ s ^ "m"
+
+ type styles = {
+ error: style list;
+ warning: style list;
+ loc: style list;
+ }
+
+ let default_styles = {
+ warning = [Bold; FG Magenta];
+ error = [Bold; FG Red];
+ loc = [Bold];
+ }
+
+ let cur_styles = ref default_styles
+ let get_styles () = !cur_styles
+ let set_styles s = cur_styles := s
+
+ (* map a tag to a style, if the tag is known.
+ @raise Not_found otherwise *)
+ let style_of_tag s = match s with
+ | "error" -> (!cur_styles).error
+ | "warning" -> (!cur_styles).warning
+ | "loc" -> (!cur_styles).loc
+ | _ -> raise Not_found
+
+ let color_enabled = ref true
+
+ (* either prints the tag of [s] or delegate to [or_else] *)
+ let mark_open_tag ~or_else s =
+ try
+ let style = style_of_tag s in
+ if !color_enabled then ansi_of_style_l style else ""
+ with Not_found -> or_else s
+
+ let mark_close_tag ~or_else s =
+ try
+ let _ = style_of_tag s in
+ if !color_enabled then ansi_of_style_l [Reset] else ""
+ with Not_found -> or_else s
+
+ (* add color handling to formatter [ppf] *)
+ let set_color_tag_handling ppf =
+ let open Format in
+ let functions = pp_get_formatter_tag_functions ppf () in
+ let functions' = {functions with
+ mark_open_tag=(mark_open_tag ~or_else:functions.mark_open_tag);
+ mark_close_tag=(mark_close_tag ~or_else:functions.mark_close_tag);
+ } in
+ pp_set_mark_tags ppf true; (* enable tags *)
+ pp_set_formatter_tag_functions ppf functions'
+
+ external isatty : out_channel -> bool = "caml_sys_isatty"
+
+ (* reasonable heuristic on whether colors should be enabled *)
+ let should_enable_color () =
+ let term = try Sys.getenv "TERM" with Not_found -> "" in
+ term <> "dumb"
+ && term <> ""
+ && isatty stderr
+
+ let setup =
+ let first = ref true in (* initialize only once *)
+ let formatter_l = [Format.std_formatter; Format.err_formatter; Format.str_formatter] in
+ fun o ->
+ if !first then (
+ first := false;
+ Format.set_mark_tags true;
+ List.iter set_color_tag_handling formatter_l;
+ color_enabled := (match o with
+ | Clflags.Always -> true
+ | Clflags.Auto -> should_enable_color ()
+ | Clflags.Never -> false
+ )
+ );
+ ()
+end
diff --git a/utils/misc.mli b/utils/misc.mli
index 1ff1d2cccf..75fc500147 100644
--- a/utils/misc.mli
+++ b/utils/misc.mli
@@ -193,3 +193,44 @@ module StringSet: Set.S with type elt = string
module StringMap: Map.S with type key = string
(* TODO: replace all custom instantiations of StringSet/StringMap in various
compiler modules with this one. *)
+
+(* Color handling *)
+module Color : sig
+ type color =
+ | Black
+ | Red
+ | Green
+ | Yellow
+ | Blue
+ | Magenta
+ | Cyan
+ | White
+ ;;
+
+ type style =
+ | FG of color (* foreground *)
+ | BG of color (* background *)
+ | Bold
+ | Reset
+
+ val ansi_of_style_l : style list -> string
+ (* ANSI escape sequence for the given style *)
+
+ type styles = {
+ error: style list;
+ warning: style list;
+ loc: style list;
+ }
+
+ val default_styles: styles
+ val get_styles: unit -> styles
+ val set_styles: styles -> unit
+
+ val setup : Clflags.color_setting -> unit
+ (* [setup opt] will enable or disable color handling on standard formatters
+ according to the value of color setting [opt].
+ Only the first call to this function has an effect. *)
+
+ val set_color_tag_handling : Format.formatter -> unit
+ (* adds functions to support color tags to the given formatter. *)
+end