Skip to content

Some OCaml 5 build fixes #5755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ocaml/forkexecd/lib/fe_argv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module Add = struct
let each f xs = xs |> List.map f |> List.concat |> many

let fmt fmt =
Printf.kprintf (fun str s -> ((), {s with argv= str :: s.argv})) fmt
Printf.ksprintf (fun str s -> ((), {s with argv= str :: s.argv})) fmt

let file_descr uuid fd s = ((), {s with fds= (uuid, fd) :: s.fds})

Expand Down
2 changes: 1 addition & 1 deletion ocaml/forkexecd/lib/forkhelpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ let waitpid (sock, pid) =
let waitpid_nohang (sock, pid) =
let verbose = false in
if verbose then D.debug "%s pid=%d" __FUNCTION__ pid ;
let fail fmt = Printf.kprintf failwith fmt in
let fail fmt = Printf.ksprintf failwith fmt in
Unix.set_nonblock sock ;
match Fecomms.read_raw_rpc sock with
| Ok Fe.(Finished (WEXITED n)) ->
Expand Down
2 changes: 1 addition & 1 deletion ocaml/forkexecd/src/child.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let debug (fmt : ('a, unit, string, unit) format4) =
Printf.kprintf (fun s -> Printf.fprintf stderr "%s\n" s) fmt
Printf.ksprintf (fun s -> Printf.fprintf stderr "%s\n" s) fmt

exception Cancelled

Expand Down
2 changes: 1 addition & 1 deletion ocaml/forkexecd/src/fe_debug.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let gettimestring () =
let reset () = debug_log := []

let debug (fmt : ('a, unit, string, unit) format4) =
Printf.kprintf
Printf.ksprintf
(fun s ->
debug_log :=
Printf.sprintf "%s|%d|%s\n" (gettimestring ()) (Unix.getpid ()) s
Expand Down
4 changes: 2 additions & 2 deletions ocaml/libs/log/debug.ml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ functor
->
struct
let output level priority (fmt : ('a, unit, string, 'b) format4) =
Printf.kprintf
Printf.ksprintf
(fun s ->
if not (is_disabled Brand.name level) then
output_log Brand.name level priority s
Expand All @@ -336,7 +336,7 @@ functor
let critical fmt = output Syslog.Crit "critical" fmt

let audit ?(raw = false) (fmt : ('a, unit, string, 'b) format4) =
Printf.kprintf
Printf.ksprintf
(fun s ->
let msg = if raw then s else format true Brand.name "audit" s in
Syslog.log Syslog.Local6 Syslog.Info (escape msg) ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ end
(* === UCS Validators === *)

module type UCS_VALIDATOR = sig
val validate : Uchar.t -> unit [@@inline]
val validate : Uchar.t -> unit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two modules that seem to be of this type already inline this method

end

module UTF8_UCS_validator = struct
Expand Down
4 changes: 2 additions & 2 deletions ocaml/mpathalert/mpathalert.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ let stdout_m = Mutex.create ()
let debug (fmt : ('a, unit, string, unit) format4) =
if !print_debug then
with_lock stdout_m (fun () ->
Printf.kprintf
Printf.ksprintf
(fun s ->
Printf.printf "%s [%d] %s\n"
(time_of_float (Unix.gettimeofday ()))
Expand All @@ -48,7 +48,7 @@ let debug (fmt : ('a, unit, string, unit) format4) =
fmt
)
else
Printf.kprintf (Fun.const ()) fmt
Printf.ksprintf (Fun.const ()) fmt

type t = {
host: [`host] Uuidx.t
Expand Down
2 changes: 1 addition & 1 deletion ocaml/perftest/perfdebug.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let stdout_m = Mutex.create ()

let debug ?(out = stdout) (fmt : ('a, unit, string, unit) format4) =
Xapi_stdext_threads.Threadext.Mutex.execute stdout_m (fun () ->
Printf.kprintf
Printf.ksprintf
(fun s ->
Printf.fprintf out "%s\n" s ;
flush stdout
Expand Down
4 changes: 2 additions & 2 deletions ocaml/rrd2csv/src/rrd2csv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module Stdout = struct
let debug (fmt : ('a, unit, string, unit) format4) =
if !print_debug then
Xapi_stdext_threads.Threadext.Mutex.execute stdout_m (fun () ->
Printf.kprintf
Printf.ksprintf
(fun s ->
Printf.printf "%s [%d] %s\n"
(time_of_float (Unix.gettimeofday ()))
Expand All @@ -48,7 +48,7 @@ module Stdout = struct
fmt
)
else
Printf.kprintf (fun _ -> ()) fmt
Printf.ksprintf (fun _ -> ()) fmt

let string_of_float flt =
if fst (modf flt) = 0. then
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/certificates_sync.ml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ let update ~__context =

let internal_error fmt =
fmt
|> Printf.kprintf @@ fun msg ->
|> Printf.ksprintf @@ fun msg ->
error "%s" msg ;
raise Api_errors.(Server_error (internal_error, [msg]))

Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/import.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1832,7 +1832,7 @@ module VTPM : HandlerTools = struct
type precheck_t = Import of vtpm'

let fail fmt =
Printf.kprintf
Printf.ksprintf
(fun msg -> raise Api_errors.(Server_error (import_error_generic, [msg])))
fmt

Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/importexport.ml
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ module Devicetype = struct
| "vtpm" ->
VTPM
| other ->
let fail fmt = Printf.kprintf failwith fmt in
let fail fmt = Printf.ksprintf failwith fmt in
fail "%s: Type '%s' not one of [%s]" __FUNCTION__ other
(String.concat "; " (List.map to_string all))
end
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/xapi_xenops.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3402,7 +3402,7 @@ let transform_xenops_exn ~__context ~vm queue_name f =
Backtrace.reraise e e'
in
let internal fmt =
Printf.kprintf (fun x -> reraise Api_errors.internal_error [x]) fmt
Printf.ksprintf (fun x -> reraise Api_errors.internal_error [x]) fmt
in
match e with
| Xenopsd_error e' -> (
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xcp-rrdd/bin/rrdd/xcp_rrdd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ let bytes_per_mem_vm = 1024

let mem_vm_writer_pages = ((max_supported_vms * bytes_per_mem_vm) + 4095) / 4096

let res_error fmt = Printf.kprintf Result.error fmt
let res_error fmt = Printf.ksprintf Result.error fmt

let ok x = Result.ok x

Expand Down
2 changes: 1 addition & 1 deletion ocaml/xe-cli/newcli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let debug fmt =
let printer s =
match !debug_channel with Some c -> output_string c s | None -> ()
in
Printf.kprintf printer fmt
Printf.ksprintf printer fmt

(* usage message *)
exception Usage
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenopsd/lib/xenops_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module D = Debug.Make (struct let name = "xenops_server" end)
open D

let internal_error fmt =
Printf.kprintf
Printf.ksprintf
(fun str ->
error "%s" str ;
raise (Xenopsd_error (Internal_error str))
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenopsd/pvs/pvs_proxy_setup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ end)
module XS = Ezxenstore_core.Xenstore

let error fmt =
Printf.kprintf
Printf.ksprintf
(fun msg ->
D.error "%s" msg ;
Result.error (`Msg msg)
Expand Down
4 changes: 2 additions & 2 deletions ocaml/xenopsd/xc/device.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let finally = Xapi_stdext_pervasives.Pervasiveext.finally
let with_lock = Xapi_stdext_threads.Threadext.Mutex.execute

let internal_error fmt =
Printf.kprintf
Printf.ksprintf
(fun str ->
error "%s" str ;
raise (Xenopsd_error (Internal_error str))
Expand Down Expand Up @@ -3628,7 +3628,7 @@ module Dm = struct
Q.Dm.pci_assign_guest ~xs ~index ~host

let ioemu_failed emu fmt =
Printf.kprintf (fun msg -> raise (Ioemu_failed (emu, msg))) fmt
Printf.ksprintf (fun msg -> raise (Ioemu_failed (emu, msg))) fmt

let wait_for_vgpu_state states ~timeout ~xs ~domid ~task vgpus =
let open Xenops_interface.Vgpu in
Expand Down
6 changes: 2 additions & 4 deletions ocaml/xenopsd/xc/domain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@ let restore_common (task : Xenops_task.task_handle) ~xc ~xs
in
(th, ch)
in
let receive_thread_status threads_and_channels =
let[@inline never] receive_thread_status threads_and_channels =
(* Receive the status from all reader threads and let them exit.
This happens in two steps to make sure that we are unblocking and
closing all threads also in case of errors. *)
Expand All @@ -1549,9 +1549,7 @@ let restore_common (task : Xenops_task.task_handle) ~xc ~xs
(* Handle results returned by emu-manager *)
let emu_manager_results = handle_results () in
(* Wait for reader threads to complete *)
let[@inlined never] thread_status =
receive_thread_status threads_and_channels
in
let thread_status = receive_thread_status threads_and_channels in
(* Chain all together, and we are done! *)
let res =
emu_manager_results >>= fun result ->
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenopsd/xc/xenops_server_xen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let finally = Xapi_stdext_pervasives.Pervasiveext.finally
let with_lock = Xapi_stdext_threads.Threadext.Mutex.execute

let internal_error fmt =
Printf.kprintf
Printf.ksprintf
(fun str ->
error "%s" str ;
raise (Xenopsd_error (Internal_error str))
Expand Down
Loading