From 040fe2f97cd34b610b8303a32e9a33a3e75e49f2 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 13 May 2024 21:42:54 -0400 Subject: [PATCH] move to dune 3.0, fix warnings --- benchs/dune | 2 +- benchs/run_bench_hash.ml | 3 --- benchs/run_benchs.ml | 5 ----- containers-data.opam | 2 +- containers.opam | 2 +- dune | 23 +++++++++++++++++++++++ dune-project | 2 +- examples/ccparse_sexp.ml | 2 -- src/core/tests/dune | 2 +- src/core/tests/test_hash.ml | 4 ---- src/dune | 23 ----------------------- tests/cbor/t_appendix_a.ml | 11 ----------- tests/core/dune | 2 +- 13 files changed, 29 insertions(+), 54 deletions(-) diff --git a/benchs/dune b/benchs/dune index 8319f4c1..f0d36ef7 100644 --- a/benchs/dune +++ b/benchs/dune @@ -12,7 +12,7 @@ batteries base sek) - (flags :standard -warn-error -3-5 -safe-string -color always) + (flags :standard -warn-error -3-5 -w -60 -safe-string -color always) (optional) (ocamlopt_flags :standard diff --git a/benchs/run_bench_hash.ml b/benchs/run_bench_hash.ml index 2e8577d4..14cf8830 100644 --- a/benchs/run_bench_hash.ml +++ b/benchs/run_bench_hash.ml @@ -12,9 +12,6 @@ let random_tree = ~subn:[ (int 10, fun sublist -> pure mk_node <*> small_int <*> sublist) ] (int_range 15 150)) -let random_list = - CCRandom.(int 5 >>= fun len -> CCList.random_len len random_tree) - let rec eq t1 t2 = match t1, t2 with | Empty, Empty -> true diff --git a/benchs/run_benchs.ml b/benchs/run_benchs.ml index 6e23f9e2..ca50ad18 100644 --- a/benchs/run_benchs.ml +++ b/benchs/run_benchs.ml @@ -16,9 +16,6 @@ let app_ints f l = B.Tree.concat (List.map (app_int f) l) (* for benchmark *) let repeat = 3 - -(* composition *) -let ( %% ) f g x = f (g x) let opaque_ignore x = ignore (Sys.opaque_identity x) module L = struct @@ -144,8 +141,6 @@ module L = struct (* APPEND *) - let append_ f (l1, l2, l3) = ignore (f (f l1 l2) l3) - let bench_append ?(time = 2) n = let l1 = CCList.(1 -- n) in let l2 = CCList.(n + 1 -- (2 * n)) in diff --git a/containers-data.opam b/containers-data.opam index e2fb4ade..a0eae5c8 100644 --- a/containers-data.opam +++ b/containers-data.opam @@ -9,7 +9,7 @@ tags: ["containers" "RAL" "function" "vector" "okasaki"] homepage: "https://github.com/c-cube/ocaml-containers/" bug-reports: "https://github.com/c-cube/ocaml-containers/issues" depends: [ - "dune" {>= "2.9"} + "dune" {>= "3.0"} "ocaml" {>= "4.08"} "containers" {= version} "qcheck-core" {>= "0.18" & with-test} diff --git a/containers.opam b/containers.opam index 50acf25a..2d9830aa 100644 --- a/containers.opam +++ b/containers.opam @@ -10,7 +10,7 @@ tags: ["stdlib" "containers" "iterators" "list" "heap" "queue"] homepage: "https://github.com/c-cube/ocaml-containers/" bug-reports: "https://github.com/c-cube/ocaml-containers/issues" depends: [ - "dune" {>= "2.9"} + "dune" {>= "3.0"} "ocaml" {>= "4.08"} "either" "dune-configurator" diff --git a/dune b/dune index e1d90408..cfd0dd6d 100644 --- a/dune +++ b/dune @@ -16,3 +16,26 @@ (locks /ctest) (action (diff README.md README.md.corrected))) + +(env + (_ + (flags + :standard + -warn-error + -a+8 + -w + -32-48-60-70 + -w + +a-4-40-42-44-70 + -color + always + -safe-string + -strict-sequence) + (ocamlopt_flags + :standard + -O3 + -unbox-closures + -unbox-closures-factor + 20 + -inline + 100))) diff --git a/dune-project b/dune-project index d05d4b37..3f1268da 100644 --- a/dune-project +++ b/dune-project @@ -1,4 +1,4 @@ -(lang dune 2.9) +(lang dune 3.0) (name containers) (generate_opam_files true) diff --git a/examples/ccparse_sexp.ml b/examples/ccparse_sexp.ml index f33fabe3..8b07f2a4 100644 --- a/examples/ccparse_sexp.ml +++ b/examples/ccparse_sexp.ml @@ -16,8 +16,6 @@ let rec pp_sexpr out (s : sexp) : unit = l; Format.fprintf out "@])" -let str_of_sexp = CCFormat.to_string pp_sexpr - let skip_white_and_comments = fix @@ fun self -> skip_white diff --git a/src/core/tests/dune b/src/core/tests/dune index a270978b..2f11a449 100644 --- a/src/core/tests/dune +++ b/src/core/tests/dune @@ -1,7 +1,7 @@ (executable (name check_labelled_mods) (modules check_labelled_mods) - (flags :standard -warn-error -a -w -3-33-35-27-39-50 -nolabels) + (flags :standard -warn-error -a -w -3-33-35-27-39-50-60 -nolabels) (libraries containers)) (executable diff --git a/src/core/tests/test_hash.ml b/src/core/tests/test_hash.ml index 86ed830e..f27b9d7d 100644 --- a/src/core/tests/test_hash.ml +++ b/src/core/tests/test_hash.ml @@ -10,10 +10,6 @@ module Hist = struct let create () : t = { tbl = Hashtbl.create 32; n_samples = 0 } - let add self x = - Hashtbl.replace self.tbl x (1 + try Hashtbl.find self.tbl x with _ -> 0); - self.n_samples <- 1 + self.n_samples - let add_n self x n = Hashtbl.replace self.tbl x (n + try Hashtbl.find self.tbl x with _ -> 0); self.n_samples <- n + self.n_samples diff --git a/src/dune b/src/dune index 39ec53cb..a89b9eb2 100644 --- a/src/dune +++ b/src/dune @@ -1,26 +1,3 @@ -(env - (_ - (flags - :standard - -warn-error - -a+8 - -w - -32-48-70 - -w - +a-4-40-42-44-70 - -color - always - -safe-string - -strict-sequence) - (ocamlopt_flags - :standard - -O3 - -unbox-closures - -unbox-closures-factor - 20 - -inline - 100))) - (executable (name mdx_runner) (libraries containers) diff --git a/tests/cbor/t_appendix_a.ml b/tests/cbor/t_appendix_a.ml index 98331d04..4644b8da 100644 --- a/tests/cbor/t_appendix_a.ml +++ b/tests/cbor/t_appendix_a.ml @@ -6,9 +6,6 @@ module Cbor = Containers_cbor type json = Yojson.Safe.t -let pp_json = J.pretty_print ~std:true -let spf = Printf.sprintf - module Test = struct type expect = | Diagnostic of string @@ -20,14 +17,6 @@ module Test = struct expect: expect; roundtrip: bool; } - - let pp_expect out = function - | Diagnostic s -> Fmt.fprintf out "(diagnostic %S)" s - | Decoded j -> Fmt.fprintf out "(@[decoded:@ %a@])" J.pp j - - let pp out (self : t) = - Fmt.fprintf out "{@[hex: %S,@ expected: %a,@ roundtrip: %b@]}" self.hex - pp_expect self.expect self.roundtrip end let list_assoc_opt x l = try Some (List.assoc x l) with _ -> None diff --git a/tests/core/dune b/tests/core/dune index d7c90a5e..6aa170b8 100644 --- a/tests/core/dune +++ b/tests/core/dune @@ -1,6 +1,6 @@ (test (name t) - (flags :standard -strict-sequence -warn-error -a+8) + (flags :standard -strict-sequence -warn-error -a+8 -w -48-60) (modes (best exe)) (package containers)