1. Vik D
  2. ocaml-core-submissions

Commits

Markus Mottl  committed c7e1816

Fixed bin_prot warnings for OCaml 4.00

  • Participants
  • Parent commits 65bf47b
  • Branches default

Comments (0)

Files changed (2)

File ocaml-4.00-fixes

View file
  • Ignore whitespace
+# HG changeset patch
+# Parent 781119def8fd6e4f51bb1f00ca00b061d86bf423
+Fixes for OCaml 4.00
+
+diff --git a/base/bin_prot/lib/read_c.ml b/base/bin_prot/lib/read_c.ml
+--- a/base/bin_prot/lib/read_c.ml
++++ b/base/bin_prot/lib/read_c.ml
+@@ -1,7 +1,5 @@
+ (* Read_c: wrapping unsafe C-style readers to safe ML-style ones. *)
+ 
+-open Bigarray
+-
+ open Common
+ open Unsafe_common
+ open Unsafe_read_c
+diff --git a/base/bin_prot/lib/read_ml.ml b/base/bin_prot/lib/read_ml.ml
+--- a/base/bin_prot/lib/read_ml.ml
++++ b/base/bin_prot/lib/read_ml.ml
+@@ -2,8 +2,6 @@
+ 
+ #include "int_codes.mlh"
+ 
+-open Bigarray
+-
+ open Common
+ 
+ external init : unit -> unit = "bin_prot_read_ml_init_stub"
+@@ -361,7 +359,7 @@
+   let c = bin_read_c buf ~pos_ref in
+   a, b, c
+ 
+-let rec bin_read_n_rev_list bin_read_el buf ~pos_ref len =
++let bin_read_n_rev_list bin_read_el buf ~pos_ref len =
+   let rec loop n acc =
+     if n = 0 then acc
+     else loop (n - 1) (bin_read_el buf ~pos_ref :: acc)
+diff --git a/base/bin_prot/lib/read_ml.mli b/base/bin_prot/lib/read_ml.mli
+--- a/base/bin_prot/lib/read_ml.mli
++++ b/base/bin_prot/lib/read_ml.mli
+@@ -1,7 +1,5 @@
+ (** Reading values from the binary protocol using (mostly) OCaml. *)
+ 
+-open Bigarray
+-
+ open Common
+ 
+ type 'a reader = buf -> pos_ref : pos_ref -> 'a
+diff --git a/base/bin_prot/lib/type_class.ml b/base/bin_prot/lib/type_class.ml
+--- a/base/bin_prot/lib/type_class.ml
++++ b/base/bin_prot/lib/type_class.ml
+@@ -1,7 +1,5 @@
+ (* Tp_class: sizers, writers, and readers in records *)
+ 
+-open Common
+-
+ type 'a writer =
+   {
+     size : 'a Size.sizer;
+diff --git a/base/bin_prot/lib/unsafe_read_c.ml b/base/bin_prot/lib/unsafe_read_c.ml
+--- a/base/bin_prot/lib/unsafe_read_c.ml
++++ b/base/bin_prot/lib/unsafe_read_c.ml
+@@ -1,6 +1,5 @@
+ (* Unsafe_read_c: reading values from the binary protocol using unsafe C. *)
+ 
+-open Bigarray
+ open Common
+ open Unsafe_common
+ 
+@@ -61,7 +60,7 @@
+   let c = bin_read_c sptr_ptr eptr in
+   a, b, c
+ 
+-let rec bin_read_n_rev_list bin_read_el sptr_ptr eptr len =
++let bin_read_n_rev_list bin_read_el sptr_ptr eptr len =
+   let rec loop n acc =
+     if n = 0 then acc
+     else loop (n - 1) (bin_read_el sptr_ptr eptr :: acc)
+diff --git a/base/bin_prot/lib/unsafe_write_c.ml b/base/bin_prot/lib/unsafe_write_c.ml
+--- a/base/bin_prot/lib/unsafe_write_c.ml
++++ b/base/bin_prot/lib/unsafe_write_c.ml
+@@ -1,7 +1,5 @@
+ (* Unsafe_write_c: writing values to the binary protocol using unsafe C. *)
+ 
+-open Bigarray
+-
+ open Common
+ open Unsafe_common
+ 
+diff --git a/base/bin_prot/lib/utils.ml b/base/bin_prot/lib/utils.ml
+--- a/base/bin_prot/lib/utils.ml
++++ b/base/bin_prot/lib/utils.ml
+@@ -1,6 +1,5 @@
+ (* Utils: utility functions for user convenience *)
+ 
+-open Bigarray
+ open Common
+ open Read_ml
+ open Write_ml
+@@ -77,7 +76,7 @@
+ 
+   type t = S.t
+ 
+-  let bin_size_t t = B.bin_size_t (S.to_binable t)
++  let bin_size_t (t : t) = B.bin_size_t (S.to_binable t)
+   let bin_write_t buf ~pos t = B.bin_write_t buf ~pos (S.to_binable t)
+   let bin_write_t_ sptr eptr t = B.bin_write_t_ sptr eptr (S.to_binable t)
+   let bin_read_t buf ~pos_ref = S.of_binable (B.bin_read_t buf ~pos_ref)
+@@ -123,7 +122,7 @@
+ 
+   let bin_size_t bin_size_el t = B.bin_size_t bin_size_el (S.to_binable t)
+ 
+-  let bin_write_t bin_write_el buf ~pos t =
++  let bin_write_t bin_write_el buf ~pos (t : 'a t) =
+     B.bin_write_t bin_write_el buf ~pos (S.to_binable t)
+ 
+   let bin_write_t_ bin_write_el sptr eptr t =
+@@ -179,7 +178,7 @@
+ 
+   type ('a, 'b) t = ('a, 'b) S.t
+ 
+-  let bin_size_t bin_size_el1 bin_size_el2 t =
++  let bin_size_t bin_size_el1 bin_size_el2 (t : ('a, 'b) t) =
+     B.bin_size_t bin_size_el1 bin_size_el2 (S.to_binable t)
+ 
+   let bin_write_t bin_write_el1 bin_write_el2 buf ~pos t =
+@@ -257,7 +256,7 @@
+           let msg = Printf.sprintf "%s.%s" module_name msg in
+           raise_concurrent_modification msg)
+ 
+-  let bin_size_t t =
++  let bin_size_t (t : t) =
+     let size_ref = ref 0 in
+     let cnt_ref = ref 0 in
+     iter t ~f:(fun el ->
+@@ -314,13 +313,6 @@
+       unsafe_write = bin_write_t_;
+     }
+ 
+-  let bin_writer_t =
+-    {
+-      size = bin_size_t;
+-      write = bin_write_t;
+-      unsafe_write = bin_write_t_;
+-    }
+-
+   let bin_reader_t =
+     {
+       read = bin_read_t;
+@@ -364,7 +356,7 @@
+           let msg = Printf.sprintf "%s.%s" module_name msg in
+           raise_concurrent_modification msg)
+ 
+-  let bin_size_t bin_size_a t =
++  let bin_size_t bin_size_a (t : 'a t) =
+     let size_ref = ref 0 in
+     let cnt_ref = ref 0 in
+     iter t ~f:(fun el ->
+@@ -423,15 +415,6 @@
+         bin_write_t_ bin_writer.unsafe_write sptr eptr v);
+     }
+ 
+-  let bin_writer_t bin_writer =
+-    {
+-      size = (fun v -> bin_size_t bin_writer.size v);
+-      write = (fun buf ~pos v ->
+-        bin_write_t bin_writer.unsafe_write buf ~pos v);
+-      unsafe_write = (fun sptr eptr v ->
+-        bin_write_t_ bin_writer.unsafe_write sptr eptr v);
+-    }
+-
+   let bin_reader_t bin_reader =
+     {
+       read = (fun buf ~pos_ref ->
+@@ -477,7 +460,7 @@
+           let msg = Printf.sprintf "%s.%s" module_name msg in
+           raise_concurrent_modification msg)
+ 
+-  let bin_size_t bin_size_a bin_size_b t =
++  let bin_size_t bin_size_a bin_size_b (t : ('a, 'b) t) =
+     let size_ref = ref 0 in
+     let cnt_ref = ref 0 in
+     iter t ~f:(fun el ->
+@@ -536,17 +519,6 @@
+         bin_write_t
+           bin_writer1.unsafe_write bin_writer2.unsafe_write buf ~pos v);
+       unsafe_write = (fun sptr eptr v ->
+-          bin_write_t_
+-            bin_writer1.unsafe_write bin_writer2.unsafe_write sptr eptr v);
+-    }
+-
+-  let bin_writer_t bin_writer1 bin_writer2 =
+-    {
+-      size = (fun v -> bin_size_t bin_writer1.size bin_writer2.size v);
+-      write = (fun buf ~pos v ->
+-        bin_write_t
+-          bin_writer1.unsafe_write bin_writer2.unsafe_write buf ~pos v);
+-      unsafe_write = (fun sptr eptr v ->
+         bin_write_t_
+           bin_writer1.unsafe_write bin_writer2.unsafe_write sptr eptr v);
+     }
+diff --git a/base/bin_prot/lib/utils.mli b/base/bin_prot/lib/utils.mli
+--- a/base/bin_prot/lib/utils.mli
++++ b/base/bin_prot/lib/utils.mli
+@@ -1,8 +1,6 @@
+ (** Utility functions for user convenience *)
+ 
+-open Bigarray
+ open Common
+-open Read_ml
+ open Type_class
+ 
+ val bin_dump : ?header : bool -> 'a writer -> 'a -> buf
+diff --git a/base/bin_prot/lib/write_ml.ml b/base/bin_prot/lib/write_ml.ml
+--- a/base/bin_prot/lib/write_ml.ml
++++ b/base/bin_prot/lib/write_ml.ml
+@@ -2,8 +2,6 @@
+ 
+ #include "int_codes.mlh"
+ 
+-open Bigarray
+-
+ open Common
+ 
+ type 'a writer = buf -> pos : pos -> 'a -> pos
+diff --git a/base/bin_prot/lib/write_ml.mli b/base/bin_prot/lib/write_ml.mli
+--- a/base/bin_prot/lib/write_ml.mli
++++ b/base/bin_prot/lib/write_ml.mli
+@@ -1,7 +1,5 @@
+ (** Writing values to the binary protocol using (mostly) OCaml. *)
+ 
+-open Bigarray
+-
+ open Common
+ 
+ type 'a writer = buf -> pos : pos -> 'a -> pos

File series

View file
  • Ignore whitespace
 improved-string-printing
 unix-cleanups
+ocaml-4.00-fixes
 # Placed by Bitbucket