move to dune 3.0, fix warnings

This commit is contained in:
Simon Cruanes 2024-05-13 21:42:54 -04:00
parent 8eaa2b6429
commit 040fe2f97c
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
13 changed files with 29 additions and 54 deletions

View file

@ -12,7 +12,7 @@
batteries batteries
base base
sek) sek)
(flags :standard -warn-error -3-5 -safe-string -color always) (flags :standard -warn-error -3-5 -w -60 -safe-string -color always)
(optional) (optional)
(ocamlopt_flags (ocamlopt_flags
:standard :standard

View file

@ -12,9 +12,6 @@ let random_tree =
~subn:[ (int 10, fun sublist -> pure mk_node <*> small_int <*> sublist) ] ~subn:[ (int 10, fun sublist -> pure mk_node <*> small_int <*> sublist) ]
(int_range 15 150)) (int_range 15 150))
let random_list =
CCRandom.(int 5 >>= fun len -> CCList.random_len len random_tree)
let rec eq t1 t2 = let rec eq t1 t2 =
match t1, t2 with match t1, t2 with
| Empty, Empty -> true | Empty, Empty -> true

View file

@ -16,9 +16,6 @@ let app_ints f l = B.Tree.concat (List.map (app_int f) l)
(* for benchmark *) (* for benchmark *)
let repeat = 3 let repeat = 3
(* composition *)
let ( %% ) f g x = f (g x)
let opaque_ignore x = ignore (Sys.opaque_identity x) let opaque_ignore x = ignore (Sys.opaque_identity x)
module L = struct module L = struct
@ -144,8 +141,6 @@ module L = struct
(* APPEND *) (* APPEND *)
let append_ f (l1, l2, l3) = ignore (f (f l1 l2) l3)
let bench_append ?(time = 2) n = let bench_append ?(time = 2) n =
let l1 = CCList.(1 -- n) in let l1 = CCList.(1 -- n) in
let l2 = CCList.(n + 1 -- (2 * n)) in let l2 = CCList.(n + 1 -- (2 * n)) in

View file

@ -9,7 +9,7 @@ tags: ["containers" "RAL" "function" "vector" "okasaki"]
homepage: "https://github.com/c-cube/ocaml-containers/" homepage: "https://github.com/c-cube/ocaml-containers/"
bug-reports: "https://github.com/c-cube/ocaml-containers/issues" bug-reports: "https://github.com/c-cube/ocaml-containers/issues"
depends: [ depends: [
"dune" {>= "2.9"} "dune" {>= "3.0"}
"ocaml" {>= "4.08"} "ocaml" {>= "4.08"}
"containers" {= version} "containers" {= version}
"qcheck-core" {>= "0.18" & with-test} "qcheck-core" {>= "0.18" & with-test}

View file

@ -10,7 +10,7 @@ tags: ["stdlib" "containers" "iterators" "list" "heap" "queue"]
homepage: "https://github.com/c-cube/ocaml-containers/" homepage: "https://github.com/c-cube/ocaml-containers/"
bug-reports: "https://github.com/c-cube/ocaml-containers/issues" bug-reports: "https://github.com/c-cube/ocaml-containers/issues"
depends: [ depends: [
"dune" {>= "2.9"} "dune" {>= "3.0"}
"ocaml" {>= "4.08"} "ocaml" {>= "4.08"}
"either" "either"
"dune-configurator" "dune-configurator"

23
dune
View file

@ -16,3 +16,26 @@
(locks /ctest) (locks /ctest)
(action (action
(diff README.md README.md.corrected))) (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)))

View file

@ -1,4 +1,4 @@
(lang dune 2.9) (lang dune 3.0)
(name containers) (name containers)
(generate_opam_files true) (generate_opam_files true)

View file

@ -16,8 +16,6 @@ let rec pp_sexpr out (s : sexp) : unit =
l; l;
Format.fprintf out "@])" Format.fprintf out "@])"
let str_of_sexp = CCFormat.to_string pp_sexpr
let skip_white_and_comments = let skip_white_and_comments =
fix @@ fun self -> fix @@ fun self ->
skip_white skip_white

View file

@ -1,7 +1,7 @@
(executable (executable
(name check_labelled_mods) (name check_labelled_mods)
(modules 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)) (libraries containers))
(executable (executable

View file

@ -10,10 +10,6 @@ module Hist = struct
let create () : t = { tbl = Hashtbl.create 32; n_samples = 0 } 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 = let add_n self x n =
Hashtbl.replace self.tbl x (n + try Hashtbl.find self.tbl x with _ -> 0); Hashtbl.replace self.tbl x (n + try Hashtbl.find self.tbl x with _ -> 0);
self.n_samples <- n + self.n_samples self.n_samples <- n + self.n_samples

View file

@ -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 (executable
(name mdx_runner) (name mdx_runner)
(libraries containers) (libraries containers)

View file

@ -6,9 +6,6 @@ module Cbor = Containers_cbor
type json = Yojson.Safe.t type json = Yojson.Safe.t
let pp_json = J.pretty_print ~std:true
let spf = Printf.sprintf
module Test = struct module Test = struct
type expect = type expect =
| Diagnostic of string | Diagnostic of string
@ -20,14 +17,6 @@ module Test = struct
expect: expect; expect: expect;
roundtrip: bool; 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 end
let list_assoc_opt x l = try Some (List.assoc x l) with _ -> None let list_assoc_opt x l = try Some (List.assoc x l) with _ -> None

View file

@ -1,6 +1,6 @@
(test (test
(name t) (name t)
(flags :standard -strict-sequence -warn-error -a+8) (flags :standard -strict-sequence -warn-error -a+8 -w -48-60)
(modes (modes
(best exe)) (best exe))
(package containers) (package containers)