Skip to content

Commit

Permalink
[ocaml] Restore compatibility with OCaml 4.12
Browse files Browse the repository at this point in the history
OCaml 4.12 has introduced a new field in the `Gc.stats` record,
`forced_major_collections`. This makes compilation of Dune fail due to
`src/catapult/catapult.ml:fake_gc_stat`

We call `Gc.quick_stats` and override the set of safe fields.

Fixes: ocaml#3583

cc: ocaml#2298

Signed-off-by: Emilio Jesus Gallego Arias <e+git@x80.org>
  • Loading branch information
ejgallego committed Jun 30, 2020
1 parent 4348510 commit d5ee4b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/catapult/catapult.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ type t =
}

let fake_gc_stat =
{ Gc.minor_words = 0.
let init_gc = Gc.quick_stat () in
{ init_gc with
Gc.minor_words = 0.
; promoted_words = 0.
; major_words = 0.
; minor_collections = 0
Expand All @@ -26,7 +28,7 @@ let fake_gc_stat =
; compactions = 0
; top_heap_words = 0
; stack_size = 0
}
} [@ocaml.warning "-23"] (* all fiels of record used *)

let fake time_ref buf =
let print s = Buffer.add_string buf s in
Expand Down

0 comments on commit d5ee4b7

Please sign in to comment.