Skip to content

Commit 242da0f

Browse files
committed
fix compat
1 parent 1b4a5d2 commit 242da0f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

compiler/lib/ocaml_compiler.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,5 +284,11 @@ module Cmo_format = struct
284284

285285
let force_link (t : t) = t.cu_force_link
286286

287-
let hints_pos (t : t) = t.cu_hint
287+
let hints_pos (t : t) = t.cu_hint [@@if ocaml_version >= (5, 3, 1)]
288+
289+
let hints_size (t : t) = t.cu_hintsize [@@if ocaml_version >= (5, 3, 1)]
290+
291+
let hints_size _ = 0 [@@if ocaml_version < (5, 3, 1)]
292+
293+
let hints_pos _ = 0 [@@if ocaml_version < (5, 3, 1)]
288294
end

compiler/lib/ocaml_compiler.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,6 @@ module Cmo_format : sig
7575
val imports : t -> (string * string option) list
7676

7777
val hints_pos : t -> int
78+
79+
val hints_size : t -> int
7880
end

compiler/lib/parse_bytecode.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3133,7 +3133,7 @@ let from_cmo ?(includes = []) ?(include_cmis = false) ?(debug = false) compunit
31333133
Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:0 ic);
31343134
if times () then Format.eprintf " read debug events: %a@." Timer.print t;
31353135
let hints = Hints.create () in
3136-
if Ocaml_compiler.Cmo_format.hints_pos compunit <> 0
3136+
if Ocaml_compiler.Cmo_format.hints_size compunit > 0
31373137
then (
31383138
seek_in ic (Ocaml_compiler.Cmo_format.hints_pos compunit);
31393139
Hints.read hints ~orig:0 ic);
@@ -3158,7 +3158,7 @@ let from_cma ?(includes = []) ?(include_cmis = false) ?(debug = false) lib ic =
31583158
then (
31593159
seek_in ic compunit.Cmo_format.cu_debug;
31603160
Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:!orig ic);
3161-
if Ocaml_compiler.Cmo_format.hints_pos compunit <> 0
3161+
if Ocaml_compiler.Cmo_format.hints_size compunit > 0
31623162
then (
31633163
seek_in ic (Ocaml_compiler.Cmo_format.hints_pos compunit);
31643164
Hints.read hints ~orig:!orig ic);

0 commit comments

Comments
 (0)