Skip to content

Commit bc4e217

Browse files
committed
fix compat
1 parent f65e3a4 commit bc4e217

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
@@ -3134,7 +3134,7 @@ let from_cmo ?(includes = []) ?(include_cmis = false) ?(debug = false) compunit
31343134
Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:0 ic);
31353135
if times () then Format.eprintf " read debug events: %a@." Timer.print t;
31363136
let hints = Hints.create () in
3137-
if Ocaml_compiler.Cmo_format.hints_pos compunit <> 0
3137+
if Ocaml_compiler.Cmo_format.hints_size compunit > 0
31383138
then (
31393139
seek_in ic (Ocaml_compiler.Cmo_format.hints_pos compunit);
31403140
Hints.read hints ~orig:0 ic);
@@ -3159,7 +3159,7 @@ let from_cma ?(includes = []) ?(include_cmis = false) ?(debug = false) lib ic =
31593159
then (
31603160
seek_in ic compunit.Cmo_format.cu_debug;
31613161
Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:!orig ic);
3162-
if Ocaml_compiler.Cmo_format.hints_pos compunit <> 0
3162+
if Ocaml_compiler.Cmo_format.hints_size compunit > 0
31633163
then (
31643164
seek_in ic (Ocaml_compiler.Cmo_format.hints_pos compunit);
31653165
Hints.read hints ~orig:!orig ic);

0 commit comments

Comments
 (0)