From 0d2d4aba8ed03a864a0af0f09fe487e0decb9815 Mon Sep 17 00:00:00 2001 From: Kate Date: Sun, 26 Nov 2023 14:59:05 +0000 Subject: [PATCH] Add support for OCaml 5.1.1 --- build/prefilter.ml | 9 +++++---- src/batMarshal.mli | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build/prefilter.ml b/build/prefilter.ml index 3d288985c..5e48a940a 100644 --- a/build/prefilter.ml +++ b/build/prefilter.ml @@ -1,11 +1,11 @@ -let (major, minor, extra) = +let (major, minor, micro, extra) = Scanf.sscanf Sys.ocaml_version - "%d.%d.%d%s" (fun j n _ s -> (j, n, s)) + "%d.%d.%d%s" (fun j n m s -> (j, n, m, s)) let filter_cookie_re = Str.regexp "^##V\\([<>]?=?\\)\\([^#]+\\)##" let version_re = - Str.regexp "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" + Str.regexp "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?\\(\\.\\([0-9]+\\)\\)?" (* We track line count in the input source, to print location directives for the OCaml lexer: @@ -57,7 +57,8 @@ let rec process_line loc line = if Str.string_match version_re ver_string 0 then let ver_maj = int_of_string (Str.matched_group 1 ver_string) in let ver_min = try int_of_string (Str.matched_group 3 ver_string) with _ -> 0 in - cmp (major*100+minor) (ver_maj*100+ver_min) + let ver_mic = try int_of_string (Str.matched_group 5 ver_string) with _ -> 0 in + cmp (major*10000+minor*100+micro) (ver_maj*10000+ver_min*100+ver_mic) else if ver_string = "multicore" then cmp (if has_domains ~extra then 5 else major) 5 else diff --git a/src/batMarshal.mli b/src/batMarshal.mli index 02ef015f5..5fd3c2b32 100644 --- a/src/batMarshal.mli +++ b/src/batMarshal.mli @@ -60,7 +60,7 @@ type extern_flags = Marshal.extern_flags = No_sharing (** Don't preserve sharing *) | Closures (** Send function closures *) ##V>=4.1## | Compat_32 (** Ensure 32-bit compatibility *) -##V>=5.1## | Compression (** Compress the output if possible *) +##V>=5.1####V<5.1.1## | Compression (** Compress the output if possible *) (** The flags to the [Marshal.to_*] functions below. *) @@ -101,7 +101,7 @@ val output: _ BatInnerIO.output -> ?sharing:bool -> ?closures:bool -> 'a -> unit @since 2.3.0 *) -##V>=5.1##val compression_supported : unit -> bool +##V>=5.1####V<5.1.1##val compression_supported : unit -> bool external to_string : 'a -> extern_flags list -> string = "caml_output_value_to_string"