summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralainfrisch <alain@frisch.fr>2015-11-03 21:03:07 +0100
committeralainfrisch <alain@frisch.fr>2015-11-03 21:03:07 +0100
commit364f1cb79ff8d0ac51ba2b8cb3a52503858ad238 (patch)
treef85574c5977dfec6fb860ec3be3a2e53ce923ee3
parent1f3eac9b94b7c7f399bb94cd3d8715d86829baab (diff)
parent8fee9d45e1637ff7fc84fecdfb49b22bf13441c9 (diff)
downloadocaml-364f1cb79ff8d0ac51ba2b8cb3a52503858ad238.tar.gz
Merge branch 'trunk' of github.com:ocaml/ocaml into unbox_classify_float
-rw-r--r--.gitattributes29
-rw-r--r--CONTRIBUTING.md3
-rw-r--r--Changes12
-rwxr-xr-xboot/ocamlcbin1826168 -> 1828690 bytes
-rwxr-xr-xboot/ocamldepbin574006 -> 573791 bytes
-rwxr-xr-xboot/ocamllexbin259310 -> 259367 bytes
-rw-r--r--bytecomp/translcore.ml3
-rw-r--r--bytecomp/translmod.ml11
-rw-r--r--byterun/caml/fix_code.h2
-rw-r--r--byterun/fix_code.c4
-rw-r--r--byterun/ints.c62
-rw-r--r--byterun/obj.c6
-rw-r--r--otherlibs/unix/execv.c2
-rw-r--r--otherlibs/unix/execve.c2
-rw-r--r--otherlibs/unix/execvp.c1
-rw-r--r--otherlibs/unix/gethost.c6
-rw-r--r--otherlibs/unix/unixsupport.h2
-rw-r--r--otherlibs/win32unix/unixsupport.h1
-rw-r--r--parsing/lexer.mll4
-rw-r--r--parsing/pprintast.ml142
-rw-r--r--stdlib/camlinternalFormat.ml103
-rw-r--r--stdlib/camlinternalFormat.mli2
-rw-r--r--stdlib/format.ml5
-rw-r--r--stdlib/int32.ml16
-rw-r--r--stdlib/int32.mli16
-rw-r--r--stdlib/int64.ml16
-rw-r--r--stdlib/int64.mli16
-rw-r--r--stdlib/nativeint.ml8
-rw-r--r--stdlib/nativeint.mli8
-rw-r--r--stdlib/printf.ml2
-rw-r--r--testsuite/tests/asmcomp/main.c27
-rw-r--r--testsuite/tests/asmcomp/mainarith.c4
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/stub1.c2
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/stub2.c4
-rw-r--r--testsuite/tests/unboxed-primitive-args/common.ml2
-rw-r--r--testsuite/tests/unboxed-primitive-args/test_common.c4
-rwxr-xr-xtools/check-typo37
-rwxr-xr-xtools/ci-build2
-rw-r--r--yacc/closure.c6
-rw-r--r--yacc/lr0.c2
40 files changed, 387 insertions, 187 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000..01189dde01
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,29 @@
+boot/ocamlc binary
+boot/ocamllex binary
+boot/ocamldep binary
+
+Changes ocaml-typo=non-ascii,missing-header
+CONTRIBUTING.md ocaml-typo=missing-header
+INSTALL ocaml-typo=missing-header
+LICENSE ocaml-typo=non-printing,missing-header
+
+asmcomp/*/emit.mlp ocaml-typo=tab,long-line
+
+asmrun/i386.S ocaml-typo=long-line
+
+config/gnu ocaml-typo=prune
+
+emacs/*.el ocaml-typo=long-line
+emacs/COPYING ocaml-typo=tab,non-printing,missing-header
+emacs/ocamltags.in ocaml-typo=non-printing
+emacs/README* ocaml-typo=missing-header
+
+experimental ocaml-typo=prune
+
+ocamlbuild/* ocaml-typo=long-line
+ocamlbuild/AUTHORS ocaml-typo=missing-header
+ocamlbuild/ChangeLog ocaml-typo=tab,missing-header
+ocamlbuild/TODO ocaml-typo=missing-header
+
+ocamldoc/Changes.txt ocaml-typo=missing-header
+ocamldoc/ocamldoc.sty ocaml-typo=missing-header
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e821fd5332..85d1af61f5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -163,6 +163,9 @@ Any user-visible change should have a Changelog entry:
- with the issue number `PR#{N}` if from mantis, `GPR#{N}` if from github
(several numbers separated by commas can be used)
+- maintaining the order: each section lists Mantis PRs first in ascending
+ numerical order, followed by Github PRs
+
- with a concise readable description of the change (possibly taken
from a commit message, but it should make sense to end-users
reading release notes)
diff --git a/Changes b/Changes
index c76c2b7c55..4db7d425d7 100644
--- a/Changes
+++ b/Changes
@@ -86,6 +86,10 @@ Compilers:
(Alain Frisch)
- GPR#263: improve code generation for if-equivalents of (&&) and (||)
(Pierre Chambart)
+- GPR#271: Fix incorrect mutability flag when records are built using "with"
+ (Mark Shinwell)
+- GPR#270: Make [transl_exception_constructor] generate [Immutable] blocks
+ (Mark Shinwell)
Runtime system:
- PR#3612: allow allocating custom block with finalizers in the minor heap
@@ -105,6 +109,8 @@ Runtime system:
Shinwell, review by Damien Doligez)
Standard library:
+- PR#6017, PR#7034, GPR#267: More efficient ifprintf implementation
+ (Jeremy Yallop, review by Gabriel Scherer)
- PR#6316: Scanf.scanf failure on %u formats when reading big integers
(Xavier Leroy, Benoît Vaugon)
- PR#6390, GPR#36: expose Sys.{int_size,max_wosize} for improved js_of_ocaml
@@ -138,6 +144,10 @@ Standard library:
(report and fix by Jeremy Yallop)
- GPR#265: new implementation of Queue avoiding Obj.magic
(Jérémie Dimino)
+- GPR#277: Switch the following externals to [@@unboxed]:
+ * {Nativeint,Int32,Int64}.{of,to}_float
+ * Int{32,64}.float_of_bits
+ * Int{32,64}.bits_of_float
Type system:
- PR#5545: Type annotations on methods cannot control the choice of abbreviation
@@ -219,6 +229,8 @@ Bug fixes:
- PR#6944: let module X = Path in … is not typed as a module alias
(Jacques Garrigue, report by def)
- PR#6954: Infinite loop in type checker with module aliases
+- PR#6972, GPR#276: 4.02.3 regression on documentation comments in .cmt files
+ (Leo White, report by Olivier Andrieu)
- PR#6982: unexpected type error when packing a module alias
- PR#6985: `module type of struct include Bar end exposes
%s#row when Bar contains private row types
diff --git a/boot/ocamlc b/boot/ocamlc
index 33d3b3a828..ba32993f0b 100755
--- a/boot/ocamlc
+++ b/boot/ocamlc
Binary files differ
diff --git a/boot/ocamldep b/boot/ocamldep
index 844584aaf9..4a47869bcc 100755
--- a/boot/ocamldep
+++ b/boot/ocamldep
Binary files differ
diff --git a/boot/ocamllex b/boot/ocamllex
index bae5a2a708..911786114f 100755
--- a/boot/ocamllex
+++ b/boot/ocamllex
Binary files differ
diff --git a/bytecomp/translcore.ml b/bytecomp/translcore.ml
index 0d2721d2ca..bf810f32f3 100644
--- a/bytecomp/translcore.ml
+++ b/bytecomp/translcore.ml
@@ -1170,7 +1170,8 @@ and transl_record env all_labels repres lbl_expr_list opt_init_expr =
lbl_expr_list;
let ll = Array.to_list lv in
let mut =
- if List.exists (fun (_, lbl, expr) -> lbl.lbl_mut = Mutable) lbl_expr_list
+ if List.exists (fun lbl -> lbl.lbl_mut = Mutable)
+ (Array.to_list all_labels)
then Mutable
else Immutable in
let lam =
diff --git a/bytecomp/translmod.ml b/bytecomp/translmod.ml
index 7d0887464e..de0392b399 100644
--- a/bytecomp/translmod.ml
+++ b/bytecomp/translmod.ml
@@ -45,8 +45,8 @@ let field_path path field =
(* Compile type extensions *)
-let prim_set_oo_id =
- Pccall (Primitive.simple ~name:"caml_set_oo_id" ~arity:1 ~alloc:false)
+let prim_fresh_oo_id =
+ Pccall (Primitive.simple ~name:"caml_fresh_oo_id" ~arity:1 ~alloc:false)
let transl_extension_constructor env path ext =
let name =
@@ -56,10 +56,9 @@ let transl_extension_constructor env path ext =
in
match ext.ext_kind with
Text_decl(args, ret) ->
- Lprim(prim_set_oo_id,
- [Lprim(Pmakeblock(Obj.object_tag, Mutable),
- [Lconst(Const_base(Const_string (name,None)));
- Lconst(Const_base(Const_int 0))])])
+ Lprim (Pmakeblock (Obj.object_tag, Immutable),
+ [Lconst (Const_base (Const_string (name, None)));
+ Lprim (prim_fresh_oo_id, [Lconst (Const_base (Const_int 0))])])
| Text_rebind(path, lid) ->
transl_path ~loc:ext.ext_loc env path
diff --git a/byterun/caml/fix_code.h b/byterun/caml/fix_code.h
index 419ad327a5..c639894523 100644
--- a/byterun/caml/fix_code.h
+++ b/byterun/caml/fix_code.h
@@ -25,7 +25,7 @@ extern code_t caml_start_code;
extern asize_t caml_code_size;
extern unsigned char * caml_saved_code;
-void caml_init_code_fragments();
+void caml_init_code_fragments(void);
void caml_load_code (int fd, asize_t len);
void caml_fixup_endianness (code_t code, asize_t len);
void caml_set_instruction (code_t pos, opcode_t instr);
diff --git a/byterun/fix_code.c b/byterun/fix_code.c
index 99a400cb83..0d7c8cbaf9 100644
--- a/byterun/fix_code.c
+++ b/byterun/fix_code.c
@@ -35,7 +35,7 @@ unsigned char * caml_saved_code;
/* Read the main bytecode block from a file */
-void caml_init_code_fragments() {
+void caml_init_code_fragments(void) {
struct code_fragment * cf;
/* Register the code in the table of code fragments */
cf = caml_stat_alloc(sizeof(struct code_fragment));
@@ -96,7 +96,7 @@ char ** caml_instr_table;
char * caml_instr_base;
static int* opcode_nargs = NULL;
-int* caml_init_opcode_nargs()
+int* caml_init_opcode_nargs(void)
{
if( opcode_nargs == NULL ){
int* l = (int*)caml_stat_alloc(sizeof(int) * FIRST_UNIMPLEMENTED_OP);
diff --git a/byterun/ints.c b/byterun/ints.c
index bfc622fcf5..d0842cb542 100644
--- a/byterun/ints.c
+++ b/byterun/ints.c
@@ -293,9 +293,15 @@ CAMLprim value caml_int32_of_int(value v)
CAMLprim value caml_int32_to_int(value v)
{ return Val_long(Int32_val(v)); }
+int32_t caml_int32_of_float_unboxed(double x)
+{ return x; }
+
CAMLprim value caml_int32_of_float(value v)
{ return caml_copy_int32((int32_t)(Double_val(v))); }
+double caml_int32_to_float_unboxed(int32_t x)
+{ return x; }
+
CAMLprim value caml_int32_to_float(value v)
{ return caml_copy_double((double)(Int32_val(v))); }
@@ -320,18 +326,28 @@ CAMLprim value caml_int32_of_string(value s)
return caml_copy_int32(parse_intnat(s, 32, INT32_ERRMSG));
}
-CAMLprim value caml_int32_bits_of_float(value vd)
+int32_t caml_int32_bits_of_float_unboxed(double d)
{
union { float d; int32_t i; } u;
- u.d = Double_val(vd);
- return caml_copy_int32(u.i);
+ u.d = d;
+ return u.i;
}
-CAMLprim value caml_int32_float_of_bits(value vi)
+double caml_int32_float_of_bits_unboxed(int32_t i)
{
union { float d; int32_t i; } u;
- u.i = Int32_val(vi);
- return caml_copy_double(u.d);
+ u.i = i;
+ return u.d;
+}
+
+CAMLprim value caml_int32_bits_of_float(value vd)
+{
+ return caml_copy_int32(caml_int32_bits_of_float_unboxed(Double_val(vd)));
+}
+
+CAMLprim value caml_int32_float_of_bits(value vi)
+{
+ return caml_copy_double(caml_int32_float_of_bits_unboxed(Int32_val(vi)));
}
/* 64-bit integers */
@@ -499,9 +515,15 @@ CAMLprim value caml_int64_of_int(value v)
CAMLprim value caml_int64_to_int(value v)
{ return Val_long((intnat) (Int64_val(v))); }
+int64_t caml_int64_of_float_unboxed(double x)
+{ return x; }
+
CAMLprim value caml_int64_of_float(value v)
{ return caml_copy_int64((int64_t) (Double_val(v))); }
+double caml_int64_to_float_unboxed(int64_t x)
+{ return x; }
+
CAMLprim value caml_int64_to_float(value v)
{ return caml_copy_double((double) (Int64_val(v))); }
@@ -569,24 +591,34 @@ CAMLprim value caml_int64_of_string(value s)
return caml_copy_int64(res);
}
-CAMLprim value caml_int64_bits_of_float(value vd)
+int64_t caml_int64_bits_of_float_unboxed(double d)
{
union { double d; int64_t i; int32_t h[2]; } u;
- u.d = Double_val(vd);
+ u.d = d;
#if defined(__arm__) && !defined(__ARM_EABI__)
{ int32_t t = u.h[0]; u.h[0] = u.h[1]; u.h[1] = t; }
#endif
- return caml_copy_int64(u.i);
+ return u.i;
}
-CAMLprim value caml_int64_float_of_bits(value vi)
+double caml_int64_float_of_bits_unboxed(int64_t i)
{
union { double d; int64_t i; int32_t h[2]; } u;
- u.i = Int64_val(vi);
+ u.i = i;
#if defined(__arm__) && !defined(__ARM_EABI__)
{ int32_t t = u.h[0]; u.h[0] = u.h[1]; u.h[1] = t; }
#endif
- return caml_copy_double(u.d);
+ return u.d;
+}
+
+CAMLprim value caml_int64_bits_of_float(value vd)
+{
+ return caml_copy_int64(caml_int64_bits_of_float_unboxed(Double_val(vd)));
+}
+
+CAMLprim value caml_int64_float_of_bits(value vi)
+{
+ return caml_copy_double(caml_int64_float_of_bits_unboxed(Int64_val(vi)));
}
/* Native integers */
@@ -746,9 +778,15 @@ CAMLprim value caml_nativeint_of_int(value v)
CAMLprim value caml_nativeint_to_int(value v)
{ return Val_long(Nativeint_val(v)); }
+intnat caml_nativeint_of_float_unboxed(double x)
+{ return x; }
+
CAMLprim value caml_nativeint_of_float(value v)
{ return caml_copy_nativeint((intnat)(Double_val(v))); }
+double caml_nativeint_to_float_unboxed(intnat x)
+{ return x; }
+
CAMLprim value caml_nativeint_to_float(value v)
{ return caml_copy_double((double)(Nativeint_val(v))); }
diff --git a/byterun/obj.c b/byterun/obj.c
index 27b50d9a3d..ab5b599705 100644
--- a/byterun/obj.c
+++ b/byterun/obj.c
@@ -245,6 +245,12 @@ CAMLprim value caml_set_oo_id (value obj) {
return obj;
}
+CAMLprim value caml_fresh_oo_id (value v) {
+ v = oo_last_id;
+ oo_last_id += 2;
+ return v;
+}
+
CAMLprim value caml_int_as_pointer (value n) {
return n - 1;
}
diff --git a/otherlibs/unix/execv.c b/otherlibs/unix/execv.c
index 9a77548917..4b9c56ad9c 100644
--- a/otherlibs/unix/execv.c
+++ b/otherlibs/unix/execv.c
@@ -15,8 +15,6 @@
#include <caml/memory.h>
#include "unixsupport.h"
-extern char ** cstringvect();
-
CAMLprim value unix_execv(value path, value args)
{
char ** argv;
diff --git a/otherlibs/unix/execve.c b/otherlibs/unix/execve.c
index 92171c2d37..18f5d2f4bd 100644
--- a/otherlibs/unix/execve.c
+++ b/otherlibs/unix/execve.c
@@ -15,8 +15,6 @@
#include <caml/memory.h>
#include "unixsupport.h"
-extern char ** cstringvect();
-
CAMLprim value unix_execve(value path, value args, value env)
{
char ** argv;
diff --git a/otherlibs/unix/execvp.c b/otherlibs/unix/execvp.c
index ce6900abf1..638ba29b2a 100644
--- a/otherlibs/unix/execvp.c
+++ b/otherlibs/unix/execvp.c
@@ -15,7 +15,6 @@
#include <caml/memory.h>
#include "unixsupport.h"
-extern char ** cstringvect();
#ifndef _WIN32
extern char ** environ;
#endif
diff --git a/otherlibs/unix/gethost.c b/otherlibs/unix/gethost.c
index 0f04fb907a..13d2f032db 100644
--- a/otherlibs/unix/gethost.c
+++ b/otherlibs/unix/gethost.c
@@ -128,7 +128,7 @@ CAMLprim value unix_gethostbyname(value name)
#if HAS_GETHOSTBYNAME_R
struct hostent h;
char buffer[NETDB_BUFFER_SIZE];
- int h_errno;
+ int err;
#endif
#if HAS_GETHOSTBYNAME_R || GETHOSTBYNAME_IS_REENTRANT
@@ -140,14 +140,14 @@ CAMLprim value unix_gethostbyname(value name)
#if HAS_GETHOSTBYNAME_R == 5
{
enter_blocking_section();
- hp = gethostbyname_r(hostname, &h, buffer, sizeof(buffer), &h_errno);
+ hp = gethostbyname_r(hostname, &h, buffer, sizeof(buffer), &err);
leave_blocking_section();
}
#elif HAS_GETHOSTBYNAME_R == 6
{
int rc;
enter_blocking_section();
- rc = gethostbyname_r(hostname, &h, buffer, sizeof(buffer), &hp, &h_errno);
+ rc = gethostbyname_r(hostname, &h, buffer, sizeof(buffer), &hp, &err);
leave_blocking_section();
if (rc != 0) hp = NULL;
}
diff --git a/otherlibs/unix/unixsupport.h b/otherlibs/unix/unixsupport.h
index a6a690b834..cf3b211db4 100644
--- a/otherlibs/unix/unixsupport.h
+++ b/otherlibs/unix/unixsupport.h
@@ -39,6 +39,8 @@ CAMLnoreturn_end;
#define DIR_Val(v) *((DIR **) &Field(v, 0))
+extern char ** cstringvect(value arg);
+
#ifdef __cplusplus
}
#endif
diff --git a/otherlibs/win32unix/unixsupport.h b/otherlibs/win32unix/unixsupport.h
index b8efb27806..5d9b030875 100644
--- a/otherlibs/win32unix/unixsupport.h
+++ b/otherlibs/win32unix/unixsupport.h
@@ -60,6 +60,7 @@ extern value unix_error_of_code (int errcode);
extern void unix_error (int errcode, char * cmdname, value arg);
extern void uerror (char * cmdname, value arg);
extern value unix_freeze_buffer (value);
+extern char ** cstringvect(value arg);
/* Information stored in flags_fd, describing more precisely the socket
* and its status. The whole flags_fd is initialized to 0.
diff --git a/parsing/lexer.mll b/parsing/lexer.mll
index ef5c5d0e38..7957a3b2a4 100644
--- a/parsing/lexer.mll
+++ b/parsing/lexer.mll
@@ -245,7 +245,9 @@ let add_comment com =
comment_list := com :: !comment_list
let add_docstring_comment ds =
- let com = (Docstrings.docstring_body ds, Docstrings.docstring_loc ds) in
+ let com =
+ ("*" ^ Docstrings.docstring_body ds, Docstrings.docstring_loc ds)
+ in
add_comment com
let comments () = List.rev !comment_list
diff --git a/parsing/pprintast.ml b/parsing/pprintast.ml
index 9f49391372..b871f04e95 100644
--- a/parsing/pprintast.ml
+++ b/parsing/pprintast.ml
@@ -419,90 +419,64 @@ class printer ()= object(self:'self)
if e.pexp_attributes <> [] then false
(* should also check attributes underneath *)
else match e.pexp_desc with
- | Pexp_apply
- ({pexp_desc=
- Pexp_ident
- {txt= Ldot (Lident (("Array"|"String") as s),"get");_};_},
- [(_,e1);(_,e2)]) -> begin
- let fmt:(_,_,_)format =
- if s= "Array" then "@[%a.(%a)@]" else "@[%a.[%a]@]" in
- pp f fmt self#simple_expr e1 self#expression e2;
- true
- end
- |Pexp_apply
- ({pexp_desc=
- Pexp_ident
- {txt= Ldot (Lident (("Array"|"String") as s),
- "set");_};_},[(_,e1);(_,e2);(_,e3)])
- ->
- let fmt :(_,_,_) format=
- if s= "Array" then
- "@[%a.(%a)@ <-@;%a@]"
- else
- "@[%a.[%a]@ <-@;%a@]" in (* @;< gives error here *)
- pp f fmt self#simple_expr e1 self#expression e2 self#expression e3;
- true
- | Pexp_apply ({pexp_desc=Pexp_ident {txt=Lident "!";_};_}, [(_,e)]) -> begin
- pp f "@[<hov>!%a@]" self#simple_expr e;
- true
- end
- | Pexp_apply
- ({pexp_desc=Pexp_ident
- {txt= Ldot (Ldot (Lident "Bigarray", array),
- ("get"|"set" as gs)) ;_};_},
- label_exprs) ->
- begin match array, gs, label_exprs with
- | "Genarray", "get",
- [(_,a);(_,{pexp_desc=Pexp_array ls;_})] ->
- pp f "@[%a.{%a}@]" self#simple_expr a
- (self#list ~sep:"," self#simple_expr ) ls;
- true
- | "Genarray", "set",
- [(_,a);(_,{pexp_desc=Pexp_array ls;_});(_,c)] ->
- pp f "@[%a.{%a}@ <-@ %a@]" self#simple_expr a
- (self#list ~sep:"," self#simple_expr ) ls self#simple_expr c;
- true
- | "Array1", "set", [(_,a);(_,i);(_,v)] ->
- pp f "@[%a.{%a}@ <-@ %a@]"
- self#simple_expr a
- self#simple_expr i
- self#simple_expr v;
- true
- | "Array2", "set", [(_,a);(_,i1);(_,i2);(_,v)] ->
- pp f "@[%a.{%a,%a}@ <-@ %a@]"
- self#simple_expr a
- self#simple_expr i1
- self#simple_expr i2
- self#simple_expr v;
- true
- | "Array3", "set", [(_,a);(_,i1);(_,i2);(_,i3);(_,v)] ->
- pp f "@[%a.{%a,%a,%a}@ <-@ %a@]"
- self#simple_expr a
- self#simple_expr i1
- self#simple_expr i2
- self#simple_expr i3
- self#simple_expr v;
- true
- | "Array1", "get", [(_,a);(_,i)] ->
- pp f "@[%a.{%a}@]"
- self#simple_expr a
- self#simple_expr i;
- true
- | "Array2", "get", [(_,a);(_,i1);(_,i2)] ->
- pp f "@[%a.{%a,%a}@]"
- self#simple_expr a
- self#simple_expr i1
- self#simple_expr i2;
- true
- | "Array3", "get", [(_,a);(_,i1);(_,i2);(_,i3)] ->
- pp f "@[%a.{%a,%a,%a}@]"
- self#simple_expr a
- self#simple_expr i1
- self#simple_expr i2
- self#simple_expr i3;
- true
- | _ -> false
- end
+ | Pexp_apply ({ pexp_desc = Pexp_ident { txt = Lident s; _ }; _ }, args)
+ when List.for_all (fun (lab, _) -> lab = Nolabel) args -> begin
+ let args = List.map snd args in
+ match s, args with
+ | "!", [e] ->
+ pp f "@[<hov>!%a@]" self#simple_expr e;
+ true
+ | (".()"|".[]"|".{}"), [a; i] ->
+ let left = String.sub s 0 2 and right = String.sub s 2 1 in
+ pp f "@[%a%s%a%s@]"
+ self#simple_expr a
+ left self#expression i right;
+ true
+ | (".()<-"|".[]<-"|".{}<-"), [a; i; v] ->
+ let left = String.sub s 0 2 and right = String.sub s 2 1 in
+ pp f "@[%a%s%a%s@ <-@;%a@]" (* @;< gives error here *)
+ self#simple_expr a
+ left self#expression i right
+ self#expression v;
+ true
+ | ".{,}", [a; i1; i2] ->
+ pp f "@[%a.{%a,%a}@]"
+ self#simple_expr a
+ self#simple_expr i1
+ self#simple_expr i2;
+ true
+ | ".{,}<-", [a; i1; i2; v] ->
+ pp f "@[%a.{%a,%a}@ <-@ %a@]"
+ self#simple_expr a
+ self#simple_expr i1
+ self#simple_expr i2
+ self#simple_expr v;
+ true
+ | ".{,,}", [a; i1; i2; i3] ->
+ pp f "@[%a.{%a,%a,%a}@]"
+ self#simple_expr a
+ self#simple_expr i1
+ self#simple_expr i2
+ self#simple_expr i3;
+ true
+ | ".{,,}<-", [a; i1; i2; i3; v] ->
+ pp f "@[%a.{%a,%a,%a}@ <-@ %a@]"
+ self#simple_expr a
+ self#simple_expr i1
+ self#simple_expr i2
+ self#simple_expr i3
+ self#simple_expr v;
+ true
+ | ".{,..,}", [a; {pexp_desc = Pexp_array ls; pexp_attributes = []}] ->
+ pp f "@[%a.{%a}@]" self#simple_expr a
+ (self#list ~sep:"," self#simple_expr ) ls;
+ true
+ | ".{,..,}<-", [a; {pexp_desc = Pexp_array ls; pexp_attributes = []}; v] ->
+ pp f "@[%a.{%a}@ <-@ %a@]" self#simple_expr a
+ (self#list ~sep:"," self#simple_expr ) ls self#simple_expr v;
+ true
+ | _ -> false
+ end
| _ -> false
method expression f x =
if x.pexp_attributes <> [] then begin
diff --git a/stdlib/camlinternalFormat.ml b/stdlib/camlinternalFormat.ml
index 22f555a6fb..8d9f8d3450 100644
--- a/stdlib/camlinternalFormat.ml
+++ b/stdlib/camlinternalFormat.ml
@@ -1709,7 +1709,6 @@ and make_float_padding_precision : type x y a b c d e f .
fun w p x ->
let str = fix_padding padty w (convert_float fconv p x) in
make_printf k o (Acc_data_string (acc, str)) fmt
-
and make_custom : type x y a b c d e f .
(b -> (b, c) acc -> f) -> b -> (b, c) acc ->
(a, b, c, d, e, f) fmt ->
@@ -1720,6 +1719,108 @@ and make_custom : type x y a b c d e f .
fun x ->
make_custom k o acc rest arity (f x)
+let const x _ = x
+
+let rec make_iprintf : type a b c d e f.
+ (b -> f) -> b -> (a, b, c, d, e, f) fmt -> a =
+ fun k o fmt -> match fmt with
+ | Char rest ->
+ const (make_iprintf k o rest)
+ | Caml_char rest ->
+ const (make_iprintf k o rest)
+ | String (No_padding, rest) ->
+ const (make_iprintf k o rest)
+ | String (Lit_padding _, rest) ->
+ const (make_iprintf k o rest)
+ | String (Arg_padding _, rest) ->
+ const (const (make_iprintf k o rest))
+ | Caml_string (No_padding, rest) ->
+ const (make_iprintf k o rest)
+ | Caml_string (Lit_padding _, rest) ->
+ const (make_iprintf k o rest)
+ | Caml_string (Arg_padding _, rest) ->
+ const (const (make_iprintf k o rest))
+ | Int (_, pad, prec, rest) ->
+ fn_of_padding_precision k o rest pad prec
+ | Int32 (_, pad, prec, rest) ->
+ fn_of_padding_precision k o rest pad prec
+ | Nativeint (_, pad, prec, rest) ->
+ fn_of_padding_precision k o rest pad prec
+ | Int64 (_, pad, prec, rest) ->
+ fn_of_padding_precision k o rest pad prec
+ | Float (_, pad, prec, rest) ->
+ fn_of_padding_precision k o rest pad prec
+ | Bool rest ->
+ const (make_iprintf k o rest)
+ | Alpha rest ->
+ const (const (make_iprintf k o rest))
+ | Theta rest ->
+ const (make_iprintf k o rest)
+ | Custom (arity, _, rest) ->
+ fn_of_custom_arity k o rest arity
+ | Reader _ ->
+ (* This case is impossible, by typing of formats. See the
+ note in the corresponding case for make_printf. *)
+ assert false
+ | Flush rest ->
+ make_iprintf k o rest
+ | String_literal (_, rest) ->
+ make_iprintf k o rest
+ | Char_literal (_, rest) ->
+ make_iprintf k o rest
+ | Format_arg (_, _, rest) ->
+ const (make_iprintf k o rest)
+ | Format_subst (_, fmtty, rest) ->
+ fun (Format (fmt, _)) ->
+ make_iprintf k o
+ (concat_fmt (recast fmt fmtty) rest)
+ | Scan_char_set (_, _, rest) ->
+ const (make_iprintf k o rest)
+ | Scan_get_counter (_, rest) ->
+ const (make_iprintf k o rest)
+ | Scan_next_char rest ->
+ const (make_iprintf k o rest)
+ | Ignored_param (ign, rest) ->
+ make_ignored_param (fun x _ -> k x) o (End_of_acc) ign rest
+ | Formatting_lit (_, rest) ->
+ make_iprintf k o rest
+ | Formatting_gen (Open_tag (Format (fmt', _)), rest) ->
+ make_iprintf (fun koc -> make_iprintf k koc rest) o fmt'
+ | Formatting_gen (Open_box (Format (fmt', _)), rest) ->
+ make_iprintf (fun koc -> make_iprintf k koc rest) o fmt'
+ | End_of_format ->
+ k o
+and fn_of_padding_precision :
+ type x y z a b c d e f.
+ (b -> f) -> b -> (a, b, c, d, e, f) fmt ->
+ (x, y) padding -> (y, z -> a) precision -> x =
+ fun k o fmt pad prec -> match pad, prec with
+ | No_padding , No_precision ->
+ const (make_iprintf k o fmt)
+ | No_padding , Lit_precision _ ->
+ const (make_iprintf k o fmt)
+ | No_padding , Arg_precision ->
+ const (const (make_iprintf k o fmt))
+ | Lit_padding _, No_precision ->
+ const (make_iprintf k o fmt)
+ | Lit_padding _, Lit_precision _ ->
+ const (make_iprintf k o fmt)
+ | Lit_padding _, Arg_precision ->
+ const (const (make_iprintf k o fmt))
+ | Arg_padding _, No_precision ->
+ const (const (make_iprintf k o fmt))
+ | Arg_padding _, Lit_precision _ ->
+ const (const (make_iprintf k o fmt))
+ | Arg_padding _, Arg_precision ->
+ const (const (const (make_iprintf k o fmt)))
+and fn_of_custom_arity : type x y a b c d e f .
+ (b -> f) -> b -> (a, b, c, d, e, f) fmt -> (a, x, y) custom_arity -> y =
+ fun k o fmt -> function
+ | Custom_zero ->
+ make_iprintf k o fmt
+ | Custom_succ arity ->
+ const (fn_of_custom_arity k o fmt arity)
+
(******************************************************************************)
(* Continuations for make_printf *)
diff --git a/stdlib/camlinternalFormat.mli b/stdlib/camlinternalFormat.mli
index 036bcb0ec7..2fb81f8bca 100644
--- a/stdlib/camlinternalFormat.mli
+++ b/stdlib/camlinternalFormat.mli
@@ -59,6 +59,8 @@ val make_printf :
('b -> ('b, 'c) acc -> 'd) -> 'b -> ('b, 'c) acc ->
('a, 'b, 'c, 'c, 'c, 'd) CamlinternalFormatBasics.fmt -> 'a
+val make_iprintf : ('b -> 'f) -> 'b -> ('a, 'b, 'c, 'd, 'e, 'f) fmt -> 'a
+
val output_acc : out_channel -> (out_channel, unit) acc -> unit
val bufput_acc : Buffer.t -> (Buffer.t, unit) acc -> unit
val strput_acc : Buffer.t -> (unit, string) acc -> unit
diff --git a/stdlib/format.ml b/stdlib/format.ml
index 3ab79e254e..194d3fcd3e 100644
--- a/stdlib/format.ml
+++ b/stdlib/format.ml
@@ -1181,10 +1181,7 @@ let kfprintf k ppf (Format (fmt, _)) =
ppf End_of_acc fmt
and ikfprintf k ppf (Format (fmt, _)) =
- make_printf
- (fun _ _ -> k ppf)
- ppf End_of_acc fmt
-;;
+ make_iprintf k ppf fmt
let fprintf ppf = kfprintf ignore ppf;;
let ifprintf ppf = ikfprintf ignore ppf;;
diff --git a/stdlib/int32.ml b/stdlib/int32.ml
index 63c99e3d42..a1cf001a27 100644
--- a/stdlib/int32.ml
+++ b/stdlib/int32.ml
@@ -27,10 +27,18 @@ external shift_right : int32 -> int -> int32 = "%int32_asr"
external shift_right_logical : int32 -> int -> int32 = "%int32_lsr"
external of_int : int -> int32 = "%int32_of_int"
external to_int : int32 -> int = "%int32_to_int"
-external of_float : float -> int32 = "caml_int32_of_float"
-external to_float : int32 -> float = "caml_int32_to_float"
-external bits_of_float : float -> int32 = "caml_int32_bits_of_float"
-external float_of_bits : int32 -> float = "caml_int32_float_of_bits"
+external of_float : float -> int32
+ = "caml_int32_of_float" "caml_int32_of_float_unboxed"
+ [@@unboxed] [@@noalloc]
+external to_float : int32 -> float
+ = "caml_int32_to_float" "caml_int32_to_float_unboxed"
+ [@@unboxed] [@@noalloc]
+external bits_of_float : float -> int32
+ = "caml_int32_bits_of_float" "caml_int32_bits_of_float_unboxed"
+ [@@unboxed] [@@noalloc]
+external float_of_bits : int32 -> float
+ = "caml_int32_float_of_bits" "caml_int32_float_of_bits_unboxed"
+ [@@unboxed] [@@noalloc]
let zero = 0l
let one = 1l
diff --git a/stdlib/int32.mli b/stdlib/int32.mli
index 4a29e6c0f2..5b0e910a6f 100644
--- a/stdlib/int32.mli
+++ b/stdlib/int32.mli
@@ -111,13 +111,17 @@ external to_int : int32 -> int = "%int32_to_int"
during the conversion. On 64-bit platforms, the conversion
is exact. *)
-external of_float : float -> int32 = "caml_int32_of_float"
+external of_float : float -> int32
+ = "caml_int32_of_float" "caml_int32_of_float_unboxed"
+ [@@unboxed] [@@noalloc]
(** Convert the given floating-point number to a 32-bit integer,
discarding the fractional part (truncate towards 0).
The result of the conversion is undefined if, after truncation,
the number is outside the range \[{!Int32.min_int}, {!Int32.max_int}\]. *)
-external to_float : int32 -> float = "caml_int32_to_float"
+external to_float : int32 -> float
+ = "caml_int32_to_float" "caml_int32_to_float_unboxed"
+ [@@unboxed] [@@noalloc]
(** Convert the given 32-bit integer to a floating-point number. *)
external of_string : string -> int32 = "caml_int32_of_string"
@@ -132,14 +136,18 @@ external of_string : string -> int32 = "caml_int32_of_string"
val to_string : int32 -> string
(** Return the string representation of its argument, in signed decimal. *)
-external bits_of_float : float -> int32 = "caml_int32_bits_of_float"
+external bits_of_float : float -> int32
+ = "caml_int32_bits_of_float" "caml_int32_bits_of_float_unboxed"
+ [@@unboxed] [@@noalloc]
(** Return the internal representation of the given float according
to the IEEE 754 floating-point 'single format' bit layout.
Bit 31 of the result represents the sign of the float;
bits 30 to 23 represent the (biased) exponent; bits 22 to 0
represent the mantissa. *)
-external float_of_bits : int32 -> float = "caml_int32_float_of_bits"
+external float_of_bits : int32 -> float
+ = "caml_int32_float_of_bits" "caml_int32_float_of_bits_unboxed"
+ [@@unboxed] [@@noalloc]
(** Return the floating-point number whose internal representation,
according to the IEEE 754 floating-point 'single format' bit layout,
is the given [int32]. *)
diff --git a/stdlib/int64.ml b/stdlib/int64.ml
index 274a9868d9..32d8350083 100644
--- a/stdlib/int64.ml
+++ b/stdlib/int64.ml
@@ -27,8 +27,12 @@ external shift_right : int64 -> int -> int64 = "%int64_asr"
external shift_right_logical : int64 -> int -> int64 = "%int64_lsr"
external of_int : int -> int64 = "%int64_of_int"
external to_int : int64 -> int = "%int64_to_int"
-external of_float : float -> int64 = "caml_int64_of_float"
-external to_float : int64 -> float = "caml_int64_to_float"
+external of_float : float -> int64
+ = "caml_int64_of_float" "caml_int64_of_float_unboxed"
+ [@@unboxed] [@@noalloc]
+external to_float : int64 -> float
+ = "caml_int64_to_float" "caml_int64_to_float_unboxed"
+ [@@unboxed] [@@noalloc]
external of_int32 : int32 -> int64 = "%int64_of_int32"
external to_int32 : int64 -> int32 = "%int64_to_int32"
external of_nativeint : nativeint -> int64 = "%int64_of_nativeint"
@@ -49,8 +53,12 @@ let to_string n = format "%d" n
external of_string : string -> int64 = "caml_int64_of_string"
-external bits_of_float : float -> int64 = "caml_int64_bits_of_float"
-external float_of_bits : int64 -> float = "caml_int64_float_of_bits"
+external bits_of_float : float -> int64
+ = "caml_int64_bits_of_float" "caml_int64_bits_of_float_unboxed"
+ [@@unboxed] [@@noalloc]
+external float_of_bits : int64 -> float
+ = "caml_int64_float_of_bits" "caml_int64_float_of_bits_unboxed"
+ [@@unboxed] [@@noalloc]
type t = int64
diff --git a/stdlib/int64.mli b/stdlib/int64.mli
index edd600c690..8510fcd600 100644
--- a/stdlib/int64.mli
+++ b/stdlib/int64.mli
@@ -112,13 +112,17 @@ external to_int : int64 -> int = "%int64_to_int"
is taken modulo 2{^31}, i.e. the top 33 bits are lost
during the conversion. *)
-external of_float : float -> int64 = "caml_int64_of_float"
+external of_float : float -> int64
+ = "caml_int64_of_float" "caml_int64_of_float_unboxed"
+ [@@unboxed] [@@noalloc]
(** Convert the given floating-point number to a 64-bit integer,
discarding the fractional part (truncate towards 0).
The result of the conversion is undefined if, after truncation,
the number is outside the range \[{!Int64.min_int}, {!Int64.max_int}\]. *)
-external to_float : int64 -> float = "caml_int64_to_float"
+external to_float : int64 -> float
+ = "caml_int64_to_float" "caml_int64_to_float_unboxed"
+ [@@unboxed] [@@noalloc]
(** Convert the given 64-bit integer to a floating-point number. *)
@@ -154,14 +158,18 @@ external of_string : string -> int64 = "caml_int64_of_string"
val to_string : int64 -> string
(** Return the string representation of its argument, in decimal. *)
-external bits_of_float : float -> int64 = "caml_int64_bits_of_float"
+external bits_of_float : float -> int64
+ = "caml_int64_bits_of_float" "caml_int64_bits_of_float_unboxed"
+ [@@unboxed] [@@noalloc]
(** Return the internal representation of the given float according
to the IEEE 754 floating-point 'double format' bit layout.
Bit 63 of the result represents the sign of the float;
bits 62 to 52 represent the (biased) exponent; bits 51 to 0
represent the mantissa. *)
-external float_of_bits : int64 -> float = "caml_int64_float_of_bits"
+external float_of_bits : int64 -> float
+ = "caml_int64_float_of_bits" "caml_int64_float_of_bits_unboxed"
+ [@@unboxed] [@@noalloc]
(** Return the floating-point number whose internal representation,
according to the IEEE 754 floating-point 'double format' bit layout,
is the given [int64]. *)
diff --git a/stdlib/nativeint.ml b/stdlib/nativeint.ml
index 7412bca04e..53d50af82d 100644
--- a/stdlib/nativeint.ml
+++ b/stdlib/nativeint.ml
@@ -27,8 +27,12 @@ external shift_right: nativeint -> int -> nativeint = "%nativeint_asr"
external shift_right_logical: nativeint -> int -> nativeint = "%nativeint_lsr"
external of_int: int -> nativeint = "%nativeint_of_int"
external to_int: nativeint -> int = "%nativeint_to_int"
-external of_float : float -> nativeint = "caml_nativeint_of_float"
-external to_float : nativeint -> float = "caml_nativeint_to_float"
+external of_float : float -> nativeint
+ = "caml_nativeint_of_float" "caml_nativeint_of_float_unboxed"
+ [@@unboxed] [@@noalloc]
+external to_float : nativeint -> float
+ = "caml_nativeint_to_float" "caml_nativeint_to_float_unboxed"
+ [@@unboxed] [@@noalloc]
external of_int32: int32 -> nativeint = "%nativeint_of_int32"
external to_int32: nativeint -> int32 = "%nativeint_to_int32"
diff --git a/stdlib/nativeint.mli b/stdlib/nativeint.mli
index ffa57030cd..cd9871ba75 100644
--- a/stdlib/nativeint.mli
+++ b/stdlib/nativeint.mli
@@ -129,14 +129,18 @@ external to_int : nativeint -> int = "%nativeint_to_int"
integer (type [int]). The high-order bit is lost during
the conversion. *)
-external of_float : float -> nativeint = "caml_nativeint_of_float"
+external of_float : float -> nativeint
+ = "caml_nativeint_of_float" "caml_nativeint_of_float_unboxed"
+ [@@unboxed] [@@noalloc]
(** Convert the given floating-point number to a native integer,
discarding the fractional part (truncate towards 0).
The result of the conversion is undefined if, after truncation,
the number is outside the range
\[{!Nativeint.min_int}, {!Nativeint.max_int}\]. *)
-external to_float : nativeint -> float = "caml_nativeint_to_float"
+external to_float : nativeint -> float
+ = "caml_nativeint_to_float" "caml_nativeint_to_float_unboxed"
+ [@@unboxed] [@@noalloc]
(** Convert the given native integer to a floating-point number. *)
external of_int32 : int32 -> nativeint = "%nativeint_of_int32"
diff --git a/stdlib/printf.ml b/stdlib/printf.ml
index 1152429f9a..e6f2640746 100644
--- a/stdlib/printf.ml
+++ b/stdlib/printf.ml
@@ -19,7 +19,7 @@ let kfprintf k o (Format (fmt, _)) =
let kbprintf k b (Format (fmt, _)) =
make_printf (fun b acc -> bufput_acc b acc; k b) b End_of_acc fmt
let ikfprintf k oc (Format (fmt, _)) =
- make_printf (fun oc _ -> k oc) oc End_of_acc fmt
+ make_iprintf k oc fmt
let fprintf oc fmt = kfprintf ignore oc fmt
let bprintf b fmt = kbprintf ignore b fmt
diff --git a/testsuite/tests/asmcomp/main.c b/testsuite/tests/asmcomp/main.c
index 0b59b0b826..02645e325c 100644
--- a/testsuite/tests/asmcomp/main.c
+++ b/testsuite/tests/asmcomp/main.c
@@ -47,9 +47,9 @@ int cmpint(const void * i, const void * j)
int main(int argc, char **argv)
{
#ifdef UNIT_INT
- { extern int FUN();
- extern int call_gen_code();
- printf("%d\n", call_gen_code(FUN));
+ { extern long FUN(void);
+ extern long call_gen_code(long (*)(void));
+ printf("%ld\n", call_gen_code(FUN));
}
#else
if (argc < 2) {
@@ -57,23 +57,20 @@ int main(int argc, char **argv)
exit(2);
}
#ifdef INT_INT
- { extern int FUN();
- extern int call_gen_code();
- printf("%d\n", call_gen_code(FUN, atoi(argv[1])));
+ { extern long FUN(long);
+ extern long call_gen_code(long (*)(long), long);
+ printf("%ld\n", call_gen_code(FUN, atoi(argv[1])));
}
#endif
#ifdef INT_FLOAT
- { extern double FUN();
-#ifdef __mc68020__
-#define call_gen_code call_gen_code_float
-#endif
- extern double call_gen_code();
+ { extern double FUN(long);
+ extern double call_gen_code(double (*)(long), long);
printf("%f\n", call_gen_code(FUN, atoi(argv[1])));
}
#endif
#ifdef SORT
- { extern void FUN();
- extern void call_gen_code();
+ { extern void FUN(long, long, long *);
+ extern void call_gen_code(void (*)(long, long, long *), long, long, long *);
long n;
long * a, * b;
long i;
@@ -100,8 +97,8 @@ int main(int argc, char **argv)
#endif
#endif
#ifdef CHECKBOUND
- { extern void checkbound1(), checkbound2();
- extern void call_gen_code();
+ { extern void checkbound1(long), checkbound2(long, long);
+ extern void call_gen_code(void *, ...);
long x, y;
x = atoi(argv[1]);
if (argc >= 3) {
diff --git a/testsuite/tests/asmcomp/mainarith.c b/testsuite/tests/asmcomp/mainarith.c
index 94ff371e3c..4af44b857b 100644
--- a/testsuite/tests/asmcomp/mainarith.c
+++ b/testsuite/tests/asmcomp/mainarith.c
@@ -59,8 +59,8 @@ double F, G;
#arg, #res, X, Y, arg, result); \
}
-extern void call_gen_code();
-extern void testarith();
+extern void call_gen_code(void (*)(void));
+extern void testarith(void);
void do_test(void)
{
diff --git a/testsuite/tests/lib-dynlink-bytecode/stub1.c b/testsuite/tests/lib-dynlink-bytecode/stub1.c
index 60c8ab35ae..ae064854dc 100644
--- a/testsuite/tests/lib-dynlink-bytecode/stub1.c
+++ b/testsuite/tests/lib-dynlink-bytecode/stub1.c
@@ -15,7 +15,7 @@
#include "caml/alloc.h"
#include <stdio.h>
-value stub1() {
+value stub1(void) {
CAMLparam0();
CAMLlocal1(x);
printf("This is stub1!\n"); fflush(stdout);
diff --git a/testsuite/tests/lib-dynlink-bytecode/stub2.c b/testsuite/tests/lib-dynlink-bytecode/stub2.c
index 4064a75eec..73496d082f 100644
--- a/testsuite/tests/lib-dynlink-bytecode/stub2.c
+++ b/testsuite/tests/lib-dynlink-bytecode/stub2.c
@@ -15,9 +15,9 @@
#include "caml/alloc.h"
#include <stdio.h>
-extern value stub1();
+extern value stub1(void);
-value stub2() {
+value stub2(void) {
printf("This is stub2, calling stub1:\n"); fflush(stdout);
stub1();
printf("Ok!\n"); fflush(stdout);
diff --git a/testsuite/tests/unboxed-primitive-args/common.ml b/testsuite/tests/unboxed-primitive-args/common.ml
index 5dc6c7fb2f..88cca57422 100644
--- a/testsuite/tests/unboxed-primitive-args/common.ml
+++ b/testsuite/tests/unboxed-primitive-args/common.ml
@@ -243,7 +243,7 @@ external cleanup_float
-> float -> float -> float -> float -> float -> float -> float -> float
-> float -> float -> float -> float -> float -> float -> float -> float
-> float -> float -> float -> float -> float -> float -> float -> float
- -> float = "" "test_cleanup_normal" [@@noalloc] [@@unboxed]
+ -> float = "" "test_cleanup_float" [@@noalloc] [@@unboxed]
let cleanup_args_and_stack () =
let _ : int =
diff --git a/testsuite/tests/unboxed-primitive-args/test_common.c b/testsuite/tests/unboxed-primitive-args/test_common.c
index 30305b2c87..f1ee55bb85 100644
--- a/testsuite/tests/unboxed-primitive-args/test_common.c
+++ b/testsuite/tests/unboxed-primitive-args/test_common.c
@@ -23,12 +23,12 @@ value test_set_buffers(value v_ocaml_buffer, value v_c_buffer)
return Val_unit;
}
-value test_cleanup_normal()
+value test_cleanup_normal(void)
{
return Val_int(0);
}
-double test_cleanup_float()
+double test_cleanup_float(void)
{
return 0.;
}
diff --git a/tools/check-typo b/tools/check-typo
index a28e4dc153..d81c22a533 100755
--- a/tools/check-typo
+++ b/tools/check-typo
@@ -27,13 +27,13 @@
# - presence of a copyright header (missing-header)
# - absence of a leftover "$Id" string (svn-keyword)
-# Exceptions are handled with a SVN property: "ocaml:typo".
+# Exceptions are handled with a git attribute: "ocaml-typo".
# Its value for a given file is a comma-separated list of rule names,
# which lists the rules that should be disabled for this file.
# The rule names are the ones shown above in parentheses.
# Built-in exceptions:
-# - Any binary file (i.e. with svn:mime-type = application/octet-stream)
+# - Any binary file (i.e. with git attribute "binary")
# is automatically exempt from all the rules.
# - Any file whose name matches one of the following patterns is
# automatically exempt from all rules
@@ -68,21 +68,24 @@
# on the command line (or by default the current directory), and check
# every file therein for compliance to the rules.
-# Directories named .svn and _build (and their contents) are always ignored.
-# This program ignores any file that is not under svn control, unless
+# Directories named .git (and their contents) are always ignored.
+# This program ignores any file that is not under git control, unless
# explicitly given on the command line.
-# If a directory has the SVN property "ocaml:typo" set to "prune",
+# If a directory has the git attribute "ocaml-typo" set to "prune",
# then it and its contents are ignored.
# You can ignore a rule by giving the option -<rule> on the command
# line (before any file names).
+# First prevent i18n from messing up everything.
+export LC_ALL=C
+
# Special case for recursive call from the find command (see IGNORE_DIRS).
case "$1" in
--check-prune)
- case `svn propget ocaml:typo "$2" 2>/dev/null` in
- prune) echo "INFO: pruned directory $2 (ocaml:typo=prune)" >&2; exit 0;;
+ case `git check-attr ocaml-typo "$2" 2>/dev/null` in
+ *prune*) echo "INFO: pruned directory $2 (ocaml-typo=prune)" >&2; exit 0;;
*) exit 3;;
esac;;
esac
@@ -104,8 +107,7 @@ while : ; do
done
IGNORE_DIRS="
- -name .svn -prune -o
- -name _build -prune -o
+ -name .git -prune -o
-type d -exec $0 --check-prune {} ; -prune -o
"
@@ -115,10 +117,8 @@ IGNORE_DIRS="
esac
) | (
while read f; do
- case `svn status "$f" 2>&1` in
- '?'*) is_svn=false;;
- I*) is_svn=false;;
- svn:*"is not a working copy") is_svn=false;;
+ case `git ls-files "$f" 2>&1` in
+ "") is_svn=false;;
*) is_svn=true;;
esac
case "$*" in
@@ -128,16 +128,17 @@ IGNORE_DIRS="
if $is_svn || $is_cmd_line; then :; else continue; fi
svnrules=''
if $is_svn; then
- case `svn propget svn:mime-type "$f"` in
- application/octet-stream) continue;;
+ case `git check-attr binary "$f"` in
+ *'binary: set') continue;;
esac
- svnrules=`svn propget ocaml:typo "$f"`
+ svnrules=`git check-attr ocaml-typo "$f" | sed -e 's/.*: //'`
+ case $svnrules in unspecified) svnrules= ;; esac
fi
rules="$userrules"
add_hd(){ rules="missing-header,$rules"; }
case "$f" in
Makefile*|*/Makefile*) rules="tab,$rules";;
- */.ignore) add_hd;;
+ */.gitignore) add_hd;;
*.mlpack|*.mllib|*.mltop|*.odocl|*.itarget|*.clib) add_hd;;
*.reference|*/reference|*/.depend*) continue;;
esac
@@ -230,7 +231,7 @@ IGNORE_DIRS="
for (i in r){
name = r[i];
if (name != "" && !counts[name]){
- err("unused-prop", sprintf("unused [%s] in ocaml:typo", name));
+ err("unused-prop", sprintf("unused [%s] in ocaml-typo", name));
}
}
}
diff --git a/tools/ci-build b/tools/ci-build
index 31a2540351..6e4e3339c7 100755
--- a/tools/ci-build
+++ b/tools/ci-build
@@ -150,7 +150,7 @@ export LC_ALL=C
$make -f Makefile$nt distclean || :
if $docheckout; then
- svn update --accept theirs-full
+ git pull
fi
case $nt in
diff --git a/yacc/closure.c b/yacc/closure.c
index d84c125bf2..21a161e1e3 100644
--- a/yacc/closure.c
+++ b/yacc/closure.c
@@ -23,9 +23,9 @@ static unsigned *EFF;
-void print_EFF ();
-void print_first_derives ();
-void print_closure ();
+void print_EFF (void);
+void print_first_derives (void);
+void print_closure (void);
void set_EFF(void)
{
diff --git a/yacc/lr0.c b/yacc/lr0.c
index a5a62d341c..1106eb7d90 100644
--- a/yacc/lr0.c
+++ b/yacc/lr0.c
@@ -48,7 +48,7 @@ void initialize_states (void);
void save_reductions (void);
void new_itemsets (void);
void save_shifts (void);
-void print_derives ();
+void print_derives (void);
void show_cores (void), show_ritems (void), show_rrhs (void), show_shifts (void);
void allocate_itemsets(void)