summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Maranget <luc.maranget@inria.fr>2009-06-19 07:11:12 +0000
committerLuc Maranget <luc.maranget@inria.fr>2009-06-19 07:11:12 +0000
commit924e832b687e914f4173bb52ec39806b1b6192a8 (patch)
tree3c3691a107eb794205a9bec4753b6b9a73abdc25
parent4775d5bfba9a06e657fea8ef4bffe335ee49c167 (diff)
downloadocaml-924e832b687e914f4173bb52ec39806b1b6192a8.tar.gz
release311
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/jo311@9301 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--.depend48
-rw-r--r--Changes55
-rw-r--r--Changes_JoCaml3
-rw-r--r--Makefile10
-rw-r--r--VERSION2
-rw-r--r--_tags3
-rw-r--r--asmcomp/amd64/emit.mlp11
-rw-r--r--asmcomp/amd64/proc.ml4
-rw-r--r--asmcomp/cmmgen.ml13
-rw-r--r--asmcomp/emitaux.ml13
-rw-r--r--asmcomp/emitaux.mli2
-rw-r--r--asmcomp/i386/emit.mlp11
-rw-r--r--asmcomp/i386/emit_nt.mlp2
-rw-r--r--asmcomp/power/emit.mlp4
-rw-r--r--asmrun/signals_osdep.h32
-rw-r--r--boot/.cvsignore1
-rwxr-xr-xboot/ocamlcbin1110632 -> 1114038 bytes
-rwxr-xr-xboot/ocamldepbin293222 -> 294174 bytes
-rwxr-xr-xboot/ocamllexbin164544 -> 165484 bytes
-rwxr-xr-xbuild/fastworld.sh2
-rwxr-xr-xbuild/install.sh226
-rw-r--r--build/otherlibs-targets.sh3
-rwxr-xr-xbuild/world.sh2
-rw-r--r--bytecomp/bytegen.ml2
-rw-r--r--bytecomp/bytepackager.ml26
-rw-r--r--bytecomp/dll.ml9
-rw-r--r--bytecomp/instruct.ml1
-rw-r--r--bytecomp/instruct.mli1
-rw-r--r--byterun/Makefile18
-rwxr-xr-xbyterun/Makefile.common2
-rw-r--r--byterun/finalise.c2
-rw-r--r--byterun/globroots.c22
-rw-r--r--byterun/int64_emul.h3
-rw-r--r--byterun/int64_native.h3
-rw-r--r--byterun/interp.c2
-rw-r--r--byterun/ints.c45
-rwxr-xr-xconfigure26
-rw-r--r--driver/main.ml8
-rw-r--r--ocamldoc/.depend28
-rw-r--r--ocamldoc/Makefile31
-rw-r--r--ocamldoc/Makefile.nt17
-rw-r--r--ocamldoc/odoc.ml18
-rw-r--r--ocamldoc/odoc_args.ml8
-rw-r--r--ocamldoc/odoc_args.mli4
-rw-r--r--ocamldoc/odoc_messages.ml5
-rw-r--r--ocamldoc/odoc_name.ml13
-rw-r--r--ocamldoc/odoc_opt.ml82
-rw-r--r--otherlibs/systhreads/Tests/Makefile2
-rw-r--r--otherlibs/systhreads/posix.c36
-rw-r--r--otherlibs/threads/Tests/Makefile2
-rw-r--r--otherlibs/unix/unix.mli3
-rw-r--r--stdlib/format.ml11
-rw-r--r--stdlib/map.mli4
-rw-r--r--stdlib/parsing.ml12
-rw-r--r--stdlib/pervasives.mli56
-rw-r--r--stdlib/printf.ml45
-rw-r--r--stdlib/scanf.ml22
-rw-r--r--tools/Makefile.shared25
-rw-r--r--typing/ctype.ml53
-rw-r--r--typing/ctype.mli3
-rw-r--r--typing/env.ml24
-rw-r--r--typing/includeclass.ml6
-rw-r--r--typing/mtype.ml12
-rw-r--r--typing/parmatch.ml13
-rw-r--r--typing/subst.ml9
-rw-r--r--typing/subst.mli4
-rw-r--r--typing/typeclass.ml8
-rw-r--r--typing/typecore.ml28
-rw-r--r--typing/typedecl.ml103
-rw-r--r--typing/typedecl.mli1
-rw-r--r--typing/typetexp.ml18
-rw-r--r--utils/config.mlbuild18
-rw-r--r--utils/config.mlp14
-rw-r--r--utils/tbl.ml4
-rw-r--r--utils/tbl.mli1
-rw-r--r--yacc/reader.c7
76 files changed, 811 insertions, 556 deletions
diff --git a/.depend b/.depend
index 2d6ec4dd22..6880258967 100644
--- a/.depend
+++ b/.depend
@@ -180,13 +180,15 @@ typing/oprint.cmo: typing/outcometree.cmi parsing/asttypes.cmi \
typing/oprint.cmx: typing/outcometree.cmi parsing/asttypes.cmi \
typing/oprint.cmi
typing/parmatch.cmo: utils/warnings.cmi typing/types.cmi typing/typedtree.cmi \
- typing/predef.cmi typing/path.cmi utils/misc.cmi parsing/location.cmi \
- typing/ident.cmi typing/env.cmi typing/datarepr.cmi typing/ctype.cmi \
- typing/btype.cmi parsing/asttypes.cmi typing/parmatch.cmi
+ typing/subst.cmi typing/predef.cmi typing/path.cmi utils/misc.cmi \
+ parsing/location.cmi typing/ident.cmi typing/env.cmi typing/datarepr.cmi \
+ typing/ctype.cmi typing/btype.cmi parsing/asttypes.cmi \
+ typing/parmatch.cmi
typing/parmatch.cmx: utils/warnings.cmx typing/types.cmx typing/typedtree.cmx \
- typing/predef.cmx typing/path.cmx utils/misc.cmx parsing/location.cmx \
- typing/ident.cmx typing/env.cmx typing/datarepr.cmx typing/ctype.cmx \
- typing/btype.cmx parsing/asttypes.cmi typing/parmatch.cmi
+ typing/subst.cmx typing/predef.cmx typing/path.cmx utils/misc.cmx \
+ parsing/location.cmx typing/ident.cmx typing/env.cmx typing/datarepr.cmx \
+ typing/ctype.cmx typing/btype.cmx parsing/asttypes.cmi \
+ typing/parmatch.cmi
typing/path.cmo: typing/ident.cmi typing/path.cmi
typing/path.cmx: typing/ident.cmx typing/path.cmi
typing/predef.cmo: typing/types.cmi typing/path.cmi typing/ident.cmi \
@@ -311,7 +313,7 @@ bytecomp/bytesections.cmi:
bytecomp/cmo_format.cmi: bytecomp/lambda.cmi typing/ident.cmi
bytecomp/dll.cmi:
bytecomp/emitcode.cmi: bytecomp/instruct.cmi bytecomp/cmo_format.cmi
-bytecomp/instruct.cmi: typing/types.cmi parsing/location.cmi \
+bytecomp/instruct.cmi: typing/types.cmi typing/subst.cmi parsing/location.cmi \
bytecomp/lambda.cmi typing/ident.cmi typing/env.cmi
bytecomp/lambda.cmi: typing/types.cmi typing/primitive.cmi typing/path.cmi \
parsing/location.cmi typing/ident.cmi typing/env.cmi parsing/asttypes.cmi
@@ -334,14 +336,14 @@ bytecomp/transljoin.cmi: typing/typedtree.cmi typing/primitive.cmi \
bytecomp/translmod.cmi: typing/typedtree.cmi typing/primitive.cmi \
parsing/location.cmi bytecomp/lambda.cmi typing/ident.cmi
bytecomp/translobj.cmi: bytecomp/lambda.cmi typing/ident.cmi typing/env.cmi
-bytecomp/typeopt.cmi: typing/types.cmi typing/typedtree.cmi typing/path.cmi \
- bytecomp/lambda.cmi typing/env.cmi
-bytecomp/bytegen.cmo: typing/types.cmi bytecomp/switch.cmi typing/stypes.cmi \
- typing/primitive.cmi utils/misc.cmi bytecomp/lambda.cmi \
+bytecomp/typeopt.cmi: typing/typedtree.cmi typing/path.cmi \
+ bytecomp/lambda.cmi
+bytecomp/bytegen.cmo: typing/types.cmi bytecomp/switch.cmi typing/subst.cmi \
+ typing/stypes.cmi typing/primitive.cmi utils/misc.cmi bytecomp/lambda.cmi \
bytecomp/instruct.cmi typing/ident.cmi utils/config.cmi \
parsing/asttypes.cmi typing/annot.cmi bytecomp/bytegen.cmi
-bytecomp/bytegen.cmx: typing/types.cmx bytecomp/switch.cmx typing/stypes.cmx \
- typing/primitive.cmx utils/misc.cmx bytecomp/lambda.cmx \
+bytecomp/bytegen.cmx: typing/types.cmx bytecomp/switch.cmx typing/subst.cmx \
+ typing/stypes.cmx typing/primitive.cmx utils/misc.cmx bytecomp/lambda.cmx \
bytecomp/instruct.cmx typing/ident.cmx utils/config.cmx \
parsing/asttypes.cmi typing/annot.cmi bytecomp/bytegen.cmi
bytecomp/bytelibrarian.cmo: utils/misc.cmi utils/config.cmi \
@@ -361,15 +363,15 @@ bytecomp/bytelink.cmx: bytecomp/symtable.cmx bytecomp/opcodes.cmx \
utils/clflags.cmx utils/ccomp.cmx bytecomp/bytesections.cmx \
bytecomp/bytelink.cmi
bytecomp/bytepackager.cmo: typing/typemod.cmi bytecomp/translmod.cmi \
- utils/misc.cmi bytecomp/instruct.cmi typing/ident.cmi typing/env.cmi \
- bytecomp/emitcode.cmi utils/config.cmi bytecomp/cmo_format.cmi \
- utils/clflags.cmi bytecomp/bytelink.cmi bytecomp/bytegen.cmi \
- bytecomp/bytepackager.cmi
+ typing/subst.cmi typing/path.cmi utils/misc.cmi bytecomp/instruct.cmi \
+ typing/ident.cmi typing/env.cmi bytecomp/emitcode.cmi utils/config.cmi \
+ bytecomp/cmo_format.cmi utils/clflags.cmi bytecomp/bytelink.cmi \
+ bytecomp/bytegen.cmi bytecomp/bytepackager.cmi
bytecomp/bytepackager.cmx: typing/typemod.cmx bytecomp/translmod.cmx \
- utils/misc.cmx bytecomp/instruct.cmx typing/ident.cmx typing/env.cmx \
- bytecomp/emitcode.cmx utils/config.cmx bytecomp/cmo_format.cmi \
- utils/clflags.cmx bytecomp/bytelink.cmx bytecomp/bytegen.cmx \
- bytecomp/bytepackager.cmi
+ typing/subst.cmx typing/path.cmx utils/misc.cmx bytecomp/instruct.cmx \
+ typing/ident.cmx typing/env.cmx bytecomp/emitcode.cmx utils/config.cmx \
+ bytecomp/cmo_format.cmi utils/clflags.cmx bytecomp/bytelink.cmx \
+ bytecomp/bytegen.cmx bytecomp/bytepackager.cmi
bytecomp/bytesections.cmo: utils/config.cmi bytecomp/bytesections.cmi
bytecomp/bytesections.cmx: utils/config.cmx bytecomp/bytesections.cmi
bytecomp/dll.cmo: utils/misc.cmi utils/config.cmi bytecomp/dll.cmi
@@ -384,9 +386,9 @@ bytecomp/emitcode.cmx: bytecomp/translmod.cmx typing/primitive.cmx \
bytecomp/instruct.cmx typing/env.cmx utils/config.cmx \
bytecomp/cmo_format.cmi utils/clflags.cmx typing/btype.cmx \
parsing/asttypes.cmi bytecomp/emitcode.cmi
-bytecomp/instruct.cmo: typing/types.cmi parsing/location.cmi \
+bytecomp/instruct.cmo: typing/types.cmi typing/subst.cmi parsing/location.cmi \
bytecomp/lambda.cmi typing/ident.cmi typing/env.cmi bytecomp/instruct.cmi
-bytecomp/instruct.cmx: typing/types.cmx parsing/location.cmx \
+bytecomp/instruct.cmx: typing/types.cmx typing/subst.cmx parsing/location.cmx \
bytecomp/lambda.cmx typing/ident.cmx typing/env.cmx bytecomp/instruct.cmi
bytecomp/lambda.cmo: typing/types.cmi typing/primitive.cmi typing/path.cmi \
utils/misc.cmi parsing/location.cmi typing/ident.cmi typing/env.cmi \
diff --git a/Changes b/Changes
index 2f63ef7890..d23a01c8f1 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,58 @@
+Objective Caml 3.11.1:
+----------------------
+
+Bug fixes:
+- PR#4095: ocamldebug: strange behaviour of control-C
+- PR#4403: ocamldebug: improved handling of packed modules
+- PR#4650: Str.regexp_case_fold mis-handling complemented character sets [^a]
+- PR#4660: Scanf.format_from_string: handling of double quote
+- PR#4666: Unix.exec* failure in multithread programs under MacOS X and FreeBSD
+- PR#4667: debugger out of sync with dynlink changes
+- PR#4678: random "out of memory" error with systhreads
+- PR#4690: issue with dynamic loading under MacOS 10.5
+- PR#4692: wrong error message with options -i and -pack passed to ocamlc
+- PR#4699: in otherlibs/dbm, fixed construction of dlldbm.so.
+- PR#4704: error in caml_modify_generational_global_root()
+- PR#4708: (ocamldoc) improved printing of infix identifiers such as "lor".
+- PR#4722: typo in configure script
+- PR#4729: documented the fact that PF_INET6 is not available on all platforms
+- PR#4730: incorrect typing involving abbreviation "type 'a t = 'a"
+- PR#4731: incorrect quoting of arguments passed to the assembler on x86-64
+- PR#4735: Unix.LargeFile.fstat cannot report size over 32bits on Win32
+- PR#4740: guard against possible processor error in
+ {Int32,Int64,Nativeint}.{div,rem}
+- PR#4745: type inference wrongly produced non-generalizable type variables.
+- PR#4749: better pipe size for win32unix
+- PR#4756: printf: no error reported for wrong format '%_s'
+- PR#4758: scanf: handling of \<newline> by format '%S'
+- PR#4766: incorrect simplification of some type abbreviations.
+- PR#4768: printf: %F does not respect width and precision specifications
+- PR#4769: Format.bprintf fails to flush
+- PR#4775: fatal error Ctype.Unify during module type-checking (temporary fix)
+- PR#4776: bad interaction between exceptions and classes
+- PR#4780: labltk build problem under Windows.
+- PR#4790: under Windows, map ERROR_NO_DATA Win32 error to EPIPE Unix error.
+- PR#4792: bug in Big_int.big_int_of_int64 on 32-bit platforms.
+- PR#4796: ocamlyacc: missing NUL termination of string
+- PR#4804: bug in Big_int.int64_of_big_int on 32-bit platforms.
+- PR#4805: improving compatibility with the clang C compiler
+- PR#4809: issue with Unix.create_process under Win32
+- PR#4814: ocamlbrowser: crash when editing comments
+- PR#4816: module abbreviations remove 'private' type restrictions
+- PR#4817: Object type gives error "Unbound type parameter .."
+- Module Parsing: improved computation of locations when an ocamlyacc rule
+ starts with an empty nonterminal
+- Type-checker: fixed wrong variance computation for private types
+- x86-32 code generator, MSVC port: wrong "fld" instruction generated.
+- ocamlbuild: incorrectly using the compile-time value of $OCAMLLIB
+- Makefile problem when configured with -no-shared-libs
+- ocamldoc: use dynamic loading in native code
+
+Other changes:
+- Improved wording of various error messages
+ (contributed by Jonathan Davies, Citrix).
+- Support for 64-bit mode in Solaris/x86 (PR#4670).
+
Objective Caml 3.11.0:
----------------------
diff --git a/Changes_JoCaml b/Changes_JoCaml
index 947a10bfd5..069f77fd10 100644
--- a/Changes_JoCaml
+++ b/Changes_JoCaml
@@ -1,3 +1,6 @@
+JoCaml 3.11.1
+
+- Corrected bug in installation (all tools now installed with 'jo' prefix)
JoCaml 3.11.0:
-------------
diff --git a/Makefile b/Makefile
index c11cfeb86e..d524bd5774 100644
--- a/Makefile
+++ b/Makefile
@@ -755,14 +755,8 @@ clean::
$(CAMLOPT) $(COMPFLAGS) -c $<
partialclean::
- rm -f utils/*.cm[iox] utils/*.[so] utils/*~
- rm -f parsing/*.cm[iox] parsing/*.[so] parsing/*~
- rm -f typing/*.cm[iox] typing/*.[so] typing/*~
- rm -f bytecomp/*.cm[iox] bytecomp/*.[so] bytecomp/*~
- rm -f asmcomp/*.cm[iox] asmcomp/*.[so] asmcomp/*~
- rm -f driver/*.cm[iox] driver/*.[so] driver/*~
- rm -f toplevel/*.cm[iox] toplevel/*.[so] toplevel/*~
- rm -f tools/*.cm[iox] tools/*.[so] tools/*~
+ for d in utils parsing typing bytecomp asmcomp driver toplevel tools; \
+ do rm -f $$d/*.cm[iox] $$d/*.annot $$d/*.[so] $$d/*~; done
rm -f *~
depend: beforedepend
diff --git a/VERSION b/VERSION
index ddbfa01e59..2024a5f2ea 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
-3.11.0
+3.11.1
# The version string is the first line of this file.
# It must be in the format described in stdlib/sys.mli
diff --git a/_tags b/_tags
index 47121f8615..37ba928ef4 100644
--- a/_tags
+++ b/_tags
@@ -26,8 +26,7 @@ true: use_stdlib
<ocamldoc/**>: -debug
<ocamldoc/*.ml>: ocamldoc_sources
<ocamldoc/*.ml*>: include_unix, include_str, include_dynlink
-"ocamldoc/odoc.byte": use_unix, use_str, use_dynlink
-"ocamldoc/odoc_opt.native": use_unix, use_str
+<ocamldoc/odoc.{byte,native}>: use_unix, use_str, use_dynlink
<camlp4/**/*.ml*>: camlp4boot, -warn_Alez, warn_Ale
<camlp4/Camlp4_{config,import}.ml*>: -camlp4boot
diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp
index 4cffd98101..e2a53465e5 100644
--- a/asmcomp/amd64/emit.mlp
+++ b/asmcomp/amd64/emit.mlp
@@ -668,7 +668,11 @@ let fundecl fundecl =
bound_error_call := 0;
` .text\n`;
emit_align 16;
- ` .globl {emit_symbol fundecl.fun_name}\n`;
+ if macosx && is_generic_function fundecl.fun_name
+ then (* PR#4690 *)
+ ` .private_extern {emit_symbol fundecl.fun_name}\n`
+ else
+ ` .globl {emit_symbol fundecl.fun_name}\n`;
`{emit_symbol fundecl.fun_name}:\n`;
if !Clflags.gprofile then emit_profile();
if frame_required() then begin
@@ -753,12 +757,13 @@ let begin_assembly() =
let lbl_begin = Compilenv.make_symbol (Some "code_begin") in
` .text\n`;
` .globl {emit_symbol lbl_begin}\n`;
- `{emit_symbol lbl_begin}:\n`
+ `{emit_symbol lbl_begin}:\n`;
+ if macosx then ` nop\n` (* PR#4690 *)
let end_assembly() =
let lbl_end = Compilenv.make_symbol (Some "code_end") in
` .text\n`;
- if macosx then ` NOP\n`; (* suppress "ld warning: atom sorting error" *)
+ if macosx then ` nop\n`; (* suppress "ld warning: atom sorting error" *)
` .globl {emit_symbol lbl_end}\n`;
`{emit_symbol lbl_end}:\n`;
` .data\n`;
diff --git a/asmcomp/amd64/proc.ml b/asmcomp/amd64/proc.ml
index 32d669dbbe..da2f886bbc 100644
--- a/asmcomp/amd64/proc.ml
+++ b/asmcomp/amd64/proc.ml
@@ -197,5 +197,5 @@ let contains_calls = ref false
(* Calling the assembler *)
let assemble_file infile outfile =
- Ccomp.command (Config.asm ^ " -o " ^ outfile ^ " " ^ infile)
-
+ Ccomp.command (Config.asm ^ " -o " ^
+ Filename.quote outfile ^ " " ^ Filename.quote infile)
diff --git a/asmcomp/cmmgen.ml b/asmcomp/cmmgen.ml
index 83cb1f6e39..00742dcf99 100644
--- a/asmcomp/cmmgen.ml
+++ b/asmcomp/cmmgen.ml
@@ -1943,9 +1943,8 @@ module IntSet = Set.Make(
end)
let default_apply = IntSet.add 2 (IntSet.add 3 IntSet.empty)
- (* These apply funs are always present in the main program.
- TODO: add more, and do the same for send and curry funs
- (maybe up to 10-15?). *)
+ (* These apply funs are always present in the main program because
+ the run-time system needs them (cf. asmrun/<arch>.S) . *)
let generic_functions shared units =
let (apply,send,curry) =
@@ -1955,12 +1954,8 @@ let generic_functions shared units =
List.fold_right IntSet.add ui.Compilenv.ui_send_fun send,
List.fold_right IntSet.add ui.Compilenv.ui_curry_fun curry)
(IntSet.empty,IntSet.empty,IntSet.empty)
- units
- in
- let apply =
- if shared then IntSet.diff apply default_apply
- else IntSet.union apply default_apply
- in
+ units in
+ let apply = if shared then apply else IntSet.union apply default_apply in
let accu = IntSet.fold (fun n accu -> apply_function n :: accu) apply [] in
let accu = IntSet.fold (fun n accu -> send_function n :: accu) send accu in
IntSet.fold (fun n accu -> curry_function n @ accu) curry accu
diff --git a/asmcomp/emitaux.ml b/asmcomp/emitaux.ml
index d1964d3563..e851c8187d 100644
--- a/asmcomp/emitaux.ml
+++ b/asmcomp/emitaux.ml
@@ -156,3 +156,16 @@ let emit_frames a =
List.iter emit_frame !frame_descriptors;
Hashtbl.iter emit_filename filenames;
frame_descriptors := []
+
+(* Detection of functions that can be duplicated between a DLL and
+ the main program (PR#4690) *)
+
+let isprefix s1 s2 =
+ String.length s1 <= String.length s2
+ && String.sub s2 0 (String.length s1) = s1
+
+let is_generic_function name =
+ List.exists
+ (fun p -> isprefix p name)
+ ["caml_apply"; "caml_curry"; "caml_send"; "caml_tuplify"]
+
diff --git a/asmcomp/emitaux.mli b/asmcomp/emitaux.mli
index 38e6df9607..112e276a12 100644
--- a/asmcomp/emitaux.mli
+++ b/asmcomp/emitaux.mli
@@ -45,3 +45,5 @@ type emit_frame_actions =
efa_string: string -> unit }
val emit_frames: emit_frame_actions -> unit
+
+val is_generic_function: string -> bool
diff --git a/asmcomp/i386/emit.mlp b/asmcomp/i386/emit.mlp
index 443835d20a..89d6a156d7 100644
--- a/asmcomp/i386/emit.mlp
+++ b/asmcomp/i386/emit.mlp
@@ -888,7 +888,11 @@ let fundecl fundecl =
bound_error_call := 0;
` .text\n`;
emit_align 16;
- ` .globl {emit_symbol fundecl.fun_name}\n`;
+ if macosx && is_generic_function fundecl.fun_name
+ then (* PR#4690 *)
+ ` .private_extern {emit_symbol fundecl.fun_name}\n`
+ else
+ ` .globl {emit_symbol fundecl.fun_name}\n`;
`{emit_symbol fundecl.fun_name}:\n`;
if !Clflags.gprofile then emit_profile();
let n = frame_size() - 4 in
@@ -954,12 +958,13 @@ let begin_assembly() =
let lbl_begin = Compilenv.make_symbol (Some "code_begin") in
` .text\n`;
` .globl {emit_symbol lbl_begin}\n`;
- `{emit_symbol lbl_begin}:\n`
+ `{emit_symbol lbl_begin}:\n`;
+ if macosx then ` nop\n` (* PR#4690 *)
let end_assembly() =
let lbl_end = Compilenv.make_symbol (Some "code_end") in
` .text\n`;
- if macosx then ` NOP\n`; (* suppress "ld warning: atom sorting error" *)
+ if macosx then ` nop\n`; (* suppress "ld warning: atom sorting error" *)
` .globl {emit_symbol lbl_end}\n`;
`{emit_symbol lbl_end}:\n`;
` .data\n`;
diff --git a/asmcomp/i386/emit_nt.mlp b/asmcomp/i386/emit_nt.mlp
index e4ac9d408d..a0c94e181d 100644
--- a/asmcomp/i386/emit_nt.mlp
+++ b/asmcomp/i386/emit_nt.mlp
@@ -379,7 +379,7 @@ let emit_instr i =
if is_tos src then
` fstp {emit_reg dst}\n`
else if is_tos dst then
- ` fld {emit_reg dst}\n`
+ ` fld {emit_reg src}\n`
else begin
` fld {emit_reg src}\n`;
` fstp {emit_reg dst}\n`
diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp
index d25eaa3478..4df559f684 100644
--- a/asmcomp/power/emit.mlp
+++ b/asmcomp/power/emit.mlp
@@ -835,6 +835,10 @@ let fundecl fundecl =
call_gc_label := 0;
float_literals := [];
int_literals := [];
+ if Config.system = "rhapsody" && is_generic_function fundecl.fun_name
+ then (* PR#4690 *)
+ ` .private_extern {emit_symbol fundecl.fun_name}\n`
+ else
` .globl {emit_symbol fundecl.fun_name}\n`;
begin match Config.system with
| "elf" | "bsd" ->
diff --git a/asmrun/signals_osdep.h b/asmrun/signals_osdep.h
index 3a4a8fc670..40978231fe 100644
--- a/asmrun/signals_osdep.h
+++ b/asmrun/signals_osdep.h
@@ -76,6 +76,25 @@
#define CONTEXT_SP (CONTEXT_STATE.CONTEXT_REG(rsp))
#define CONTEXT_FAULTING_ADDRESS ((char *) info->si_addr)
+/****************** AMD64, Solaris x86 */
+
+#elif defined(TARGET_amd64) && defined (SYS_solaris)
+
+ #include <ucontext.h>
+
+ #define DECLARE_SIGNAL_HANDLER(name) \
+ static void name(int sig, siginfo_t * info, ucontext_t * context)
+
+ #define SET_SIGACT(sigact,name) \
+ sigact.sa_sigaction = (void (*)(int,siginfo_t *,void *)) (name); \
+ sigact.sa_flags = SA_SIGINFO
+
+ typedef greg_t context_reg;
+ #define CONTEXT_PC (context->uc_mcontext.gregs[REG_RIP])
+ #define CONTEXT_EXCEPTION_POINTER (context->uc_mcontext.gregs[REG_R14])
+ #define CONTEXT_YOUNG_PTR (context->uc_mcontext.gregs[REG_R15])
+ #define CONTEXT_FAULTING_ADDRESS ((char *) info->si_addr)
+
/****************** I386, Linux */
#elif defined(TARGET_i386) && defined(SYS_linux_elf)
@@ -126,6 +145,19 @@
#define CONTEXT_PC (CONTEXT_STATE.CONTEXT_REG(eip))
#define CONTEXT_FAULTING_ADDRESS ((char *) info->si_addr)
+/****************** I386, Solaris x86 */
+
+#elif defined(TARGET_i386) && defined(SYS_solaris)
+
+ #define DECLARE_SIGNAL_HANDLER(name) \
+ static void name(int sig, siginfo_t * info, void * context)
+
+ #define SET_SIGACT(sigact,name) \
+ sigact.sa_sigaction = (name); \
+ sigact.sa_flags = SA_SIGINFO
+
+ #define CONTEXT_FAULTING_ADDRESS ((char *) info->si_addr)
+
/****************** MIPS, all OS */
#elif defined(TARGET_mips)
diff --git a/boot/.cvsignore b/boot/.cvsignore
index b9c6f85847..a0a2356c9a 100644
--- a/boot/.cvsignore
+++ b/boot/.cvsignore
@@ -3,3 +3,4 @@ ocamlrun
ocamlyacc
camlheader
myocamlbuild
+myocamlbuild.native
diff --git a/boot/ocamlc b/boot/ocamlc
index 4acd349caf..af762efa3b 100755
--- a/boot/ocamlc
+++ b/boot/ocamlc
Binary files differ
diff --git a/boot/ocamldep b/boot/ocamldep
index 79c5045a82..4d1adaa9f5 100755
--- a/boot/ocamldep
+++ b/boot/ocamldep
Binary files differ
diff --git a/boot/ocamllex b/boot/ocamllex
index 3320416dfd..8eb679b5df 100755
--- a/boot/ocamllex
+++ b/boot/ocamllex
Binary files differ
diff --git a/build/fastworld.sh b/build/fastworld.sh
index 325af89db1..ec14da5a7e 100755
--- a/build/fastworld.sh
+++ b/build/fastworld.sh
@@ -10,7 +10,7 @@ fi
./mkconfig.sh
./mkmyocamlbuild_config.sh
. ../config/config.sh
-if [ "x$EXE" = "x.exe" ]; then
+if [ "x$EXE" = "x.exe" -a "x$SYSTEM" != "xcygwin" ]; then
./boot-c-parts-windows.sh
else
./boot-c-parts.sh
diff --git a/build/install.sh b/build/install.sh
index 06feb41ba0..4c38740c53 100755
--- a/build/install.sh
+++ b/build/install.sh
@@ -116,6 +116,7 @@ mkdir -p $MANDIR/man$MANEXT
echo "Installing core libraries..."
installlibdir byterun/libcamlrun.$A asmrun/libasmrun.$A asmrun/libasmrunp.$A \
$LIBDIR
+installdir byterun/libcamlrun_shared$EXT_DLL $LIBDIR
PUBLIC_INCLUDES="\
alloc.h callback.h config.h custom.h fail.h intext.h \
@@ -161,96 +162,96 @@ installdir \
stdlib/stdlib.cmxa stdlib/stdlib.p.cmxa \
stdlib/camlheader \
stdlib/camlheader_ur \
- stdlib/std_exit.cm[io] \
- stdlib/arg.cmi stdlib/arg.mli \
- stdlib/array.cmi stdlib/array.mli \
- stdlib/arrayLabels.cmi stdlib/arrayLabels.mli \
- stdlib/buffer.cmi stdlib/buffer.mli \
- stdlib/callback.cmi stdlib/callback.mli \
- stdlib/camlinternalLazy.cmi stdlib/camlinternalLazy.mli \
- stdlib/camlinternalMod.cmi stdlib/camlinternalMod.mli \
- stdlib/camlinternalOO.cmi stdlib/camlinternalOO.mli \
- stdlib/char.cmi stdlib/char.mli \
- stdlib/complex.cmi stdlib/complex.mli \
- stdlib/digest.cmi stdlib/digest.mli \
- stdlib/filename.cmi stdlib/filename.mli \
- stdlib/format.cmi stdlib/format.mli \
- stdlib/gc.cmi stdlib/gc.mli \
- stdlib/genlex.cmi stdlib/genlex.mli \
- stdlib/hashtbl.cmi stdlib/hashtbl.mli \
- stdlib/int32.cmi stdlib/int32.mli \
- stdlib/int64.cmi stdlib/int64.mli \
- stdlib/lazy.cmi stdlib/lazy.mli \
- stdlib/lexing.cmi stdlib/lexing.mli \
- stdlib/list.cmi stdlib/list.mli \
- stdlib/listLabels.cmi stdlib/listLabels.mli \
- stdlib/map.cmi stdlib/map.mli \
- stdlib/marshal.cmi stdlib/marshal.mli \
- stdlib/moreLabels.cmi stdlib/moreLabels.mli \
- stdlib/nativeint.cmi stdlib/nativeint.mli \
- stdlib/obj.cmi stdlib/obj.mli \
- stdlib/oo.cmi stdlib/oo.mli \
- stdlib/parsing.cmi stdlib/parsing.mli \
- stdlib/pervasives.cmi stdlib/pervasives.mli \
- stdlib/printexc.cmi stdlib/printexc.mli \
- stdlib/printf.cmi stdlib/printf.mli \
- stdlib/queue.cmi stdlib/queue.mli \
- stdlib/random.cmi stdlib/random.mli \
- stdlib/scanf.cmi stdlib/scanf.mli \
- stdlib/sort.cmi stdlib/sort.mli \
- stdlib/stack.cmi stdlib/stack.mli \
- stdlib/stdLabels.cmi stdlib/stdLabels.mli \
- stdlib/stream.cmi stdlib/stream.mli \
- stdlib/string.cmi stdlib/string.mli \
- stdlib/stringLabels.cmi stdlib/stringLabels.mli \
- stdlib/sys.cmi stdlib/sys.mli \
- stdlib/weak.cmi stdlib/weak.mli \
- stdlib/$set.cmi stdlib/$set.mli \
- stdlib/arg.cmx stdlib/arg.p.cmx stdlib/arg.$O stdlib/arg.p.$O \
- stdlib/array.cmx stdlib/array.p.cmx stdlib/array.$O stdlib/array.p.$O \
- stdlib/arrayLabels.cmx stdlib/arrayLabels.p.cmx stdlib/arrayLabels.$O stdlib/arrayLabels.p.$O \
- stdlib/buffer.cmx stdlib/buffer.p.cmx stdlib/buffer.$O stdlib/buffer.p.$O \
- stdlib/callback.cmx stdlib/callback.p.cmx stdlib/callback.$O stdlib/callback.p.$O \
- stdlib/camlinternalLazy.cmx stdlib/camlinternalLazy.p.cmx stdlib/camlinternalLazy.$O stdlib/camlinternalLazy.p.$O \
- stdlib/camlinternalMod.cmx stdlib/camlinternalMod.p.cmx stdlib/camlinternalMod.$O stdlib/camlinternalMod.p.$O \
- stdlib/camlinternalOO.cmx stdlib/camlinternalOO.p.cmx stdlib/camlinternalOO.$O stdlib/camlinternalOO.p.$O \
- stdlib/char.cmx stdlib/char.p.cmx stdlib/char.$O stdlib/char.p.$O \
- stdlib/complex.cmx stdlib/complex.p.cmx stdlib/complex.$O stdlib/complex.p.$O \
- stdlib/digest.cmx stdlib/digest.p.cmx stdlib/digest.$O stdlib/digest.p.$O \
- stdlib/filename.cmx stdlib/filename.p.cmx stdlib/filename.$O stdlib/filename.p.$O \
- stdlib/format.cmx stdlib/format.p.cmx stdlib/format.$O stdlib/format.p.$O \
- stdlib/gc.cmx stdlib/gc.p.cmx stdlib/gc.$O stdlib/gc.p.$O \
- stdlib/genlex.cmx stdlib/genlex.p.cmx stdlib/genlex.$O stdlib/genlex.p.$O \
- stdlib/hashtbl.cmx stdlib/hashtbl.p.cmx stdlib/hashtbl.$O stdlib/hashtbl.p.$O \
- stdlib/int32.cmx stdlib/int32.p.cmx stdlib/int32.$O stdlib/int32.p.$O \
- stdlib/int64.cmx stdlib/int64.p.cmx stdlib/int64.$O stdlib/int64.p.$O \
- stdlib/lazy.cmx stdlib/lazy.p.cmx stdlib/lazy.$O stdlib/lazy.p.$O \
- stdlib/lexing.cmx stdlib/lexing.p.cmx stdlib/lexing.$O stdlib/lexing.p.$O \
- stdlib/list.cmx stdlib/list.p.cmx stdlib/list.$O stdlib/list.p.$O \
- stdlib/listLabels.cmx stdlib/listLabels.p.cmx stdlib/listLabels.$O stdlib/listLabels.p.$O \
- stdlib/map.cmx stdlib/map.p.cmx stdlib/map.$O stdlib/map.p.$O \
- stdlib/marshal.cmx stdlib/marshal.p.cmx stdlib/marshal.$O stdlib/marshal.p.$O \
- stdlib/moreLabels.cmx stdlib/moreLabels.p.cmx stdlib/moreLabels.$O stdlib/moreLabels.p.$O \
- stdlib/nativeint.cmx stdlib/nativeint.p.cmx stdlib/nativeint.$O stdlib/nativeint.p.$O \
- stdlib/obj.cmx stdlib/obj.p.cmx stdlib/obj.$O stdlib/obj.p.$O \
- stdlib/oo.cmx stdlib/oo.p.cmx stdlib/oo.$O stdlib/oo.p.$O \
- stdlib/parsing.cmx stdlib/parsing.p.cmx stdlib/parsing.$O stdlib/parsing.p.$O \
- stdlib/pervasives.cmx stdlib/pervasives.p.cmx stdlib/pervasives.$O stdlib/pervasives.p.$O \
- stdlib/printexc.cmx stdlib/printexc.p.cmx stdlib/printexc.$O stdlib/printexc.p.$O \
- stdlib/printf.cmx stdlib/printf.p.cmx stdlib/printf.$O stdlib/printf.p.$O \
- stdlib/queue.cmx stdlib/queue.p.cmx stdlib/queue.$O stdlib/queue.p.$O \
- stdlib/random.cmx stdlib/random.p.cmx stdlib/random.$O stdlib/random.p.$O \
- stdlib/scanf.cmx stdlib/scanf.p.cmx stdlib/scanf.$O stdlib/scanf.p.$O \
- stdlib/sort.cmx stdlib/sort.p.cmx stdlib/sort.$O stdlib/sort.p.$O \
- stdlib/stack.cmx stdlib/stack.p.cmx stdlib/stack.$O stdlib/stack.p.$O \
- stdlib/stdLabels.cmx stdlib/stdLabels.p.cmx stdlib/stdLabels.$O stdlib/stdLabels.p.$O \
+ stdlib/std_exit.cm[io] stdlib/std_exit.ml \
+ stdlib/arg.cmi stdlib/arg.ml stdlib/arg.mli \
+ stdlib/array.cmi stdlib/array.ml stdlib/array.mli \
+ stdlib/arrayLabels.cmi stdlib/arrayLabels.ml stdlib/arrayLabels.mli \
+ stdlib/buffer.cmi stdlib/buffer.ml stdlib/buffer.mli \
+ stdlib/callback.cmi stdlib/callback.ml stdlib/callback.mli \
+ stdlib/camlinternalLazy.cmi stdlib/camlinternalLazy.ml stdlib/camlinternalLazy.mli \
+ stdlib/camlinternalMod.cmi stdlib/camlinternalMod.ml stdlib/camlinternalMod.mli \
+ stdlib/camlinternalOO.cmi stdlib/camlinternalOO.ml stdlib/camlinternalOO.mli \
+ stdlib/char.cmi stdlib/char.ml stdlib/char.mli \
+ stdlib/complex.cmi stdlib/complex.ml stdlib/complex.mli \
+ stdlib/digest.cmi stdlib/digest.ml stdlib/digest.mli \
+ stdlib/filename.cmi stdlib/filename.ml stdlib/filename.mli \
+ stdlib/format.cmi stdlib/format.ml stdlib/format.mli \
+ stdlib/gc.cmi stdlib/gc.ml stdlib/gc.mli \
+ stdlib/genlex.cmi stdlib/genlex.ml stdlib/genlex.mli \
+ stdlib/hashtbl.cmi stdlib/hashtbl.ml stdlib/hashtbl.mli \
+ stdlib/int32.cmi stdlib/int32.ml stdlib/int32.mli \
+ stdlib/int64.cmi stdlib/int64.ml stdlib/int64.mli \
+ stdlib/lazy.cmi stdlib/lazy.ml stdlib/lazy.mli \
+ stdlib/lexing.cmi stdlib/lexing.ml stdlib/lexing.mli \
+ stdlib/list.cmi stdlib/list.ml stdlib/list.mli \
+ stdlib/listLabels.cmi stdlib/listLabels.ml stdlib/listLabels.mli \
+ stdlib/map.cmi stdlib/map.ml stdlib/map.mli \
+ stdlib/marshal.cmi stdlib/marshal.ml stdlib/marshal.mli \
+ stdlib/moreLabels.cmi stdlib/moreLabels.ml stdlib/moreLabels.mli \
+ stdlib/nativeint.cmi stdlib/nativeint.ml stdlib/nativeint.mli \
+ stdlib/obj.cmi stdlib/obj.ml stdlib/obj.mli \
+ stdlib/oo.cmi stdlib/oo.ml stdlib/oo.mli \
+ stdlib/parsing.cmi stdlib/parsing.ml stdlib/parsing.mli \
+ stdlib/pervasives.cmi stdlib/pervasives.ml stdlib/pervasives.mli \
+ stdlib/printexc.cmi stdlib/printexc.ml stdlib/printexc.mli \
+ stdlib/printf.cmi stdlib/printf.ml stdlib/printf.mli \
+ stdlib/queue.cmi stdlib/queue.ml stdlib/queue.mli \
+ stdlib/random.cmi stdlib/random.ml stdlib/random.mli \
+ stdlib/scanf.cmi stdlib/scanf.ml stdlib/scanf.mli \
+ stdlib/sort.cmi stdlib/sort.ml stdlib/sort.mli \
+ stdlib/stack.cmi stdlib/stack.ml stdlib/stack.mli \
+ stdlib/stdLabels.cmi stdlib/stdLabels.ml stdlib/stdLabels.mli \
+ stdlib/stream.cmi stdlib/stream.ml stdlib/stream.mli \
+ stdlib/string.cmi stdlib/string.ml stdlib/string.mli \
+ stdlib/stringLabels.cmi stdlib/stringLabels.ml stdlib/stringLabels.mli \
+ stdlib/sys.cmi stdlib/sys.ml stdlib/sys.mli \
+ stdlib/weak.cmi stdlib/weak.ml stdlib/weak.mli \
+ stdlib/$set.cmi stdlib/$set.ml stdlib/$set.mli \
+ stdlib/arg.cmx stdlib/arg.p.cmx \
+ stdlib/array.cmx stdlib/array.p.cmx \
+ stdlib/arrayLabels.cmx stdlib/arrayLabels.p.cmx \
+ stdlib/buffer.cmx stdlib/buffer.p.cmx \
+ stdlib/callback.cmx stdlib/callback.p.cmx \
+ stdlib/camlinternalLazy.cmx stdlib/camlinternalLazy.p.cmx \
+ stdlib/camlinternalMod.cmx stdlib/camlinternalMod.p.cmx \
+ stdlib/camlinternalOO.cmx stdlib/camlinternalOO.p.cmx \
+ stdlib/char.cmx stdlib/char.p.cmx \
+ stdlib/complex.cmx stdlib/complex.p.cmx \
+ stdlib/digest.cmx stdlib/digest.p.cmx \
+ stdlib/filename.cmx stdlib/filename.p.cmx \
+ stdlib/format.cmx stdlib/format.p.cmx \
+ stdlib/gc.cmx stdlib/gc.p.cmx \
+ stdlib/genlex.cmx stdlib/genlex.p.cmx \
+ stdlib/hashtbl.cmx stdlib/hashtbl.p.cmx \
+ stdlib/int32.cmx stdlib/int32.p.cmx \
+ stdlib/int64.cmx stdlib/int64.p.cmx \
+ stdlib/lazy.cmx stdlib/lazy.p.cmx \
+ stdlib/lexing.cmx stdlib/lexing.p.cmx \
+ stdlib/list.cmx stdlib/list.p.cmx \
+ stdlib/listLabels.cmx stdlib/listLabels.p.cmx \
+ stdlib/map.cmx stdlib/map.p.cmx \
+ stdlib/marshal.cmx stdlib/marshal.p.cmx \
+ stdlib/moreLabels.cmx stdlib/moreLabels.p.cmx \
+ stdlib/nativeint.cmx stdlib/nativeint.p.cmx \
+ stdlib/obj.cmx stdlib/obj.p.cmx \
+ stdlib/oo.cmx stdlib/oo.p.cmx \
+ stdlib/parsing.cmx stdlib/parsing.p.cmx \
+ stdlib/pervasives.cmx stdlib/pervasives.p.cmx \
+ stdlib/printexc.cmx stdlib/printexc.p.cmx \
+ stdlib/printf.cmx stdlib/printf.p.cmx \
+ stdlib/queue.cmx stdlib/queue.p.cmx \
+ stdlib/random.cmx stdlib/random.p.cmx \
+ stdlib/scanf.cmx stdlib/scanf.p.cmx \
+ stdlib/sort.cmx stdlib/sort.p.cmx \
+ stdlib/stack.cmx stdlib/stack.p.cmx \
+ stdlib/stdLabels.cmx stdlib/stdLabels.p.cmx \
stdlib/std_exit.cmx stdlib/std_exit.p.cmx stdlib/std_exit.$O stdlib/std_exit.p.$O \
- stdlib/stream.cmx stdlib/stream.p.cmx stdlib/stream.$O stdlib/stream.p.$O \
- stdlib/string.cmx stdlib/string.p.cmx stdlib/string.$O stdlib/string.p.$O \
- stdlib/stringLabels.cmx stdlib/stringLabels.p.cmx stdlib/stringLabels.$O stdlib/stringLabels.p.$O \
- stdlib/sys.cmx stdlib/sys.p.cmx stdlib/sys.$O stdlib/sys.p.$O \
- stdlib/weak.cmx stdlib/weak.p.cmx stdlib/weak.$O stdlib/weak.p.$O \
- stdlib/$set.cmx stdlib/$set.p.cmx stdlib/$set.$O stdlib/$set.p.$O \
+ stdlib/stream.cmx stdlib/stream.p.cmx \
+ stdlib/string.cmx stdlib/string.p.cmx \
+ stdlib/stringLabels.cmx stdlib/stringLabels.p.cmx \
+ stdlib/sys.cmx stdlib/sys.p.cmx \
+ stdlib/weak.cmx stdlib/weak.p.cmx \
+ stdlib/$set.cmx stdlib/$set.p.cmx \
$LIBDIR
installlibdir \
@@ -274,7 +275,6 @@ installbin tools/addlabels.byte $LIBDIR/addlabels
installbin tools/scrapelabels.byte $LIBDIR/scrapelabels
installbin otherlibs/dynlink/extract_crc.byte $LIBDIR/extract_crc
installbin otherlibs/labltk/lib/labltk$EXE $BINDIR/labltk$EXE
-installbin otherlibs/labltk/compiler/tkcompiler$EXE $BINDIR/tkcompiler$EXE
installbin otherlibs/labltk/browser/ocamlbrowser$EXE $BINDIR/ocamlbrowser$EXE
installbin otherlibs/labltk/compiler/pp$EXE $LIBDIR/labltk/pp$EXE
installbin otherlibs/labltk/lib/labltktop$EXE $LIBDIR/labltk/labltktop$EXE
@@ -290,6 +290,7 @@ installdir \
otherlibs/"$WIN32"unix/unix.cma \
otherlibs/bigarray/bigarray.cmxa \
otherlibs/dbm/dbm.cmxa \
+ otherlibs/dynlink/dynlink.cmxa \
otherlibs/"$WIN32"graph/graphics.cmxa \
otherlibs/num/nums.cmxa \
otherlibs/str/str.cmxa \
@@ -325,17 +326,17 @@ installdir \
otherlibs/labltk/support/tkthread.cmi \
otherlibs/labltk/support/tkthread.cmo \
otherlibs/labltk/support/tkthread.$O \
- otherlibs/labltk/labltk/*.mli \
+ otherlibs/labltk/support/tkthread.cmx \
+ otherlibs/labltk/labltk/[^_]*.mli \
otherlibs/labltk/labltk/*.cmi \
otherlibs/labltk/labltk/*.cmx \
- otherlibs/labltk/camltk/*.mli \
+ otherlibs/labltk/camltk/[^_]*.mli \
otherlibs/labltk/camltk/*.cmi \
otherlibs/labltk/camltk/*.cmx \
otherlibs/labltk/frx/frxlib.cma \
otherlibs/labltk/frx/frxlib.cmxa \
- otherlibs/labltk/frx/*.mli \
+ ../otherlibs/labltk/frx/*.mli \
otherlibs/labltk/frx/*.cmi \
- otherlibs/labltk/frx/*.cmx \
otherlibs/labltk/jpf/jpflib.cma \
otherlibs/labltk/jpf/jpflib.cmxa \
otherlibs/labltk/jpf/*.mli \
@@ -343,20 +344,27 @@ installdir \
otherlibs/labltk/jpf/*.cmx \
otherlibs/labltk/lib/labltk.cma \
otherlibs/labltk/lib/labltk.cmxa \
+ otherlibs/labltk/lib/labltk.cmx \
otherlibs/labltk/tkanim/*.mli \
otherlibs/labltk/tkanim/*.cmi \
otherlibs/labltk/tkanim/tkanim.cma \
otherlibs/labltk/tkanim/tkanim.cmxa \
+ otherlibs/labltk/compiler/tkcompiler \
$LIBDIR/labltk
installdir \
otherlibs/systhreads/threads.cma \
otherlibs/systhreads/threads.cmxa \
otherlibs/systhreads/thread.cmi \
+ otherlibs/systhreads/thread.cmx \
otherlibs/systhreads/mutex.cmi \
+ otherlibs/systhreads/mutex.cmx \
otherlibs/systhreads/condition.cmi \
+ otherlibs/systhreads/condition.cmx \
otherlibs/systhreads/event.cmi \
+ otherlibs/systhreads/event.cmx \
otherlibs/systhreads/threadUnix.cmi \
+ otherlibs/systhreads/threadUnix.cmx \
$LIBDIR/threads
installdir \
@@ -420,50 +428,54 @@ installdir \
toplevel/topdirs.cmi \
toplevel/topmain.cmi \
typing/outcometree.cmi \
+ typing/outcometree.mli \
otherlibs/graph/graphicsX11.cmi \
+ otherlibs/graph/graphicsX11.mli \
otherlibs/dynlink/dynlink.cmi \
+ otherlibs/dynlink/dynlink.mli \
otherlibs/num/arith_status.cmi \
+ otherlibs/num/arith_status.mli \
otherlibs/num/big_int.cmi \
+ otherlibs/num/big_int.mli \
otherlibs/num/nat.cmi \
+ otherlibs/num/nat.mli \
otherlibs/num/num.cmi \
+ otherlibs/num/num.mli \
otherlibs/num/ratio.cmi \
+ otherlibs/num/ratio.mli \
otherlibs/bigarray/bigarray.cmi \
+ otherlibs/bigarray/bigarray.mli \
otherlibs/dbm/dbm.cmi \
+ otherlibs/dbm/dbm.mli \
+ otherlibs/dynlink/dynlink.cmx \
otherlibs/"$WIN32"graph/graphics.cmi \
+ otherlibs/"$WIN32"graph/graphics.mli \
otherlibs/str/str.cmi \
+ otherlibs/str/str.mli \
otherlibs/"$WIN32"unix/unix.cmi \
+ otherlibs/"$WIN32"unix/unix.mli \
otherlibs/"$WIN32"unix/unixLabels.cmi \
+ otherlibs/"$WIN32"unix/unixLabels.mli \
otherlibs/num/arith_flags.cmx \
- otherlibs/num/arith_flags.$O \
otherlibs/num/int_misc.cmx \
- otherlibs/num/int_misc.$O \
otherlibs/num/arith_status.cmx \
- otherlibs/num/arith_status.$O \
otherlibs/num/big_int.cmx \
- otherlibs/num/big_int.$O \
otherlibs/num/nat.cmx \
- otherlibs/num/nat.$O \
otherlibs/num/num.cmx \
- otherlibs/num/num.$O \
otherlibs/num/ratio.cmx \
- otherlibs/num/ratio.$O \
otherlibs/bigarray/bigarray.cmx \
- otherlibs/bigarray/bigarray.$O \
otherlibs/dbm/dbm.cmx \
- otherlibs/dbm/dbm.$O \
otherlibs/"$WIN32"graph/graphics.cmx \
- otherlibs/"$WIN32"graph/graphics.$O \
+ otherlibs/graph/graphicsX11.cmx \
otherlibs/str/str.cmx \
- otherlibs/str/str.$O \
otherlibs/"$WIN32"unix/unix.cmx \
- otherlibs/"$WIN32"unix/unix.$O \
otherlibs/"$WIN32"unix/unixLabels.cmx \
- otherlibs/"$WIN32"unix/unixLabels.$O \
$LIBDIR
installlibdir \
otherlibs/bigarray/bigarray.$A \
otherlibs/dbm/dbm.$A \
+ otherlibs/dynlink/dynlink.$A \
otherlibs/"$WIN32"graph/graphics.$A \
otherlibs/num/nums.$A \
otherlibs/str/str.$A \
diff --git a/build/otherlibs-targets.sh b/build/otherlibs-targets.sh
index 24df9a6d91..2167dd3349 100644
--- a/build/otherlibs-targets.sh
+++ b/build/otherlibs-targets.sh
@@ -39,6 +39,7 @@ add_c_lib() {
add_ocaml_lib() {
add_native "$1.cmxa"
+ add_native "$1.$A"
add_byte "$1.cma"
}
@@ -94,7 +95,7 @@ for lib in $OTHERLIBRARIES; do
add_c_lib mldbm;;
dynlink)
add_ocaml_lib dynlink
- add_native dynlink.cmx
+ add_native dynlink.cmx dynlink.$O
add_file $lib.cmi extract_crc;;
win32unix)
UNIXDIR="otherlibs/win32unix"
diff --git a/build/world.sh b/build/world.sh
index 2ae1f72fb9..94946ebcca 100755
--- a/build/world.sh
+++ b/build/world.sh
@@ -10,7 +10,7 @@ fi
./mkconfig.sh
./mkmyocamlbuild_config.sh
. ../config/config.sh
-if [ "x$EXE" = "x.exe" ]; then
+if [ "x$EXE" = "x.exe" -a "x$SYSTEM" != "xcygwin" ]; then
./boot-c-parts-windows.sh
else
./boot-c-parts.sh
diff --git a/bytecomp/bytegen.ml b/bytecomp/bytegen.ml
index f7911aa3e5..09c254d4f3 100644
--- a/bytecomp/bytegen.ml
+++ b/bytecomp/bytegen.ml
@@ -171,6 +171,7 @@ let copy_event ev kind info repr =
ev_kind = kind;
ev_info = info;
ev_typenv = ev.ev_typenv;
+ ev_typsubst = ev.ev_typsubst;
ev_compenv = ev.ev_compenv;
ev_stacksize = ev.ev_stacksize;
ev_repr = repr }
@@ -714,6 +715,7 @@ let rec comp_expr env exp sz cont =
ev_kind = kind;
ev_info = info;
ev_typenv = lev.lev_env;
+ ev_typsubst = Subst.identity;
ev_compenv = env;
ev_stacksize = sz;
ev_repr =
diff --git a/bytecomp/bytepackager.ml b/bytecomp/bytepackager.ml
index bb3a80aa6b..31eff07faa 100644
--- a/bytecomp/bytepackager.ml
+++ b/bytecomp/bytepackager.ml
@@ -66,9 +66,11 @@ let rename_relocation objfile mapping defined base (rel, ofs) =
(* Record and relocate a debugging event *)
-let relocate_debug base ev =
- ev.ev_pos <- base + ev.ev_pos;
- events := ev :: !events
+let relocate_debug base prefix subst ev =
+ let ev' = { ev with ev_pos = base + ev.ev_pos;
+ ev_module = prefix ^ "." ^ ev.ev_module;
+ ev_typsubst = Subst.compose ev.ev_typsubst subst } in
+ events := ev' :: !events
(* Read the unit information from a .cmo file. *)
@@ -110,7 +112,7 @@ let read_member_info file =
Accumulate relocs, debug info, etc.
Return size of bytecode. *)
-let rename_append_bytecode oc mapping defined ofs objfile compunit =
+let rename_append_bytecode oc mapping defined ofs prefix subst objfile compunit =
let ic = open_in_bin objfile in
try
Bytelink.check_consistency objfile compunit;
@@ -123,7 +125,7 @@ let rename_append_bytecode oc mapping defined ofs objfile compunit =
Misc.copy_file_chunk ic oc compunit.cu_codesize;
if !Clflags.debug && compunit.cu_debug > 0 then begin
seek_in ic compunit.cu_debug;
- List.iter (relocate_debug ofs) (input_value ic);
+ List.iter (relocate_debug ofs prefix subst) (input_value ic);
end;
close_in ic;
compunit.cu_codesize
@@ -134,20 +136,22 @@ let rename_append_bytecode oc mapping defined ofs objfile compunit =
(* Same, for a list of .cmo and .cmi files.
Return total size of bytecode. *)
-let rec rename_append_bytecode_list oc mapping defined ofs = function
+let rec rename_append_bytecode_list oc mapping defined ofs prefix subst = function
[] ->
ofs
| m :: rem ->
match m.pm_kind with
| PM_intf ->
- rename_append_bytecode_list oc mapping defined ofs rem
+ rename_append_bytecode_list oc mapping defined ofs prefix subst rem
| PM_impl compunit ->
let size =
- rename_append_bytecode oc mapping defined ofs
+ rename_append_bytecode oc mapping defined ofs prefix subst
m.pm_file compunit in
+ let id = Ident.create_persistent m.pm_name in
+ let root = Path.Pident (Ident.create_persistent prefix) in
rename_append_bytecode_list
- oc mapping (Ident.create_persistent m.pm_name :: defined)
- (ofs + size) rem
+ oc mapping (id :: defined)
+ (ofs + size) prefix (Subst.add_module id (Path.Pdot (root, Ident.name id, Path.nopos)) subst) rem
(* Generate the code that builds the tuple representing the package module *)
@@ -187,7 +191,7 @@ let package_object_files files targetfile targetname coercion =
let pos_depl = pos_out oc in
output_binary_int oc 0;
let pos_code = pos_out oc in
- let ofs = rename_append_bytecode_list oc mapping [] 0 members in
+ let ofs = rename_append_bytecode_list oc mapping [] 0 targetname Subst.identity members in
build_global_target oc targetname members mapping ofs coercion;
let pos_debug = pos_out oc in
if !Clflags.debug && !events <> [] then
diff --git a/bytecomp/dll.ml b/bytecomp/dll.ml
index 949e63e2a1..76ca78a77f 100644
--- a/bytecomp/dll.ml
+++ b/bytecomp/dll.ml
@@ -85,13 +85,16 @@ let close_all_dlls () =
Raise [Not_found] if not found. *)
let find_primitive prim_name =
- let rec find = function
+ let rec find seen = function
[] ->
raise Not_found
| dll :: rem ->
let addr = dll_sym dll prim_name in
- if addr == Obj.magic () then find rem else addr in
- find !opened_dlls
+ if addr == Obj.magic () then find (dll :: seen) rem else begin
+ if seen <> [] then opened_dlls := dll :: List.rev_append seen rem;
+ addr
+ end in
+ find [] !opened_dlls
(* If linking in core (dynlink or toplevel), synchronize the VM
table of primitive with the linker's table of primitive
diff --git a/bytecomp/instruct.ml b/bytecomp/instruct.ml
index 9fd2cb9409..4f4fa14fa1 100644
--- a/bytecomp/instruct.ml
+++ b/bytecomp/instruct.ml
@@ -26,6 +26,7 @@ type debug_event =
ev_kind: debug_event_kind; (* Before/after event *)
ev_info: debug_event_info; (* Extra information *)
ev_typenv: Env.summary; (* Typing environment *)
+ ev_typsubst: Subst.t; (* Substitution over types *)
ev_compenv: compilation_env; (* Compilation environment *)
ev_stacksize: int; (* Size of stack frame *)
ev_repr: debug_event_repr } (* Position of the representative *)
diff --git a/bytecomp/instruct.mli b/bytecomp/instruct.mli
index b7dbd7e3ba..2dfc417ceb 100644
--- a/bytecomp/instruct.mli
+++ b/bytecomp/instruct.mli
@@ -43,6 +43,7 @@ type debug_event =
ev_kind: debug_event_kind; (* Before/after event *)
ev_info: debug_event_info; (* Extra information *)
ev_typenv: Env.summary; (* Typing environment *)
+ ev_typsubst: Subst.t; (* Substitution over types *)
ev_compenv: compilation_env; (* Compilation environment *)
ev_stacksize: int; (* Size of stack frame *)
ev_repr: debug_event_repr } (* Position of the representative *)
diff --git a/byterun/Makefile b/byterun/Makefile
index ec5f7ab915..1515294519 100644
--- a/byterun/Makefile
+++ b/byterun/Makefile
@@ -22,14 +22,10 @@ OBJS=$(COMMONOBJS) unix.o main.o
DOBJS=$(OBJS:.o=.d.o) instrtrace.d.o
PICOBJS=$(OBJS:.o=.pic.o)
-#ifeq ($(SUPPORTS_SHARED_LIBRARIES),true)
+SHARED_LIBS_TMP=$(SUPPORTS_SHARED_LIBRARIES:%false=)
+SHARED_LIBS_DEPS=$(SHARED_LIBS_TMP:%true=libcamlrun_shared.so)
-all:: libcamlrun_shared.so
-
-install::
- cp libcamlrun_shared.so $(LIBDIR)/libcamlrun_shared.so
-
-#endif
+all:: $(SHARED_LIBS_DEPS)
ocamlrun$(EXE): libcamlrun.a prims.o
$(MKEXE) $(BYTECCLINKOPTS) -o ocamlrun$(EXE) \
@@ -50,6 +46,14 @@ libcamlrund.a: $(DOBJS)
libcamlrun_shared.so: $(PICOBJS)
$(MKDLL) -o libcamlrun_shared.so $(PICOBJS) $(BYTECCLIBS)
+install::
+ if test -f libcamlrun_shared.so; then \
+ cp libcamlrun_shared.so $(LIBDIR)/libcamlrun_shared.so; fi
+
+clean::
+ rm -f libcamlrun_shared.so
+
+
.SUFFIXES: .d.o .pic.o
.c.d.o:
diff --git a/byterun/Makefile.common b/byterun/Makefile.common
index 2546cf661f..10fb34024f 100755
--- a/byterun/Makefile.common
+++ b/byterun/Makefile.common
@@ -86,7 +86,7 @@ jumptbl.h : instruct.h
version.h : ../VERSION
echo "#define OCAML_VERSION \"`head -1 ../VERSION`\"" > version.h
-clean:
+clean ::
rm -f ocamlrun$(EXE) ocamlrund$(EXE) *.$(O) *.$(A) *.$(SO)
rm -f primitives prims.c opnames.h jumptbl.h ld.conf
rm -f version.h
diff --git a/byterun/finalise.c b/byterun/finalise.c
index 1e176dd170..6851558108 100644
--- a/byterun/finalise.c
+++ b/byterun/finalise.c
@@ -139,7 +139,7 @@ void caml_final_do_calls (void)
-- to_do_hd->size;
f = to_do_hd->item[to_do_hd->size];
running_finalisation_function = 1;
- caml_callback (f.fun, f.val + f.offset);
+ caml_callback (f.fun, f.val + f.offset); /* FIXME PR#4742 */
running_finalisation_function = 0;
}
caml_gc_message (0x80, "Done calling finalisation functions.\n", 0);
diff --git a/byterun/globroots.c b/byterun/globroots.c
index 5de3d1315b..e4fec33287 100644
--- a/byterun/globroots.c
+++ b/byterun/globroots.c
@@ -232,6 +232,28 @@ CAMLexport void caml_modify_generational_global_root(value *r, value newval)
caml_delete_global_root(&caml_global_roots_old, r);
caml_insert_global_root(&caml_global_roots_young, r);
}
+ /* PR#4704 */
+ else if (!Is_block(oldval) && Is_block(newval)) {
+ /* The previous value in the root was unboxed but now it is boxed.
+ The root won't appear in any of the root lists thus far (by virtue
+ of the operation of [caml_register_generational_global_root]), so we
+ need to make sure it gets in, or else it will never be scanned. */
+ if (Is_young(newval))
+ caml_insert_global_root(&caml_global_roots_young, r);
+ else if (Is_in_heap(newval))
+ caml_insert_global_root(&caml_global_roots_old, r);
+ }
+ else if (Is_block(oldval) && !Is_block(newval)) {
+ /* The previous value in the root was boxed but now it is unboxed, so
+ the root should be removed. If [oldval] is young, this will happen
+ anyway at the next minor collection, but it is safer to delete it
+ here. */
+ if (Is_young(oldval))
+ caml_delete_global_root(&caml_global_roots_young, r);
+ else if (Is_in_heap(oldval))
+ caml_delete_global_root(&caml_global_roots_old, r);
+ }
+ /* end PR#4704 */
*r = newval;
}
diff --git a/byterun/int64_emul.h b/byterun/int64_emul.h
index 04e38656f3..c0b7440baf 100644
--- a/byterun/int64_emul.h
+++ b/byterun/int64_emul.h
@@ -96,8 +96,9 @@ static int64 I64_mul(int64 x, int64 y)
}
#define I64_is_zero(x) (((x).l | (x).h) == 0)
-
#define I64_is_negative(x) ((int32) (x).h < 0)
+#define I64_is_min_int(x) ((x).l == 0 && (x).h = 0x80000000U)
+#define I64_is_minus_one(x) (((x).l & (x).h) == 0xFFFFFFFFU)
/* Bitwise operations */
static int64 I64_and(int64 x, int64 y)
diff --git a/byterun/int64_native.h b/byterun/int64_native.h
index f5bef4a6f4..9c07909701 100644
--- a/byterun/int64_native.h
+++ b/byterun/int64_native.h
@@ -29,6 +29,9 @@
#define I64_mul(x,y) ((x) * (y))
#define I64_is_zero(x) ((x) == 0)
#define I64_is_negative(x) ((x) < 0)
+#define I64_is_min_int(x) ((x) == ((int64)1 << 63))
+#define I64_is_minus_one(x) ((x) == -1)
+
#define I64_div(x,y) ((x) / (y))
#define I64_mod(x,y) ((x) % (y))
#define I64_udivmod(x,y,quo,rem) \
diff --git a/byterun/interp.c b/byterun/interp.c
index 2d65b6af5b..bbd8367e8a 100644
--- a/byterun/interp.c
+++ b/byterun/interp.c
@@ -113,7 +113,7 @@ sp is a local copy of the global variable caml_extern_sp. */
For GCC, I have hand-assigned hardware registers for several architectures.
*/
-#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DEBUG)
+#if defined(__GNUC__) && !defined(DEBUG) && !defined(__INTEL_COMPILER) && !defined(__llvm__)
#ifdef __mips__
#define PC_REG asm("$16")
#define SP_REG asm("$17")
diff --git a/byterun/ints.c b/byterun/ints.c
index ed18e6f446..5fc15c6264 100644
--- a/byterun/ints.c
+++ b/byterun/ints.c
@@ -248,23 +248,31 @@ CAMLprim value caml_int32_mul(value v1, value v2)
CAMLprim value caml_int32_div(value v1, value v2)
{
+ int32 dividend = Int32_val(v1);
int32 divisor = Int32_val(v2);
if (divisor == 0) caml_raise_zero_divide();
+ /* PR#4740: on some processors, division crashes on overflow.
+ Implement the same behavior as for type "int". */
+ if (dividend == (1<<31) && divisor == -1) return v1;
#ifdef NONSTANDARD_DIV_MOD
- return caml_copy_int32(caml_safe_div(Int32_val(v1), divisor));
+ return caml_copy_int32(caml_safe_div(dividend, divisor));
#else
- return caml_copy_int32(Int32_val(v1) / divisor);
+ return caml_copy_int32(dividend / divisor);
#endif
}
CAMLprim value caml_int32_mod(value v1, value v2)
{
+ int32 dividend = Int32_val(v1);
int32 divisor = Int32_val(v2);
if (divisor == 0) caml_raise_zero_divide();
+ /* PR#4740: on some processors, modulus crashes if division overflows.
+ Implement the same behavior as for type "int". */
+ if (dividend == (1<<31) && divisor == -1) return caml_copy_int32(0);
#ifdef NONSTANDARD_DIV_MOD
- return caml_copy_int32(caml_safe_mod(Int32_val(v1), divisor));
+ return caml_copy_int32(caml_safe_mod(dividend, divisor));
#else
- return caml_copy_int32(Int32_val(v1) % divisor);
+ return caml_copy_int32(dividend % divisor);
#endif
}
@@ -430,15 +438,26 @@ CAMLprim value caml_int64_mul(value v1, value v2)
CAMLprim value caml_int64_div(value v1, value v2)
{
+ int64 dividend = Int64_val(v1);
int64 divisor = Int64_val(v2);
if (I64_is_zero(divisor)) caml_raise_zero_divide();
+ /* PR#4740: on some processors, division crashes on overflow.
+ Implement the same behavior as for type "int". */
+ if (I64_is_min_int(dividend) && I64_is_minus_one(divisor)) return v1;
return caml_copy_int64(I64_div(Int64_val(v1), divisor));
}
CAMLprim value caml_int64_mod(value v1, value v2)
{
+ int64 dividend = Int64_val(v1);
int64 divisor = Int64_val(v2);
if (I64_is_zero(divisor)) caml_raise_zero_divide();
+ /* PR#4740: on some processors, division crashes on overflow.
+ Implement the same behavior as for type "int". */
+ if (I64_is_min_int(dividend) && I64_is_minus_one(divisor)) {
+ int64 zero = I64_literal(0,0);
+ return caml_copy_int64(zero);
+ }
return caml_copy_int64(I64_mod(Int64_val(v1), divisor));
}
@@ -650,25 +669,35 @@ CAMLprim value caml_nativeint_sub(value v1, value v2)
CAMLprim value caml_nativeint_mul(value v1, value v2)
{ return caml_copy_nativeint(Nativeint_val(v1) * Nativeint_val(v2)); }
+#define Nativeint_min_int ((intnat) 1 << (sizeof(intnat) * 8 - 1))
+
CAMLprim value caml_nativeint_div(value v1, value v2)
{
+ intnat dividend = Nativeint_val(v1);
intnat divisor = Nativeint_val(v2);
if (divisor == 0) caml_raise_zero_divide();
+ /* PR#4740: on some processors, modulus crashes if division overflows.
+ Implement the same behavior as for type "int". */
+ if (dividend == Nativeint_min_int && divisor == -1) return v1;
#ifdef NONSTANDARD_DIV_MOD
- return caml_copy_nativeint(caml_safe_div(Nativeint_val(v1), divisor));
+ return caml_copy_nativeint(caml_safe_div(dividend, divisor));
#else
- return caml_copy_nativeint(Nativeint_val(v1) / divisor);
+ return caml_copy_nativeint(dividend / divisor);
#endif
}
CAMLprim value caml_nativeint_mod(value v1, value v2)
{
+ intnat dividend = Nativeint_val(v1);
intnat divisor = Nativeint_val(v2);
if (divisor == 0) caml_raise_zero_divide();
+ /* PR#4740: on some processors, modulus crashes if division overflows.
+ Implement the same behavior as for type "int". */
+ if (dividend == Nativeint_min_int && divisor == -1) return caml_copy_nativeint(0);
#ifdef NONSTANDARD_DIV_MOD
- return caml_copy_nativeint(caml_safe_mod(Nativeint_val(v1), divisor));
+ return caml_copy_nativeint(caml_safe_mod(dividend, divisor));
#else
- return caml_copy_nativeint(Nativeint_val(v1) % divisor);
+ return caml_copy_nativeint(dividend % divisor);
#endif
}
diff --git a/configure b/configure
index 6cb1d85f86..bab1de691a 100755
--- a/configure
+++ b/configure
@@ -339,8 +339,13 @@ case "$bytecc,$host" in
dllccompopts="-D_WIN32 -DCAML_DLL"
flexlink="flexlink -chain cygwin -merge-manifest"
flexdir=`$flexlink -where | dos2unix`
- iflexdir="-I\"$flexdir\""
- mkexe="$flexlink -exe"
+ if test -z "$flexdir"; then
+ echo "flexlink not found: native shared libraries won't be available"
+ withsharedlibs=no
+ else
+ iflexdir="-I\"$flexdir\""
+ mkexe="$flexlink -exe"
+ fi
exe=".exe"
ostype="Cygwin";;
gcc*,x86_64-*-linux*)
@@ -651,7 +656,11 @@ case "$host" in
i[3456]86-*-linux*) arch=i386; system=linux_`sh ./runtest elf.c`;;
i[3456]86-*-*bsd*) arch=i386; system=bsd_`sh ./runtest elf.c`;;
i[3456]86-*-nextstep*) arch=i386; system=nextstep;;
- i[3456]86-*-solaris*) arch=i386; system=solaris;;
+ i[3456]86-*-solaris*) if $arch64; then
+ arch=amd64; system=solaris
+ else
+ arch=i386; system=solaris
+ fi;;
i[3456]86-*-beos*) arch=i386; system=beos;;
i[3456]86-*-cygwin*) arch=i386; system=cygwin;;
i[3456]86-*-darwin*) if $arch64; then
@@ -720,6 +729,7 @@ case "$arch,$nativecc,$system,$host_type" in
if $arch64; then partialld="ld -r -arch ppc64"; fi;;
*,gcc*,cygwin,*) nativecccompopts="$gcc_warnings -U_WIN32";;
amd64,gcc*,macosx,*) partialld="ld -r -arch x86_64";;
+ amd64,gcc*,solaris,*) partialld="ld -r -m elf_x86_64";;
*,gcc*,*,*) nativecccompopts="$gcc_warnings";;
esac
@@ -733,6 +743,8 @@ case "$arch,$model,$system" in
aspp='gcc -c';;
amd64,*,macosx) as='as -arch x86_64'
aspp='gcc -arch x86_64 -c';;
+ amd64,*,solaris) as='as --64'
+ aspp='gcc -m64 -c';;
amd64,*,*) as='as'
aspp='gcc -c';;
arm,*,*) as='as';
@@ -1140,7 +1152,7 @@ case "$arch,$system" in
echo "Cannot detect system stack overflow.";;
esac
-x# Determine the target architecture for the "num" library
+# Determine the target architecture for the "num" library
#case "$arch" in
# alpha) bng_arch=alpha; bng_asm_level=1;;
@@ -1225,6 +1237,12 @@ x11_link="not found"
for dir in \
$x11_include_dir \
\
+ /usr/X11R7/include \
+ /usr/include/X11R7 \
+ /usr/local/X11R7/include \
+ /usr/local/include/X11R7 \
+ /opt/X11R7/include \
+ \
/usr/X11R6/include \
/usr/include/X11R6 \
/usr/local/X11R6/include \
diff --git a/driver/main.ml b/driver/main.ml
index 956f46194d..786ee8f5c1 100644
--- a/driver/main.ml
+++ b/driver/main.ml
@@ -164,9 +164,13 @@ let main () =
Arg.parse Options.list anonymous usage;
if
List.length (List.filter (fun x -> !x)
- [make_archive;make_package;compile_only;output_c_object]) > 1
+ [make_archive;make_package;compile_only;output_c_object])
+ > 1
then
- fatal "Please specify at most one of -pack, -a, -c, -output-obj";
+ if !print_types then
+ fatal "Option -i is incompatible with -pack, -a, -output-obj"
+ else
+ fatal "Please specify at most one of -pack, -a, -c, -output-obj";
if !make_archive then begin
Compile.init_path();
diff --git a/ocamldoc/.depend b/ocamldoc/.depend
index 280ef2a6b4..fd915bc54e 100644
--- a/ocamldoc/.depend
+++ b/ocamldoc/.depend
@@ -96,17 +96,10 @@ odoc_info.cmx: ../typing/printtyp.cmx odoc_value.cmx odoc_types.cmx \
odoc_type.cmx odoc_text.cmx odoc_str.cmx odoc_search.cmx odoc_scan.cmx \
odoc_print.cmx odoc_parameter.cmx odoc_name.cmx odoc_module.cmx \
odoc_misc.cmx odoc_messages.cmx odoc_global.cmx odoc_exception.cmx \
-<<<<<<< .depend
odoc_dep.cmx odoc_comments.cmx odoc_class.cmx odoc_args.cmx \
odoc_analyse.cmx odoc_info.cmi
odoc_inherit.cmo:
odoc_inherit.cmx:
-=======
- odoc_dep.cmx odoc_config.cmx odoc_comments.cmx odoc_class.cmx \
- odoc_args.cmx odoc_analyse.cmx odoc_info.cmi
-odoc_inherit.cmo:
-odoc_inherit.cmx:
->>>>>>> 1.31.4.1
odoc_latex.cmo: odoc_to_text.cmo odoc_messages.cmo odoc_latex_style.cmo \
odoc_info.cmi ../parsing/asttypes.cmi
odoc_latex.cmx: odoc_to_text.cmx odoc_messages.cmx odoc_latex_style.cmx \
@@ -147,29 +140,12 @@ odoc_module.cmo: ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
odoc_type.cmo odoc_name.cmi odoc_exception.cmo odoc_class.cmo
odoc_module.cmx: ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
odoc_type.cmx odoc_name.cmx odoc_exception.cmx odoc_class.cmx
-<<<<<<< .depend
odoc_name.cmo: ../typing/path.cmi ../parsing/longident.cmi \
../typing/ident.cmi odoc_name.cmi
odoc_name.cmx: ../typing/path.cmx ../parsing/longident.cmx \
../typing/ident.cmx odoc_name.cmi
odoc_ocamlhtml.cmo:
odoc_ocamlhtml.cmx:
-=======
-odoc_name.cmo: ../typing/path.cmi odoc_misc.cmi ../typing/ident.cmi \
- odoc_name.cmi
-odoc_name.cmx: ../typing/path.cmx odoc_misc.cmx ../typing/ident.cmx \
- odoc_name.cmi
-odoc_ocamlhtml.cmo:
-odoc_ocamlhtml.cmx:
->>>>>>> 1.31.4.1
-odoc_opt.cmo: ../typing/typedtree.cmi odoc_texi.cmo odoc_messages.cmo \
- odoc_man.cmo odoc_latex.cmo odoc_info.cmi odoc_html.cmo odoc_global.cmi \
- odoc_dot.cmo odoc_args.cmi odoc_analyse.cmi ../utils/misc.cmi \
- ../utils/config.cmi ../utils/clflags.cmi
-odoc_opt.cmx: ../typing/typedtree.cmx odoc_texi.cmx odoc_messages.cmx \
- odoc_man.cmx odoc_latex.cmx odoc_info.cmx odoc_html.cmx odoc_global.cmx \
- odoc_dot.cmx odoc_args.cmx odoc_analyse.cmx ../utils/misc.cmx \
- ../utils/config.cmx ../utils/clflags.cmx
odoc_parameter.cmo: ../typing/types.cmi odoc_types.cmi
odoc_parameter.cmx: ../typing/types.cmx odoc_types.cmx
odoc_parser.cmo: odoc_types.cmi odoc_comments_global.cmi odoc_parser.cmi
@@ -240,6 +216,10 @@ odoc_analyse.cmi: odoc_module.cmo odoc_args.cmi
odoc_args.cmi: odoc_types.cmi odoc_module.cmo
odoc_ast.cmi: ../typing/types.cmi ../typing/typedtree.cmi ../typing/path.cmi \
../parsing/parsetree.cmi odoc_sig.cmi odoc_name.cmi odoc_module.cmo
+odoc_comments_global.cmi:
+odoc_comments.cmi: odoc_types.cmi
+odoc_config.cmi:
+odoc_cross.cmi: odoc_module.cmo
odoc_dag2html.cmi: odoc_info.cmi
odoc_env.cmi: ../typing/types.cmi odoc_name.cmi
odoc_global.cmi:
diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile
index b8cf983a00..e24c05ce8b 100644
--- a/ocamldoc/Makefile
+++ b/ocamldoc/Makefile
@@ -111,16 +111,17 @@ CMOFILES= odoc_config.cmo \
CMXFILES= $(CMOFILES:.cmo=.cmx)
CMIFILES= $(CMOFILES:.cmo=.cmi)
-EXECMOFILES=$(CMOFILES)\
- odoc_dag2html.cmo\
- odoc_to_text.cmo\
- odoc_ocamlhtml.cmo\
- odoc_html.cmo\
- odoc_man.cmo\
+EXECMOFILES=$(CMOFILES) \
+ odoc_dag2html.cmo \
+ odoc_to_text.cmo \
+ odoc_ocamlhtml.cmo \
+ odoc_html.cmo \
+ odoc_man.cmo \
odoc_latex_style.cmo \
- odoc_latex.cmo\
- odoc_texi.cmo\
- odoc_dot.cmo
+ odoc_latex.cmo \
+ odoc_texi.cmo \
+ odoc_dot.cmo \
+ odoc.cmo
EXECMXFILES= $(EXECMOFILES:.cmo=.cmx)
EXECMIFILES= $(EXECMOFILES:.cmo=.cmi)
@@ -204,10 +205,10 @@ libopt: $(OCAMLDOC_LIBCMXA) $(OCAMLDOC_LIBCMI)
debug:
make OCAMLPP=""
-$(OCAMLDOC): $(EXECMOFILES) odoc.cmo
- $(OCAMLC) -o $@ -linkall unix.cma str.cma dynlink.cma $(LINKFLAGS) $(OCAMLCMOFILES) $(EXECMOFILES) odoc.cmo
-$(OCAMLDOC_OPT): $(EXECMXFILES) odoc_opt.cmx
- $(OCAMLOPT) -o $@ unix.cmxa str.cmxa $(LINKFLAGS) $(OCAMLCMXFILES) $(EXECMXFILES) odoc_opt.cmx
+$(OCAMLDOC): $(EXECMOFILES)
+ $(OCAMLC) -o $@ -linkall unix.cma str.cma dynlink.cma $(LINKFLAGS) $(OCAMLCMOFILES) $(EXECMOFILES)
+$(OCAMLDOC_OPT): $(EXECMXFILES)
+ $(OCAMLOPT) -o $@ unix.cmxa str.cmxa dynlink.cmxa $(LINKFLAGS) $(OCAMLCMXFILES) $(EXECMXFILES)
$(OCAMLDOC_LIBCMA): $(LIBCMOFILES)
$(OCAMLC) -a -o $@ $(LINKFLAGS) $(OCAMLCMOFILES) $(LIBCMOFILES)
@@ -216,6 +217,10 @@ $(OCAMLDOC_LIBCMXA): $(LIBCMXFILES)
manpages: stdlib_man/Pervasives.3o
+dot: $(EXECMOFILES)
+ $(OCAMLDOC_RUN) -dot -dot-reduce -o ocamldoc.dot $(INCLUDES) \
+ odoc*.ml
+
# Parsers and lexers dependencies :
###################################
odoc_text_parser.ml: odoc_text_parser.mly
diff --git a/ocamldoc/Makefile.nt b/ocamldoc/Makefile.nt
index 9957ce125a..c4f9e4b91c 100644
--- a/ocamldoc/Makefile.nt
+++ b/ocamldoc/Makefile.nt
@@ -24,7 +24,7 @@ OCAMLBIN = $(BINDIR)
OCAMLPP=-pp "grep -v DEBUG"
-# For installation
+# For installation
##############
MKDIR=mkdir
CP=cp
@@ -115,6 +115,7 @@ EXECMOFILES=$(CMOFILES)\
odoc_latex.cmo\
odoc_texi.cmo\
odoc_dot.cmo\
+ odoc.cmo
EXECMXFILES= $(EXECMOFILES:.cmo=.cmx)
@@ -178,18 +179,18 @@ OCAMLCMXFILES=$(OCAMLCMOFILES:.cmo=.cmx)
all: exe lib
exe: $(OCAMLDOC)
-lib: $(OCAMLDOC_LIBCMA) $(OCAMLDOC_LIBCMI)
+lib: $(OCAMLDOC_LIBCMA) $(OCAMLDOC_LIBCMI)
opt.opt: exeopt libopt
exeopt: $(OCAMLDOC_OPT)
-libopt: $(OCAMLDOC_LIBCMXA) $(OCAMLDOC_LIBCMI)
-debug:
+libopt: $(OCAMLDOC_LIBCMXA) $(OCAMLDOC_LIBCMI)
+debug:
make OCAMLPP=""
-$(OCAMLDOC): $(EXECMOFILES) odoc.cmo
- $(OCAMLC) -o $@ -linkall unix.cma str.cma dynlink.cma $(LINKFLAGS) $(OCAMLCMOFILES) $(EXECMOFILES) odoc.cmo
-$(OCAMLDOC_OPT): $(EXECMXFILES) odoc_opt.cmx
- $(OCAMLOPT) -o $@ unix.cmxa str.cmxa $(LINKFLAGS) $(OCAMLCMXFILES) $(EXECMXFILES) odoc_opt.cmx
+$(OCAMLDOC): $(EXECMOFILES)
+ $(OCAMLC) -o $@ -linkall unix.cma str.cma dynlink.cma $(LINKFLAGS) $(OCAMLCMOFILES) $(EXECMOFILES)
+$(OCAMLDOC_OPT): $(EXECMXFILES)
+ $(OCAMLOPT) -o $@ unix.cmxa str.cmxa dynlink.cmxa $(LINKFLAGS) $(OCAMLCMXFILES) $(EXECMXFILES)
$(OCAMLDOC_LIBCMA): $(LIBCMOFILES)
$(OCAMLC) -a -o $@ $(LINKFLAGS) $(OCAMLCMOFILES) $(LIBCMOFILES)
diff --git a/ocamldoc/odoc.ml b/ocamldoc/odoc.ml
index fa9f0780f9..dbc7a7d007 100644
--- a/ocamldoc/odoc.ml
+++ b/ocamldoc/odoc.ml
@@ -25,17 +25,18 @@ let print_DEBUG s = print_string s ; print_newline ()
(* we check if we must load a module given on the command line *)
let arg_list = Array.to_list Sys.argv
-let (cmo_or_cma_opt, paths) =
+let (cm_opt, paths) =
let rec iter (f_opt, inc) = function
[] | _ :: [] -> (f_opt, inc)
| "-g" :: file :: q when
((Filename.check_suffix file "cmo") ||
- (Filename.check_suffix file "cma")) &&
+ (Filename.check_suffix file "cma") ||
+ (Filename.check_suffix file "cmxs")) &&
(f_opt = None) ->
- iter (Some file, inc) q
- | "-i" :: dir :: q ->
- iter (f_opt, inc @ [dir]) q
- | _ :: q ->
+ iter (Some file, inc) q
+ | "-i" :: dir :: q ->
+ iter (f_opt, inc @ [dir]) q
+ | _ :: q ->
iter (f_opt, inc) q
in
iter (None, []) arg_list
@@ -63,12 +64,11 @@ let get_real_filename name =
)
let _ =
- match cmo_or_cma_opt with
+ match cm_opt with
None ->
()
| Some file ->
- (* initializations for dynamic loading *)
- Dynlink.init ();
+ let file = Dynlink.adapt_filename file in
Dynlink.allow_unsafe_modules true;
try
let real_file = get_real_filename file in
diff --git a/ocamldoc/odoc_args.ml b/ocamldoc/odoc_args.ml
index f535a018b6..4c9b583560 100644
--- a/ocamldoc/odoc_args.ml
+++ b/ocamldoc/odoc_args.ml
@@ -23,8 +23,6 @@ type source_file =
let include_dirs = Clflags.include_dirs
-let bytecode_mode = ref true
-
class type doc_generator =
object
method generate : Odoc_module.t_module list -> unit
@@ -249,10 +247,8 @@ let options = ref [
"-dot", Arg.Unit (fun () -> set_doc_generator !default_dot_generator), M.generate_dot ;
"-customdir", Arg.Unit (fun () -> Printf.printf "%s\n" Odoc_config.custom_generators_path; exit 0),
M.display_custom_generators_dir ;
- "-i", Arg.String (fun s -> if !bytecode_mode then () else (prerr_endline (M.option_not_in_native_code "-i"); exit 1)),
- M.add_load_dir ;
- "-g", Arg.String (fun s -> if !bytecode_mode then () else (prerr_endline (M.option_not_in_native_code "-g"); exit 1)),
- M.load_file ^
+ "-i", Arg.String (fun s -> ()), M.add_load_dir ;
+ "-g", Arg.String (fun s -> ()), M.load_file ^
"\n\n *** HTML options ***\n";
(* html only options *)
diff --git a/ocamldoc/odoc_args.mli b/ocamldoc/odoc_args.mli
index 428a2c823f..1267cc4100 100644
--- a/ocamldoc/odoc_args.mli
+++ b/ocamldoc/odoc_args.mli
@@ -21,10 +21,6 @@ type source_file =
(** The include_dirs in the OCaml compiler. *)
val include_dirs : string list ref
-(** Indicate if we are in bytecode mode or not.
- (For the [ocamldoc] command).*)
-val bytecode_mode : bool ref
-
(** The class type of documentation generators. *)
class type doc_generator =
object method generate : Odoc_module.t_module list -> unit end
diff --git a/ocamldoc/odoc_messages.ml b/ocamldoc/odoc_messages.ml
index 4cf1e67f71..b20c8a9c16 100644
--- a/ocamldoc/odoc_messages.ml
+++ b/ocamldoc/odoc_messages.ml
@@ -24,7 +24,6 @@ let message_version = software^" "^config_version
let usage = "Usage : "^(Sys.argv.(0))^" [options] <files>\n"
let options_are = "Options are :"
let option_version = "\tPrint version and exit"
-let bytecode_only = "(bytecode version only)"
let latex_only = "(LaTeX only)"
let texi_only = "(TeXinfo only)"
let latex_texi_only = "(LaTeX and TeXinfo only)"
@@ -40,8 +39,8 @@ let option_impl ="<file>\tConsider <file> as a .ml file"
let option_intf ="<file>\tConsider <file> as a .mli file"
let display_custom_generators_dir = "\tDisplay custom generators standard directory and exit"
let add_load_dir = "<dir>\tAdd the given directory to the search path for custom\n"^
- "\t\tgenerators "^bytecode_only
-let load_file = "<file.cm[o|a]>\n\t\tLoad file defining a new documentation generator\n\t\t"^bytecode_only
+ "\t\tgenerators"
+let load_file = "<file.cm[o|a|xs]>\n\t\tLoad file defining a new documentation generator"
let nolabels = "\tIgnore non-optional labels in types"
let werr = "\tTreat ocamldoc warnings as errors"
let target_dir = "<dir>\tGenerate files in directory <dir>, rather than in current\n"^
diff --git a/ocamldoc/odoc_name.ml b/ocamldoc/odoc_name.ml
index e187fb0b29..21bbee74d0 100644
--- a/ocamldoc/odoc_name.ml
+++ b/ocamldoc/odoc_name.ml
@@ -35,12 +35,13 @@ type t = string
let parens_if_infix name =
match name with
- "" -> ""
- | s ->
- if List.mem s.[0] infix_chars then
- "("^s^")"
- else
- s
+ | "" -> ""
+ | s when s.[0] = '*' || s.[String.length s - 1] = '*' -> "( " ^ s ^ " )"
+ | s when List.mem s.[0] infix_chars -> "(" ^ s ^ ")"
+ | "or" | "mod" | "land" | "lor" | "lxor" | "lsl" | "lsr" | "asr" ->
+ "(" ^ name ^ ")"
+ | _ -> name
+;;
let cut name =
match name with
diff --git a/ocamldoc/odoc_opt.ml b/ocamldoc/odoc_opt.ml
deleted file mode 100644
index 8eb7e6fa38..0000000000
--- a/ocamldoc/odoc_opt.ml
+++ /dev/null
@@ -1,82 +0,0 @@
-(***********************************************************************)
-(* OCamldoc *)
-(* *)
-(* Maxence Guesdon, projet Cristal, INRIA Rocquencourt *)
-(* *)
-(* Copyright 2001 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. *)
-(* *)
-(***********************************************************************)
-
-(* $Id$ *)
-
-(** Main module for native version.*)
-
-open Config
-open Clflags
-open Misc
-open Format
-open Typedtree
-
-let _ = Odoc_args.bytecode_mode := false
-
-
-let html_generator = new Odoc_html.html
-let default_latex_generator = new Odoc_latex.latex
-let default_texi_generator = new Odoc_texi.texi
-let default_man_generator = new Odoc_man.man
-let default_dot_generator = new Odoc_dot.dot
-let _ = Odoc_args.parse
- (html_generator :> Odoc_args.doc_generator)
- (default_latex_generator :> Odoc_args.doc_generator)
- (default_texi_generator :> Odoc_args.doc_generator)
- (default_man_generator :> Odoc_args.doc_generator)
- (default_dot_generator :> Odoc_args.doc_generator)
-
-let loaded_modules =
- List.flatten
- (List.map
- (fun f ->
- Odoc_info.verbose (Odoc_messages.loading f);
- try
- let l = Odoc_analyse.load_modules f in
- Odoc_info.verbose Odoc_messages.ok;
- l
- with Failure s ->
- prerr_endline s ;
- incr Odoc_global.errors ;
- []
- )
- !Odoc_args.load
- )
-
-let modules = Odoc_analyse.analyse_files ~init: loaded_modules !Odoc_args.files
-
-let _ =
- match !Odoc_args.dump with
- None -> ()
- | Some f ->
- try Odoc_analyse.dump_modules f modules
- with Failure s ->
- prerr_endline s ;
- incr Odoc_global.errors
-
-let _ =
- match !Odoc_args.doc_generator with
- None ->
- ()
- | Some gen ->
- Odoc_info.verbose Odoc_messages.generating_doc;
- gen#generate modules;
- Odoc_info.verbose Odoc_messages.ok
-
-let _ =
- if !Odoc_global.errors > 0 then
- (
- prerr_endline (Odoc_messages.errors_occured !Odoc_global.errors) ;
- exit 1
- )
- else
- exit 0
-
diff --git a/otherlibs/systhreads/Tests/Makefile b/otherlibs/systhreads/Tests/Makefile
index 4d860b3e0c..16c908f203 100644
--- a/otherlibs/systhreads/Tests/Makefile
+++ b/otherlibs/systhreads/Tests/Makefile
@@ -16,7 +16,7 @@
PROGS=test1.byt test2.byt test3.byt test4.byt test5.byt test6.byt \
test7.byt test8.byt test9.byt testA.byt sieve.byt \
testio.byt testsocket.byt testsignal.byt testsignal2.byt \
- torture.byt
+ torture.byt testfork.byt
include ../../../config/Makefile
diff --git a/otherlibs/systhreads/posix.c b/otherlibs/systhreads/posix.c
index 715741fc5b..da45be06cf 100644
--- a/otherlibs/systhreads/posix.c
+++ b/otherlibs/systhreads/posix.c
@@ -111,6 +111,9 @@ static pthread_mutex_t caml_runtime_mutex = PTHREAD_MUTEX_INITIALIZER;
/* Condition signaled when caml_runtime_busy becomes 0 */
static pthread_cond_t caml_runtime_is_free = PTHREAD_COND_INITIALIZER;
+/* Whether the ``tick'' thread is already running */
+static int caml_tick_thread_running = 0;
+
/* The key used for storing the thread descriptor in the specific data
of the corresponding Posix thread. */
static pthread_key_t thread_descriptor_key;
@@ -332,8 +335,6 @@ static void * caml_thread_tick(void * arg)
static void caml_thread_reinitialize(void)
{
caml_thread_t thr, next;
- pthread_t tick_pthread;
- pthread_attr_t attr;
struct channel * chan;
/* Remove all other threads (now nonexistent)
@@ -353,24 +354,21 @@ static void caml_thread_reinitialize(void)
pthread_cond_init(&caml_runtime_is_free, NULL);
caml_runtime_waiters = 0; /* no other thread is waiting for the RTS */
caml_runtime_busy = 1; /* normally useless */
+ /* Tick thread is not currently running in child process, will be
+ re-created at next Thread.create */
+ caml_tick_thread_running = 0;
/* Reinitialize all IO mutexes */
for (chan = caml_all_opened_channels;
chan != NULL;
chan = chan->next) {
if (chan->mutex != NULL) pthread_mutex_init(chan->mutex, NULL);
}
- /* Fork a new tick thread */
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- pthread_create(&tick_pthread, &attr, caml_thread_tick, NULL);
}
/* Initialize the thread machinery */
value caml_thread_initialize(value unit) /* ML */
{
- pthread_t tick_pthread;
- pthread_attr_t attr;
value mu = Val_unit;
value descr;
@@ -395,6 +393,7 @@ value caml_thread_initialize(value unit) /* ML */
curr_thread->descr = descr;
curr_thread->next = curr_thread;
curr_thread->prev = curr_thread;
+ curr_thread->backtrace_last_exn = Val_unit;
#ifdef NATIVE_CODE
curr_thread->exit_buf = &caml_termination_jmpbuf;
#endif
@@ -415,12 +414,6 @@ value caml_thread_initialize(value unit) /* ML */
caml_channel_mutex_lock = caml_io_mutex_lock;
caml_channel_mutex_unlock = caml_io_mutex_unlock;
caml_channel_mutex_unlock_exn = caml_io_mutex_unlock_exn;
- /* Fork the tick thread */
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- caml_pthread_check(
- pthread_create(&tick_pthread, &attr, caml_thread_tick, NULL),
- "Thread.init");
/* Set up fork() to reinitialize the thread machinery in the child
(PR#4577) */
pthread_atfork(NULL, NULL, caml_thread_reinitialize);
@@ -488,6 +481,7 @@ value caml_thread_new(value clos) /* ML */
{
pthread_attr_t attr;
caml_thread_t th;
+ pthread_t tick_pthread;
value mu = Val_unit;
value descr;
int err;
@@ -526,12 +520,12 @@ value caml_thread_new(value clos) /* ML */
th->prev = curr_thread;
curr_thread->next->prev = th;
curr_thread->next = th;
- /* Fork the new thread */
+ /* Create the new thread */
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
err = pthread_create(&th->pthread, &attr, caml_thread_start, (void *) th);
if (err != 0) {
- /* Fork failed, remove thread info block from list of threads */
+ /* Creation failed, remove thread info block from list of threads */
th->next->prev = curr_thread;
curr_thread->next = th->next;
#ifndef NATIVE_CODE
@@ -541,6 +535,16 @@ value caml_thread_new(value clos) /* ML */
caml_pthread_check(err, "Thread.create");
}
End_roots();
+ /* Create the tick thread if not already done.
+ Because of PR#4666, we start the tick thread late, only when we create
+ the first additional thread in the current process*/
+ if (! caml_tick_thread_running) {
+ caml_tick_thread_running = 1;
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ err = pthread_create(&tick_pthread, &attr, caml_thread_tick, NULL);
+ caml_pthread_check(err, "Thread.create");
+ }
return descr;
}
diff --git a/otherlibs/threads/Tests/Makefile b/otherlibs/threads/Tests/Makefile
index ff013fe92c..3a3e0031fd 100644
--- a/otherlibs/threads/Tests/Makefile
+++ b/otherlibs/threads/Tests/Makefile
@@ -16,7 +16,7 @@
PROGS=test1.byt test2.byt test3.byt test4.byt test5.byt test6.byt \
test7.byt test8.byt test9.byt testA.byt sieve.byt \
testio.byt testsocket.byt testwait.byt testsignal.byt testsignal2.byt \
- testsieve.byt token1.byt token2.byt
+ testsieve.byt token1.byt token2.byt testfork.byt
CAMLC=../../../boot/ocamlrun ../../../ocamlc -nojoin -I .. -I ../../../stdlib -I ../../unix
diff --git a/otherlibs/unix/unix.mli b/otherlibs/unix/unix.mli
index 5ac6913206..e7ac4456f9 100644
--- a/otherlibs/unix/unix.mli
+++ b/otherlibs/unix/unix.mli
@@ -900,7 +900,8 @@ type socket_domain =
PF_UNIX (** Unix domain *)
| PF_INET (** Internet domain (IPv4) *)
| PF_INET6 (** Internet domain (IPv6) *)
-(** The type of socket domains. *)
+(** The type of socket domains. Not all platforms support
+ IPv6 sockets (type [PF_INET6]). *)
type socket_type =
SOCK_STREAM (** Stream socket *)
diff --git a/stdlib/format.ml b/stdlib/format.ml
index 2083602b99..d40347faf0 100644
--- a/stdlib/format.ml
+++ b/stdlib/format.ml
@@ -1040,9 +1040,9 @@ let get_buffer_out b =
s
;;
-(* [ppf] is supposed to be a pretty-printer that outputs in buffer [b]:
- to extract contents of [ppf] as a string we flush [ppf] and get the string
- out of [b]. *)
+(* [ppf] is supposed to be a pretty-printer that outputs to buffer [b]:
+ to extract the contents of [ppf] as a string we flush [ppf] and get the
+ string out of [b]. *)
let string_out b ppf =
pp_flush_queue ppf false;
get_buffer_out b
@@ -1311,7 +1311,10 @@ let kbprintf k b =
mkprintf false (fun _ -> formatter_of_buffer b) k
;;
-let bprintf b = kbprintf ignore b;;
+let bprintf b =
+ let k ppf = pp_flush_queue ppf false in
+ kbprintf k b
+;;
let ksprintf k =
let b = Buffer.create 512 in
diff --git a/stdlib/map.mli b/stdlib/map.mli
index ca82413036..af1d4d37b7 100644
--- a/stdlib/map.mli
+++ b/stdlib/map.mli
@@ -73,9 +73,7 @@ module type S =
(** [iter f m] applies [f] to all bindings in map [m].
[f] receives the key as first argument, and the associated value
as second argument. The bindings are passed to [f] in increasing
- order with respect to the ordering over the type of the keys.
- Only current bindings are presented to [f]:
- bindings hidden by more recent bindings are not passed to [f]. *)
+ order with respect to the ordering over the type of the keys. *)
val map: ('a -> 'b) -> 'a t -> 'b t
(** [map f m] returns a map with same domain as [m], where the
diff --git a/stdlib/parsing.ml b/stdlib/parsing.ml
index 2b4d93ddb8..44c7fb2715 100644
--- a/stdlib/parsing.ml
+++ b/stdlib/parsing.ml
@@ -180,9 +180,15 @@ let peek_val env n =
Obj.magic env.v_stack.(env.asp - n)
let symbol_start_pos () =
- if env.rule_len > 0
- then env.symb_start_stack.(env.asp - env.rule_len + 1)
- else env.symb_end_stack.(env.asp)
+ let rec loop i =
+ if i <= 0 then env.symb_end_stack.(env.asp)
+ else begin
+ let st = env.symb_start_stack.(env.asp - i + 1) in
+ let en = env.symb_end_stack.(env.asp - i + 1) in
+ if st <> en then st else loop (i - 1)
+ end
+ in
+ loop env.rule_len
;;
let symbol_end_pos () = env.symb_end_stack.(env.asp);;
let rhs_start_pos n = env.symb_start_stack.(env.asp - (env.rule_len - n));;
diff --git a/stdlib/pervasives.mli b/stdlib/pervasives.mli
index 7ead634fbb..97ee3c94b8 100644
--- a/stdlib/pervasives.mli
+++ b/stdlib/pervasives.mli
@@ -24,6 +24,7 @@
name, without prefixing them by [Pervasives].
*)
+
(** {6 Exceptions} *)
external raise : exn -> 'a = "%raise"
@@ -42,7 +43,6 @@ exception Exit
(** {6 Comparisons} *)
-
external ( = ) : 'a -> 'a -> bool = "%equal"
(** [e1 = e2] tests for structural equality of [e1] and [e2].
Mutable structures (e.g. references and arrays) are equal
@@ -100,8 +100,7 @@ val max : 'a -> 'a -> 'a
external ( == ) : 'a -> 'a -> bool = "%eq"
(** [e1 == e2] tests for physical equality of [e1] and [e2].
- On integers and characters, physical equality is identical to structural
- equality. On mutable structures, [e1 == e2] is true if and only if
+ On mutable structures, [e1 == e2] is true if and only if
physical modification of [e1] also affects [e2].
On non-mutable structures, the behavior of [(==)] is
implementation-dependent; however, it is guaranteed that
@@ -113,7 +112,6 @@ external ( != ) : 'a -> 'a -> bool = "%noteq"
(** {6 Boolean operations} *)
-
external not : bool -> bool = "%boolnot"
(** The boolean negation. *)
@@ -186,10 +184,8 @@ val min_int : int
(** The smallest representable integer. *)
-
(** {7 Bitwise operations} *)
-
external ( land ) : int -> int -> int = "%andint"
(** Bitwise logical and. *)
@@ -250,10 +246,10 @@ external ( /. ) : float -> float -> float = "%divfloat"
(** Floating-point division. *)
external ( ** ) : float -> float -> float = "caml_power_float" "pow" "float"
-(** Exponentiation *)
+(** Exponentiation. *)
external sqrt : float -> float = "caml_sqrt_float" "sqrt" "float"
-(** Square root *)
+(** Square root. *)
external exp : float -> float = "caml_exp_float" "exp" "float"
(** Exponential. *)
@@ -265,47 +261,57 @@ external log10 : float -> float = "caml_log10_float" "log10" "float"
(** Base 10 logarithm. *)
external cos : float -> float = "caml_cos_float" "cos" "float"
-(** See {!Pervasives.atan2}. *)
+(** [cos a] returns the cosine of angle [a] measured in radians. *)
external sin : float -> float = "caml_sin_float" "sin" "float"
-(** See {!Pervasives.atan2}. *)
+(** [sin a] returns the sine of angle [a] measured in radians. *)
external tan : float -> float = "caml_tan_float" "tan" "float"
-(** See {!Pervasives.atan2}. *)
+(** [tan a] returns the tangent of angle [a] measured in radians. *)
external acos : float -> float = "caml_acos_float" "acos" "float"
-(** See {!Pervasives.atan2}. *)
+(** [acos f] returns the arc cosine of [f]. The return angle is measured
+ in radians. *)
external asin : float -> float = "caml_asin_float" "asin" "float"
-(** See {!Pervasives.atan2}. *)
+(** [asin f] returns the arc sine of [f]. The return angle is measured
+ in radians. *)
external atan : float -> float = "caml_atan_float" "atan" "float"
-(** See {!Pervasives.atan2}. *)
+(** [atan f] returns the arc tangent of [f]. The return angle is measured
+ in radians. *)
external atan2 : float -> float -> float = "caml_atan2_float" "atan2" "float"
-(** The usual trigonometric functions. *)
+(** [atan2 y x] returns the principal value of the arc tangent of
+ [y / x], using the signs of both arguments to determine the quadrant of the
+ result. The return angle is measured in radians. *)
external cosh : float -> float = "caml_cosh_float" "cosh" "float"
-(** See {!Pervasives.tanh}. *)
+(** [cosh a] returns the hyperbolic cosine of angle [a] measured
+ in radians. *)
external sinh : float -> float = "caml_sinh_float" "sinh" "float"
-(** See {!Pervasives.tanh}. *)
+(** [sinh a] returns the hyperbolic sine of angle [a] measured
+ in radians. *)
external tanh : float -> float = "caml_tanh_float" "tanh" "float"
-(** The usual hyperbolic trigonometric functions. *)
+(** [tanh f] returns the hyperbolic tangent of angle [a] measured
+ in radians. *)
external ceil : float -> float = "caml_ceil_float" "ceil" "float"
-(** See {!Pervasives.floor}. *)
+(** Round the given float to an integer value.
+ [ceil f] returns the least integer value greater than or
+ equal to [f].
+ See also {!Pervasives.floor}. *)
external floor : float -> float = "caml_floor_float" "floor" "float"
(** Round the given float to an integer value.
[floor f] returns the greatest integer value less than or
equal to [f].
- [ceil f] returns the least integer value greater than or
- equal to [f]. *)
+ See also {!Pervasives.ceil}. *)
external abs_float : float -> float = "%absfloat"
-(** Return the absolute value of the argument. *)
+(** [abs_float f] returns the absolute value of [f]. *)
external mod_float : float -> float -> float = "caml_fmod_float" "fmod" "float"
(** [mod_float a b] returns the remainder of [a] with respect to
@@ -442,7 +448,6 @@ external float_of_string : string -> float = "caml_float_of_string"
if the given string is not a valid representation of a float. *)
-
(** {6 Pair operations} *)
external fst : 'a * 'b -> 'a = "%field0"
@@ -544,8 +549,8 @@ val read_float : unit -> float
The result is unspecified if the line read is not a valid
representation of a floating-point number. *)
-(** {7 General output functions} *)
+(** {7 General output functions} *)
type open_flag =
Open_rdonly (** open for reading. *)
@@ -771,6 +776,7 @@ val set_binary_mode_in : in_channel -> bool -> unit
This function has no effect under operating systems that
do not distinguish between text mode and binary mode. *)
+
(** {7 Operations on large files} *)
module LargeFile :
@@ -789,6 +795,7 @@ module LargeFile :
regular integers (type [int]), these alternate functions allow
operating on files whose sizes are greater than [max_int]. *)
+
(** {6 References} *)
type 'a ref = { mutable contents : 'a }
@@ -853,7 +860,6 @@ val ( ^^ ) :
(** {6 Program termination} *)
-
val exit : int -> 'a
(** Terminate the process, returning the given status code
to the operating system: usually 0 to indicate no errors,
diff --git a/stdlib/printf.ml b/stdlib/printf.ml
index 92ce254769..a061af7359 100644
--- a/stdlib/printf.ml
+++ b/stdlib/printf.ml
@@ -142,7 +142,8 @@ let extract_format fmt start stop widths =
| ('*', []) ->
assert false (* should not happen *)
| (c, _) ->
- Buffer.add_char b c; fill_format (succ i) widths in
+ Buffer.add_char b c;
+ fill_format (succ i) widths in
fill_format start (List.rev widths);
Buffer.contents b
;;
@@ -156,6 +157,15 @@ let extract_format_int conv fmt start stop widths =
| _ -> sfmt
;;
+let extract_format_float conv fmt start stop widths =
+ let sfmt = extract_format fmt start stop widths in
+ match conv with
+ | 'F' ->
+ sfmt.[String.length sfmt - 1] <- 'f';
+ sfmt
+ | _ -> sfmt
+;;
+
(* Returns the position of the next character following the meta format
string, starting from position [i], inside a given format [fmt].
According to the character [conv], the meta format string is
@@ -297,7 +307,7 @@ let ac_of_format fmt =
let count_arguments_of_format fmt =
let ac = ac_of_format fmt in
- ac.ac_rglr + ac.ac_skip + ac.ac_rdrs
+ ac.ac_rglr
;;
let list_iter_i f l =
@@ -417,6 +427,31 @@ let get_index spec n =
| Spec_index p -> p
;;
+(* Format a float argument as a valid Caml lexem. *)
+let format_float_lexem =
+ let valid_float_lexem sfmt s =
+ let l = String.length s in
+ if l = 0 then "nan" else
+ let add_dot sfmt s =
+ if s.[0] = ' ' || s.[0] = '+' || s.[0] = '0'
+ then String.sub s 1 (l - 1) ^ "."
+ else String.sub s 0 (l - 1) ^ "." in
+
+ let rec loop i =
+ if i >= l then add_dot sfmt s else
+ match s.[i] with
+ | '.' -> s
+ | _ -> loop (i + 1) in
+
+ loop 0 in
+
+ (fun sfmt x ->
+ let s = format_float sfmt x in
+ match classify_float x with
+ | FP_normal | FP_subnormal | FP_zero -> valid_float_lexem sfmt s
+ | FP_nan | FP_infinite -> s)
+;;
+
(* Decode a format string and act on it.
[fmt] is the [printf] format string, and [pos] points to a [%] character in
the format string.
@@ -485,9 +520,11 @@ let scan_format fmt args n pos cont_s cont_a cont_t cont_f cont_m =
let (x : float) = get_arg spec n in
let s = format_float (extract_format fmt pos i widths) x in
cont_s (next_index spec n) s (succ i)
- | 'F' ->
+ | 'F' as conv ->
let (x : float) = get_arg spec n in
- cont_s (next_index spec n) (string_of_float x) (succ i)
+ let s =
+ format_float_lexem (extract_format_float conv fmt pos i widths) x in
+ cont_s (next_index spec n) s (succ i)
| 'B' | 'b' ->
let (x : bool) = get_arg spec n in
cont_s (next_index spec n) (string_of_bool x) (succ i)
diff --git a/stdlib/scanf.ml b/stdlib/scanf.ml
index 5ab7aeba73..88a0f97f82 100644
--- a/stdlib/scanf.ml
+++ b/stdlib/scanf.ml
@@ -782,8 +782,7 @@ let scan_String max ib =
| '\n', true
| ' ', false ->
skip_spaces false (Scanning.ignore_char ib max)
- | '\\', false -> loop false max
- | c, false -> loop false (Scanning.store_char ib c max)
+ | c, false -> loop false max
| _, _ -> loop false (scan_backslash_char (max - 1) ib) in
loop true max
;;
@@ -1272,22 +1271,29 @@ let scanf fmt = bscanf Scanning.stdib fmt;;
let bscanf_format ib fmt f =
let fmt = Sformat.unsafe_to_string fmt in
- let fmt1 = ignore (scan_String max_int ib); token_string ib in
+ let fmt1 =
+ ignore (scan_String max_int ib);
+ token_string ib in
if not (compatible_format_type fmt1 fmt) then
format_mismatch fmt1 fmt else
f (string_to_format fmt1)
;;
-let sscanf_format s fmt f = bscanf_format (Scanning.from_string s) fmt f;;
+let sscanf_format s fmt = bscanf_format (Scanning.from_string s) fmt;;
-let quote_string s =
- let b = Buffer.create (String.length s + 2) in
+let string_to_String s =
+ let l = String.length s in
+ let b = Buffer.create (l + 2) in
Buffer.add_char b '\"';
- Buffer.add_string b s;
+ for i = 0 to l - 1 do
+ let c = s.[i] in
+ if c = '\"' then Buffer.add_char b '\\';
+ Buffer.add_char b c;
+ done;
Buffer.add_char b '\"';
Buffer.contents b
;;
let format_from_string s fmt =
- sscanf_format (quote_string s) fmt (fun x -> x)
+ sscanf_format (string_to_String s) fmt (fun x -> x)
;;
diff --git a/tools/Makefile.shared b/tools/Makefile.shared
index 3b68be2bf6..5c0fd1ed0c 100644
--- a/tools/Makefile.shared
+++ b/tools/Makefile.shared
@@ -23,8 +23,7 @@ INCLUDES=-I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp \
COMPFLAGS= -warn-error A $(INCLUDES)
LINKFLAGS=$(INCLUDES)
-all: ocamldep ocamlprof ocamlcp ocamlmktop ocamlmklib scrapelabels addlabels \
- dumpobj
+all: ocamldep ocamlprof ocamlcp ocamlmktop ocamlmklib dumpobj
.PHONY: all
opt.opt: ocamldep.opt
@@ -51,9 +50,9 @@ clean::
rm -f ocamldep.opt
install::
- cp ocamldep $(BINDIR)/ocamldep$(EXE)
+ cp ocamldep $(BINDIR)/jocamldep$(EXE)
if test -f ocamldep.opt; \
- then cp ocamldep.opt $(BINDIR)/ocamldep.opt$(EXE); else :; fi
+ then cp ocamldep.opt $(BINDIR)/jocamldep.opt$(EXE); else :; fi
# The profiler
@@ -69,15 +68,15 @@ ocamlcp: ocamlcp.cmo
$(CAMLC) $(LINKFLAGS) -o ocamlcp main_args.cmo ocamlcp.cmo
install::
- cp ocamlprof $(BINDIR)/ocamlprof$(EXE)
- cp ocamlcp $(BINDIR)/ocamlcp$(EXE)
+ cp ocamlprof $(BINDIR)/jocamlprof$(EXE)
+ cp ocamlcp $(BINDIR)/jocamlcp$(EXE)
cp profiling.cmi profiling.cmo $(LIBDIR)
clean::
rm -f ocamlprof ocamlcp
install::
- cp ocamlmktop $(BINDIR)/ocamlmktop$(EXE)
+ cp ocamlmktop $(BINDIR)/jocamlmktop$(EXE)
clean::
rm -f ocamlmktop
@@ -97,7 +96,7 @@ myocamlbuild_config.ml: ../config/Makefile ../build/mkmyocamlbuild_config.sh
cp ../myocamlbuild_config.ml .
install::
- cp ocamlmklib $(BINDIR)/ocamlmklib$(EXE)
+ cp ocamlmklib $(BINDIR)/jocamlmklib$(EXE)
clean::
rm -f ocamlmklib
@@ -121,7 +120,7 @@ clean::
# To make custom toplevels (see Makefile/Makefile.nt)
install::
- cp ocamlmktop $(BINDIR)/ocamlmktop$(EXE)
+ cp ocamlmktop $(BINDIR)/jocamlmktop$(EXE)
clean::
rm -f ocamlmktop
@@ -154,8 +153,8 @@ scrapelabels: $(SCRAPELABELS)
lexer301.ml: lexer301.mll
$(CAMLLEX) lexer301.mll
-install::
- cp scrapelabels $(LIBDIR)
+#install::
+# cp scrapelabels $(LIBDIR)
clean::
rm -f scrapelabels lexer301.ml
@@ -170,8 +169,8 @@ addlabels: addlabels.ml
$(CAMLC) $(LINKFLAGS) -w sl -o addlabels \
$(ADDLABELS_IMPORTS) addlabels.ml
-install::
- cp addlabels $(LIBDIR)
+#install::
+# cp addlabels $(LIBDIR)
clean::
rm -f addlabels
diff --git a/typing/ctype.ml b/typing/ctype.ml
index d3dbc8ca30..ceb3fe04b9 100644
--- a/typing/ctype.ml
+++ b/typing/ctype.ml
@@ -385,23 +385,32 @@ let closed_schema ty =
exception Non_closed of type_expr * bool
let free_variables = ref []
+let really_closed = ref None
let rec free_vars_rec real ty =
let ty = repr ty in
if ty.level >= lowest_level then begin
ty.level <- pivot_level - ty.level;
- begin match ty.desc with
- Tvar ->
+ begin match ty.desc, !really_closed with
+ Tvar, _ ->
free_variables := (ty, real) :: !free_variables
+ | Tconstr (path, tl, _), Some env ->
+ begin try
+ let (_, body) = Env.find_type_expansion path env in
+ if (repr body).level <> generic_level then
+ free_variables := (ty, real) :: !free_variables
+ with Not_found -> ()
+ end;
+ List.iter (free_vars_rec true) tl
(* Do not count "virtual" free variables
| Tobject(ty, {contents = Some (_, p)}) ->
free_vars_rec false ty; List.iter (free_vars_rec true) p
*)
- | Tobject (ty, _) ->
+ | Tobject (ty, _), _ ->
free_vars_rec false ty
- | Tfield (_, _, ty1, ty2) ->
+ | Tfield (_, _, ty1, ty2), _ ->
free_vars_rec true ty1; free_vars_rec false ty2
- | Tvariant row ->
+ | Tvariant row, _ ->
let row = row_repr row in
iter_row (free_vars_rec true) row;
if not (static_row row) then free_vars_rec false row.row_more
@@ -410,15 +419,17 @@ let rec free_vars_rec real ty =
end;
end
-let free_vars ty =
+let free_vars ?env ty =
free_variables := [];
+ really_closed := env;
free_vars_rec true ty;
let res = !free_variables in
free_variables := [];
+ really_closed := None;
res
-let free_variables ty =
- let tl = List.map fst (free_vars ty) in
+let free_variables ?env ty =
+ let tl = List.map fst (free_vars ?env ty) in
unmark_type ty;
tl
@@ -2074,7 +2085,7 @@ let rec moregen inst_nongen type_pairs env t1 t2 =
with Not_found ->
TypePairs.add type_pairs (t1', t2') ();
match (t1'.desc, t2'.desc) with
- (Tvar, _) when may_instantiate inst_nongen t1 ->
+ (Tvar, _) when may_instantiate inst_nongen t1' ->
moregen_occur env t1'.level t2;
link_type t1' t2
| (Tarrow (l1, t1, u1, _), Tarrow (l2, t2, u2, _)) when l1 = l2
@@ -3217,10 +3228,11 @@ let cyclic_abbrev env id ty =
in check_cycle [] ty
(* Normalize a type before printing, saving... *)
-let rec normalize_type_rec env ty =
+(* Cannot use mark_type because deep_occur uses it too *)
+let rec normalize_type_rec env visited ty =
let ty = repr ty in
- if ty.level >= lowest_level then begin
- mark_type_node ty;
+ if not (TypeSet.mem ty !visited) then begin
+ visited := TypeSet.add ty !visited;
begin match ty.desc with
| Tvariant row ->
let row = row_repr row in
@@ -3249,11 +3261,15 @@ let rec normalize_type_rec env ty =
begin match !nm with
| None -> ()
| Some (n, v :: l) ->
- let v' = repr v in
+ if deep_occur ty (newgenty (Ttuple l)) then
+ (* The abbreviation may be hiding something, so remove it *)
+ set_name nm None
+ else let v' = repr v in
begin match v'.desc with
| Tvar|Tunivar ->
if v' != v then set_name nm (Some (n, v' :: l))
- | Tnil -> log_type ty; ty.desc <- Tconstr (n, l, ref Mnil)
+ | Tnil ->
+ log_type ty; ty.desc <- Tconstr (n, l, ref Mnil)
| _ -> set_name nm None
end
| _ ->
@@ -3266,12 +3282,11 @@ let rec normalize_type_rec env ty =
log_type ty; fi.desc <- fi'.desc
| _ -> ()
end;
- iter_type_expr (normalize_type_rec env) ty
+ iter_type_expr (normalize_type_rec env visited) ty
end
let normalize_type env ty =
- normalize_type_rec env ty;
- unmark_type ty
+ normalize_type_rec env (ref TypeSet.empty) ty
(*************************)
@@ -3312,8 +3327,8 @@ let rec nondep_type_rec env id ty =
(recursive type), so one cannot just take its
description.
*)
- with Cannot_expand ->
- raise Not_found
+ with Cannot_expand | Unify _ -> (* expand_abbrev failed *)
+ raise Not_found (* cf. PR4775 for Unify *)
end
else
Tconstr(p, List.map (nondep_type_rec env id) tl, ref Mnil)
diff --git a/typing/ctype.mli b/typing/ctype.mli
index 74899df0cb..0ecce970f6 100644
--- a/typing/ctype.mli
+++ b/typing/ctype.mli
@@ -230,7 +230,8 @@ val closed_schema: type_expr -> bool
(* Check whether the given type scheme contains no non-generic
type variables *)
-val free_variables: type_expr -> type_expr list
+val free_variables: ?env:Env.t -> type_expr -> type_expr list
+ (* If env present, then check for incomplete definitions too *)
val closed_type_decl: type_declaration -> type_expr option
type closed_class_failure =
CC_Method of type_expr * bool * string * type_expr
diff --git a/typing/env.ml b/typing/env.ml
index e349207186..a953de2f13 100644
--- a/typing/env.ml
+++ b/typing/env.ml
@@ -96,19 +96,29 @@ let empty = {
continuations = Ident.empty;
summary = Env_empty }
-let diff_keys tbl1 tbl2 =
+let diff_keys is_local tbl1 tbl2 =
let keys2 = Ident.keys tbl2 in
List.filter
(fun id ->
- match Ident.find_same id tbl2 with Pident _, _ ->
- (try ignore (Ident.find_same id tbl1); false with Not_found -> true)
- | _ -> false)
+ is_local (Ident.find_same id tbl2) &&
+ try ignore (Ident.find_same id tbl1); false with Not_found -> true)
keys2
+let is_ident = function
+ Pident _ -> true
+ | Pdot _ | Papply _ -> false
+
+let is_local (p, _) = is_ident p
+
+let is_local_exn = function
+ {cstr_tag = Cstr_exception p} -> is_ident p
+ | _ -> false
+
let diff env1 env2 =
- diff_keys env1.values env2.values @
- diff_keys env1.modules env2.modules @
- diff_keys env1.classes env2.classes
+ diff_keys is_local env1.values env2.values @
+ diff_keys is_local_exn env1.constrs env2.constrs @
+ diff_keys is_local env1.modules env2.modules @
+ diff_keys is_local env1.classes env2.classes
(* Forward declarations *)
diff --git a/typing/includeclass.ml b/typing/includeclass.ml
index 49e0ce9d2e..007182a3d6 100644
--- a/typing/includeclass.ml
+++ b/typing/includeclass.ml
@@ -47,7 +47,7 @@ let include_err ppf =
fprintf ppf "@[%a@]"
(Printtyp.unification_error false trace
(function ppf ->
- fprintf ppf "One type parameter has type"))
+ fprintf ppf "A type parameter has type"))
(function ppf ->
fprintf ppf "but is expected to have type")
| CM_Class_type_mismatch (cty1, cty2) ->
@@ -58,7 +58,7 @@ let include_err ppf =
fprintf ppf "@[%a@]"
(Printtyp.unification_error false trace
(function ppf ->
- fprintf ppf "One parameter has type"))
+ fprintf ppf "A parameter has type"))
(function ppf ->
fprintf ppf "but is expected to have type")
| CM_Val_type_mismatch (lab, trace) ->
@@ -92,7 +92,7 @@ let include_err ppf =
| CM_Public_method lab ->
fprintf ppf "@[The public method %s cannot become private" lab
| CM_Virtual_method lab ->
- fprintf ppf "@[The virtual method %s cannot become concrete" lab
+ fprintf ppf "@[The virtual method %s cannot become concrete" lab
| CM_Private_method lab ->
fprintf ppf "The private method %s cannot become public" lab
diff --git a/typing/mtype.ml b/typing/mtype.ml
index 95c995dcde..b3a7c58fc6 100644
--- a/typing/mtype.ml
+++ b/typing/mtype.ml
@@ -51,11 +51,13 @@ and strengthen_sig env sg p =
match decl.type_manifest with
Some ty when decl.type_private = Public -> decl
| _ ->
- { decl with
- type_private = Public;
- type_manifest =
- Some(Btype.newgenty(Tconstr(Pdot(p, Ident.name id, nopos),
- decl.type_params, ref Mnil))) }
+ let manif =
+ Some(Btype.newgenty(Tconstr(Pdot(p, Ident.name id, nopos),
+ decl.type_params, ref Mnil))) in
+ if decl.type_kind = Type_abstract then
+ { decl with type_private = Public; type_manifest = manif }
+ else
+ { decl with type_manifest = manif }
in
Tsig_type(id, newdecl, rs) :: strengthen_sig env rem p
| (Tsig_exception(id, d) as sigelt) :: rem ->
diff --git a/typing/parmatch.ml b/typing/parmatch.ml
index 1597e810b8..31e1b57e41 100644
--- a/typing/parmatch.ml
+++ b/typing/parmatch.ml
@@ -113,13 +113,18 @@ and compats ps qs = match ps,qs with
exception Empty (* Empty pattern *)
+(* May need a clean copy, cf. PR#4745 *)
+let clean_copy ty =
+ if ty.level = Btype.generic_level then ty
+ else Subst.type_expr Subst.identity ty
+
let get_type_path ty tenv =
- let ty = Ctype.repr (Ctype.expand_head tenv ty) in
+ let ty = Ctype.repr (Ctype.expand_head tenv (clean_copy ty)) in
match ty.desc with
| Tconstr (path,_,_) -> path
| _ -> fatal_error "Parmatch.get_type_path"
-let get_type_descr ty tenv =
+let rec get_type_descr ty tenv =
match (Ctype.repr ty).desc with
| Tconstr (path,_,_) -> Env.find_type path tenv
| _ -> fatal_error "Parmatch.get_type_descr"
@@ -129,7 +134,7 @@ let rec get_constr tag ty tenv =
| {type_kind=Type_variant constr_list} ->
Datarepr.find_constr_by_tag tag constr_list
| {type_manifest = Some _} ->
- get_constr tag (Ctype.expand_head_once tenv ty) tenv
+ get_constr tag (Ctype.expand_head_once tenv (clean_copy ty)) tenv
| _ -> fatal_error "Parmatch.get_constr"
let find_label lbl lbls =
@@ -142,7 +147,7 @@ let rec get_record_labels ty tenv =
match get_type_descr ty tenv with
| {type_kind = Type_record(lbls, rep)} -> lbls
| {type_manifest = Some _} ->
- get_record_labels (Ctype.expand_head_once tenv ty) tenv
+ get_record_labels (Ctype.expand_head_once tenv (clean_copy ty)) tenv
| _ -> fatal_error "Parmatch.get_record_labels"
diff --git a/typing/subst.ml b/typing/subst.ml
index 6b1282697a..833b3634aa 100644
--- a/typing/subst.ml
+++ b/typing/subst.ml
@@ -294,3 +294,12 @@ and signature_component s comp newid =
and modtype_declaration s = function
Tmodtype_abstract -> Tmodtype_abstract
| Tmodtype_manifest mty -> Tmodtype_manifest(modtype s mty)
+
+(* Composition of substitutions:
+ apply (compose s1 s2) x = apply s2 (apply s1 x) *)
+
+let compose s1 s2 =
+ { types = Tbl.map (fun id p -> type_path s2 p) s1.types;
+ modules = Tbl.map (fun id p -> module_path s2 p) s1.modules;
+ modtypes = Tbl.map (fun id mty -> modtype s2 mty) s1.modtypes;
+ for_saving = false }
diff --git a/typing/subst.mli b/typing/subst.mli
index d313853251..02ecf2054b 100644
--- a/typing/subst.mli
+++ b/typing/subst.mli
@@ -52,3 +52,7 @@ val cltype_declaration: t -> cltype_declaration -> cltype_declaration
val modtype: t -> module_type -> module_type
val signature: t -> signature -> signature
val modtype_declaration: t -> modtype_declaration -> modtype_declaration
+
+(* Composition of substitutions:
+ apply (compose s1 s2) x = apply s2 (apply s1 x) *)
+val compose: t -> t -> t
diff --git a/typing/typeclass.ml b/typing/typeclass.ml
index 03b3b62171..7f6c1de241 100644
--- a/typing/typeclass.ml
+++ b/typing/typeclass.ml
@@ -1574,12 +1574,12 @@ let report_error ppf = function
fprintf ppf
"@[The type of self cannot be coerced to@ \
the type of the current class:@ %a.@.\
- Some occurences are contravariant@]"
+ Some occurrences are contravariant@]"
Printtyp.type_scheme ty
| Non_collapsable_conjunction (id, clty, trace) ->
fprintf ppf
"@[The type of this class,@ %a,@ \
- contains non-collapsable conjunctive types in constraints@]"
+ contains non-collapsible conjunctive types in constraints@]"
(Printtyp.class_declaration id) clty;
Printtyp.report_unification_error ppf trace
(fun ppf -> fprintf ppf "Type")
@@ -1589,11 +1589,11 @@ let report_error ppf = function
(function ppf ->
fprintf ppf "This object is expected to have type")
(function ppf ->
- fprintf ppf "but has actually type")
+ fprintf ppf "but actually has type")
| Mutability_mismatch (lab, mut) ->
let mut1, mut2 =
if mut = Immutable then "mutable", "immutable"
else "immutable", "mutable" in
fprintf ppf
- "@[The instance variable is %s,@ it cannot be redefined as %s@]"
+ "@[The instance variable is %s;@ it cannot be redefined as %s@]"
mut1 mut2
diff --git a/typing/typecore.ml b/typing/typecore.ml
index 7d41c3277b..694c68519e 100644
--- a/typing/typecore.ml
+++ b/typing/typecore.ml
@@ -1605,10 +1605,11 @@ and do_type_exp ctx env sexp =
begin match arg.exp_desc, !self_coercion, (repr ty').desc with
Texp_ident(_, {val_kind=Val_self _}), (path,r) :: _,
Tconstr(path',_,_) when Path.same path path' ->
+ (* prerr_endline "self coercion"; *)
r := sexp.pexp_loc :: !r;
force ()
- | _ when free_variables arg.exp_type = []
- && free_variables ty' = [] ->
+ | _ when free_variables ~env arg.exp_type = []
+ && free_variables ~env ty' = [] ->
if not gen && (* first try a single coercion *)
let snap = snapshot () in
let ty, b = enlarge_type env ty' in
@@ -1624,6 +1625,7 @@ and do_type_exp ctx env sexp =
Location.prerr_warning sexp.pexp_loc
(Warnings.Not_principal "this ground coercion");
with Subtype (tr1, tr2) ->
+ (* prerr_endline "coercion failed"; *)
raise(Error(sexp.pexp_loc, Not_subtype(tr1, tr2)))
end;
| _ ->
@@ -2743,7 +2745,7 @@ let report_error ppf = function
| Constructor_arity_mismatch(lid, expected, provided) ->
fprintf ppf
"@[The constructor %a@ expects %i argument(s),@ \
- but is here applied to %i argument(s)@]"
+ but is applied here to %i argument(s)@]"
longident lid expected provided
| Label_mismatch(lid, trace) ->
report_unification_error ppf trace
@@ -2751,13 +2753,13 @@ let report_error ppf = function
fprintf ppf "The record field label %a@ belongs to the type"
longident lid)
(function ppf ->
- fprintf ppf "but is here mixed with labels of type")
+ fprintf ppf "but is mixed here with labels of type")
| Pattern_type_clash trace ->
report_unification_error ppf trace
(function ppf ->
fprintf ppf "This pattern matches values of type")
(function ppf ->
- fprintf ppf "but is here used to match values of type")
+ fprintf ppf "but a pattern was expected which matches values of type")
| Multiply_bound_variable name ->
fprintf ppf "Variable %s is bound several times in this matching" name
| Orpat_vars id ->
@@ -2768,15 +2770,15 @@ let report_error ppf = function
(function ppf ->
fprintf ppf "This expression has type")
(function ppf ->
- fprintf ppf "but is here used with type")
+ fprintf ppf "but an expression was expected of type")
| Apply_non_function typ ->
begin match (repr typ).desc with
Tarrow _ ->
- fprintf ppf "This function is applied to too many arguments,@ ";
+ fprintf ppf "This function is applied to too many arguments;@ ";
fprintf ppf "maybe you forgot a `;'"
| _ ->
fprintf ppf
- "This expression is not a function, it cannot be applied"
+ "This expression is not a function; it cannot be applied"
end
| Apply_wrong_label (l, ty) ->
let print_label ppf = function
@@ -2786,7 +2788,7 @@ let report_error ppf = function
in
reset_and_mark_loops ty;
fprintf ppf
- "@[<v>@[<2>Expecting function has type@ %a@]@.\
+ "@[<v>@[<2>The function applied to this argument has type@ %a@]@.\
This argument cannot be applied %a@]"
type_expr ty print_label l
| Label_multiply_defined lid ->
@@ -2814,14 +2816,14 @@ let report_error ppf = function
| Unbound_class cl ->
fprintf ppf "Unbound class %a" longident cl
| Virtual_class cl ->
- fprintf ppf "One cannot create instances of the virtual class %a"
+ fprintf ppf "Cannot instantiate the virtual class %a"
longident cl
| Unbound_instance_variable v ->
fprintf ppf "Unbound instance variable %s" v
| Instance_variable_not_mutable v ->
fprintf ppf "The instance variable %s is not mutable" v
| Not_subtype(tr1, tr2) ->
- report_subtyping_error ppf tr1 "is not a subtype of type" tr2
+ report_subtyping_error ppf tr1 "is not a subtype of" tr2
| Outside_class ->
fprintf ppf "This object duplication occurs outside a method definition"
| Value_multiply_overridden v ->
@@ -2852,8 +2854,8 @@ let report_error ppf = function
end
| Abstract_wrong_label (l, ty) ->
let label_mark = function
- | "" -> "but its first argument is not labeled"
- | l -> sprintf "but its first argument is labeled ~%s" l in
+ | "" -> "but its first argument is not labelled"
+ | l -> sprintf "but its first argument is labelled ~%s" l in
reset_and_mark_loops ty;
fprintf ppf "@[<v>@[<2>This function should have type@ %a@]@,%s@]"
type_expr ty (label_mark l)
diff --git a/typing/typedecl.ml b/typing/typedecl.ml
index cdf77652ac..8bad0ef504 100644
--- a/typing/typedecl.ml
+++ b/typing/typedecl.ml
@@ -41,6 +41,7 @@ type error =
| Bad_variance of int * (bool * bool) * (bool * bool)
| Unavailable_type_constructor of Path.t
| Bad_fixed_type of string
+ | Unbound_type_var_exc of type_expr * type_expr
exception Error of Location.t * error
@@ -510,14 +511,13 @@ let compute_variance_decl env check decl (required, loc) =
compute_variance env tvl true cn cn ty)
ftl
end;
- let priv = decl.type_private
- and required =
+ let required =
List.map (fun (c,n as r) -> if c || n then r else (true,true))
required
in
List.iter2
(fun (ty, co, cn, ct) (c, n) ->
- if ty.desc <> Tvar || priv = Private then begin
+ if ty.desc <> Tvar then begin
co := c; cn := n; ct := n;
compute_variance env tvl2 c n n ty
end)
@@ -536,6 +536,7 @@ let compute_variance_decl env check decl (required, loc) =
incr pos;
if !co && not c || !cn && not n
then raise (Error(loc, Bad_variance (!pos, (!co,!cn), (c,n))));
+ if decl.type_private = Private then (c,n,n) else
let ct = if decl.type_kind = Type_abstract then ct else cn in
(!co, !cn, !ct))
tvl0 required
@@ -687,10 +688,16 @@ let transl_type_decl env name_sdecl_list =
(final_decls, final_env)
(* Translate an exception declaration *)
+let transl_closed_type env sty =
+ let ty = transl_simple_type env true sty in
+ match Ctype.free_variables ty with
+ | [] -> ty
+ | tv :: _ -> raise (Error (sty.ptyp_loc, Unbound_type_var_exc (tv, ty)))
+
let transl_exception env excdecl =
reset_type_variables();
Ctype.begin_def();
- let types = List.map (transl_simple_type env true) excdecl in
+ let types = List.map (transl_closed_type env) excdecl in
Ctype.end_def();
List.iter Ctype.generalize types;
types
@@ -820,6 +827,38 @@ let check_recmod_typedecl env loc recmod_ids path decl =
open Format
+let explain_unbound ppf tv tl typ kwd lab =
+ try
+ let ti = List.find (fun ti -> Ctype.deep_occur tv (typ ti)) tl in
+ let ty0 = (* Hack to force aliasing when needed *)
+ Btype.newgenty (Tobject(tv, ref None)) in
+ Printtyp.reset_and_mark_loops_list [typ ti; ty0];
+ fprintf ppf
+ ".@.@[<hov2>In %s@ %s%a@;<1 -2>the variable %a is unbound@]"
+ kwd (lab ti) Printtyp.type_expr (typ ti) Printtyp.type_expr tv
+ with Not_found -> ()
+
+let explain_unbound_single ppf tv ty =
+ let trivial ty =
+ explain_unbound ppf tv [ty] (fun t -> t) "type" (fun _ -> "") in
+ match (Ctype.repr ty).desc with
+ Tobject(fi,_) ->
+ let (tl, rv) = Ctype.flatten_fields fi in
+ if rv == tv then trivial ty else
+ explain_unbound ppf tv tl (fun (_,_,t) -> t)
+ "method" (fun (lab,_,_) -> lab ^ ": ")
+ | Tvariant row ->
+ let row = Btype.row_repr row in
+ if row.row_more == tv then trivial ty else
+ explain_unbound ppf tv row.row_fields
+ (fun (l,f) -> match Btype.row_field_repr f with
+ Rpresent (Some t) -> t
+ | Reither (_,[t],_,_) -> t
+ | Reither (_,tl,_,_) -> Btype.newgenty (Ttuple tl)
+ | _ -> Btype.newgenty (Ttuple[]))
+ "case" (fun (lab,_) -> "`" ^ lab ^ " of ")
+ | _ -> trivial ty
+
let report_error ppf = function
| Repeated_parameter ->
fprintf ppf "A type parameter occurs several times"
@@ -860,56 +899,30 @@ let report_error ppf = function
(function ppf ->
fprintf ppf "This type constructor expands to type")
(function ppf ->
- fprintf ppf "but is here used with type")
+ fprintf ppf "but is used here with type")
| Null_arity_external ->
fprintf ppf "External identifiers must be functions"
| Missing_native_external ->
fprintf ppf "@[<hv>An external function with more than 5 arguments \
- requires second stub function@ \
+ requires a second stub function@ \
for native-code compilation@]"
| Unbound_type_var (ty, decl) ->
fprintf ppf "A type variable is unbound in this type declaration";
let ty = Ctype.repr ty in
- let explain tl typ kwd lab =
- let ti = List.find (fun ti -> Ctype.deep_occur ty (typ ti)) tl in
- let ty0 = (* Hack to force aliasing when needed *)
- Btype.newgenty (Tobject(ty, ref None)) in
- Printtyp.reset_and_mark_loops_list [typ ti; ty0];
- fprintf ppf
- ".@.@[<hov2>In %s@ %s%a@;<1 -2>the variable %a is unbound@]"
- kwd (lab ti) Printtyp.type_expr (typ ti) Printtyp.type_expr ty
- in
- begin try match decl.type_kind, decl.type_manifest with
+ begin match decl.type_kind, decl.type_manifest with
Type_variant tl, _ ->
- explain tl (fun (_,tl) -> Btype.newgenty (Ttuple tl))
+ explain_unbound ppf ty tl (fun (_,tl) -> Btype.newgenty (Ttuple tl))
"case" (fun (lab,_) -> lab ^ " of ")
| Type_record (tl, _), _ ->
- explain tl (fun (_,_,t) -> t)
+ explain_unbound ppf ty tl (fun (_,_,t) -> t)
"field" (fun (lab,_,_) -> lab ^ ": ")
| Type_abstract, Some ty' ->
- let trivial ty =
- explain [ty] (fun t -> t) "definition" (fun _ -> "") in
- begin match (Ctype.repr ty').desc with
- Tobject(fi,_) ->
- let (tl, rv) = Ctype.flatten_fields fi in
- if rv == ty then trivial ty' else
- explain tl (fun (_,_,t) -> t)
- "method" (fun (lab,_,_) -> lab ^ ": ")
- | Tvariant row ->
- let row = Btype.row_repr row in
- if row.row_more == ty then trivial ty' else
- explain row.row_fields
- (fun (l,f) -> match Btype.row_field_repr f with
- Rpresent (Some t) -> t
- | Reither (_,[t],_,_) -> t
- | Reither (_,tl,_,_) -> Btype.newgenty (Ttuple tl)
- | _ -> Btype.newgenty (Ttuple[]))
- "case" (fun (lab,_) -> "`" ^ lab ^ " of ")
- | _ -> trivial ty'
- end
+ explain_unbound_single ppf ty ty'
| _ -> ()
- with Not_found -> ()
end
+ | Unbound_type_var_exc (tv, ty) ->
+ fprintf ppf "A type variable is unbound in this exception declaration";
+ explain_unbound_single ppf (Ctype.repr tv) ty
| Unbound_exception lid ->
fprintf ppf "Unbound exception constructor@ %a" Printtyp.longident lid
| Not_an_exception lid ->
@@ -922,16 +935,24 @@ let report_error ppf = function
| (false,true) -> "contravariant"
| (false,false) -> "unrestricted"
in
+ let suffix n =
+ let teen = (n mod 100)/10 = 1 in
+ match n mod 10 with
+ | 1 when not teen -> "st"
+ | 2 when not teen -> "nd"
+ | 3 when not teen -> "rd"
+ | _ -> "th"
+ in
if n < 1 then
fprintf ppf "%s@ %s@ %s"
"In this definition, a type variable"
"has a variance that is not reflected"
- "by its occurence in type parameters."
+ "by its occurrence in type parameters."
else
fprintf ppf "%s@ %s@ %s %d%s %s %s,@ %s %s"
"In this definition, expected parameter"
"variances are not satisfied."
- "The" n (match n with 1 -> "st" | 2 -> "nd" | 3 -> "rd" | _ -> "th")
+ "The" n (suffix n)
"type parameter was expected to be" (variance v2)
"but it is" (variance v1)
| Unavailable_type_constructor p ->
diff --git a/typing/typedecl.mli b/typing/typedecl.mli
index e23434c7f0..5bb928b1ea 100644
--- a/typing/typedecl.mli
+++ b/typing/typedecl.mli
@@ -75,6 +75,7 @@ type error =
| Bad_variance of int * (bool*bool) * (bool*bool)
| Unavailable_type_constructor of Path.t
| Bad_fixed_type of string
+ | Unbound_type_var_exc of type_expr * type_expr
exception Error of Location.t * error
diff --git a/typing/typetexp.ml b/typing/typetexp.ml
index fa3f0c895a..ec2b7ed8df 100644
--- a/typing/typetexp.ml
+++ b/typing/typetexp.ml
@@ -355,12 +355,8 @@ let rec transl_type env policy styp =
row_fixed = false; row_name = !name } in
let static = Btype.static_row row in
let row =
- if static then row else
- match policy with
- Fixed ->
- raise (Error (styp.ptyp_loc, Unbound_type_variable ".."))
- | Extensible -> row
- | Univars -> { row with row_more = new_pre_univar () }
+ if static || policy <> Univars then row
+ else { row with row_more = new_pre_univar () }
in
newty (Tvariant row)
| Ptyp_poly(vars, st) ->
@@ -392,12 +388,8 @@ and transl_fields env policy =
function
[] ->
newty Tnil
- | ({pfield_desc = Pfield_var} as pf)::_ ->
- begin match policy with
- Fixed -> raise (Error (pf.pfield_loc, Unbound_type_variable ".."))
- | Extensible -> newvar ()
- | Univars -> new_pre_univar ()
- end
+ | {pfield_desc = Pfield_var}::_ ->
+ if policy = Univars then new_pre_univar () else newvar ()
| {pfield_desc = Pfield(s, e)}::l ->
let ty1 = transl_type env policy e in
let ty2 = transl_fields env policy l in
@@ -556,7 +548,7 @@ let report_error ppf = function
Printtyp.type_expr ty
| Variant_tags (lab1, lab2) ->
fprintf ppf
- "Variant tags `%s@ and `%s have same hash value.@ Change one of them."
+ "Variant tags `%s@ and `%s have the same hash value.@ Change one of them."
lab1 lab2
| Invalid_variable_name name ->
fprintf ppf "The type variable name %s is not allowed in programs" name
diff --git a/utils/config.mlbuild b/utils/config.mlbuild
index 18dbbf32ff..ea10032d7a 100644
--- a/utils/config.mlbuild
+++ b/utils/config.mlbuild
@@ -12,6 +12,16 @@
(* $Id$ *)
+(***********************************************************************)
+(** **)
+(** WARNING WARNING WARNING **)
+(** **)
+(** When you change this file, you must make the parallel change **)
+(** in config.mlp **)
+(** **)
+(***********************************************************************)
+
+
(* The main OCaml version string has moved to ../VERSION *)
let version = Sys.ocaml_version
@@ -40,10 +50,8 @@ let standard_runtime =
else C.bindir^"/ocamlrun"
let ccomp_type = C.ccomptype
let bytecomp_c_compiler = sf "%s %s %s" C.bytecc C.bytecccompopts C.sharedcccompopts
-let bytecomp_c_linker = if windows then "flexlink" else sf "%s %s" C.bytecc C.bytecclinkopts
let bytecomp_c_libraries = C.bytecclibs
let native_c_compiler = sf "%s %s" C.nativecc C.nativecccompopts
-let native_c_linker = if windows then "flexlink" else sf "%s %s" C.nativecc C.nativecclinkopts
let native_c_libraries = C.nativecclibs
let native_pack_linker = C.packld
let ranlib = C.ranlibcmd
@@ -54,8 +62,8 @@ let mkmaindll = C.mkmaindll
let exec_magic_number = "Caml1999X008"
and cmi_magic_number = "Caml1999I011"
-and cmo_magic_number = "Caml1999O006"
-and cma_magic_number = "Caml1999A007"
+and cmo_magic_number = "Caml1999O007"
+and cma_magic_number = "Caml1999A008"
and cmx_magic_number = "Caml1999Y011"
and cmxa_magic_number = "Caml1999Z010"
and ast_impl_magic_number = "Caml1999M012"
@@ -102,10 +110,8 @@ let print_config oc =
p "standard_runtime" standard_runtime;
p "ccomp_type" ccomp_type;
p "bytecomp_c_compiler" bytecomp_c_compiler;
- p "bytecomp_c_linker" bytecomp_c_linker;
p "bytecomp_c_libraries" bytecomp_c_libraries;
p "native_c_compiler" native_c_compiler;
- p "native_c_linker" native_c_linker;
p "native_c_libraries" native_c_libraries;
p "native_pack_linker" native_pack_linker;
p "ranlib" ranlib;
diff --git a/utils/config.mlp b/utils/config.mlp
index 90e8390b6f..75d36cc45c 100644
--- a/utils/config.mlp
+++ b/utils/config.mlp
@@ -12,6 +12,16 @@
(* $Id$ *)
+(***********************************************************************)
+(** **)
+(** WARNING WARNING WARNING **)
+(** **)
+(** When you change this file, you must make the parallel change **)
+(** in config.mlbuild **)
+(** **)
+(***********************************************************************)
+
+
(* The main OCaml version string has moved to ../VERSION *)
let version = Sys.ocaml_version
@@ -45,8 +55,8 @@ let mkmaindll = "%%MKMAINDLL%%"
let exec_magic_number = "Caml1999X008"
and cmi_magic_number = "Caml1999I011"
-and cmo_magic_number = "Caml1999O006"
-and cma_magic_number = "Caml1999A007"
+and cmo_magic_number = "Caml1999O007"
+and cma_magic_number = "Caml1999A008"
and cmx_magic_number = "Caml1999Y011"
and cmxa_magic_number = "Caml1999Z010"
and ast_impl_magic_number = "Caml1999M012"
diff --git a/utils/tbl.ml b/utils/tbl.ml
index 95aa973485..d6689f088d 100644
--- a/utils/tbl.ml
+++ b/utils/tbl.ml
@@ -95,6 +95,10 @@ let rec iter f = function
| Node(l, v, d, r, _) ->
iter f l; f v d; iter f r
+let rec map f = function
+ Empty -> Empty
+ | Node(l, v, d, r, h) -> Node(map f l, v, f v d, map f r, h)
+
open Format
let print print_key print_data ppf tbl =
diff --git a/utils/tbl.mli b/utils/tbl.mli
index ddeaa79d6a..71c348efae 100644
--- a/utils/tbl.mli
+++ b/utils/tbl.mli
@@ -23,6 +23,7 @@ val find: 'a -> ('a, 'b) t -> 'b
val mem: 'a -> ('a, 'b) t -> bool
val remove: 'a -> ('a, 'b) t -> ('a, 'b) t
val iter: ('a -> 'b -> 'c) -> ('a, 'b) t -> unit
+val map: ('a -> 'b -> 'c) -> ('a, 'b) t -> ('a, 'c) t
open Format
diff --git a/yacc/reader.c b/yacc/reader.c
index 6c8e4a2788..d3c2755720 100644
--- a/yacc/reader.c
+++ b/yacc/reader.c
@@ -163,6 +163,7 @@ char *substring (char *str, int start, int len)
for (i = 0; i < len; i++){
buf[i] = str[start+i];
}
+ buf[i] = '\0'; /* PR#4796 */
return buf;
}
@@ -710,7 +711,7 @@ get_literal(void)
n = cinc;
s = MALLOC(n);
if (s == 0) no_space();
-
+
for (i = 0; i < n; ++i)
s[i] = cache[i];
@@ -1306,7 +1307,7 @@ loop:
{
++cptr;
i = get_number();
-
+
if (i <= 0 || i > n)
unknown_rhs(i);
item = pitem[nitems + i - n - 1];
@@ -1393,7 +1394,7 @@ loop:
fwrite(cptr, 1, 2, f);
cptr += 2;
} else
- if (cptr[0] == '\\'
+ if (cptr[0] == '\\'
&& isdigit((unsigned char) cptr[1])
&& isdigit((unsigned char) cptr[2])
&& isdigit((unsigned char) cptr[3])