From d5ee4b77897f7e36517b20324b2e08d146e9e056 Mon Sep 17 00:00:00 2001 From: Emilio Jesus Gallego Arias Date: Sun, 28 Jun 2020 20:11:28 +0200 Subject: [PATCH] [ocaml] Restore compatibility with OCaml 4.12 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: #3583 cc: #2298 Signed-off-by: Emilio Jesus Gallego Arias --- src/catapult/catapult.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/catapult/catapult.ml b/src/catapult/catapult.ml index ae4d53290632..2077496071e2 100644 --- a/src/catapult/catapult.ml +++ b/src/catapult/catapult.ml @@ -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 @@ -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