From: Edwin Török Date: Thu, 12 Jan 2023 11:28:29 +0000 (+0000) Subject: tools/ocaml/libs: Don't declare stubs as taking void X-Git-Tag: RELEASE-4.17.1~58 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2c21e1bee6d62cbd523069e839086addf35da9f2;p=xen.git tools/ocaml/libs: Don't declare stubs as taking void There is no such thing as an Ocaml function (C stub or otherwise) taking no parameters. In the absence of any other parameters, unit is still passed. This doesn't explode with any ABI we care about, but would malfunction for an ABI environment such as stdcall. Fixes: c3afd398ba7f ("ocaml: Add XS bindings.") Fixes: 8b7ce06a2d34 ("ocaml: Add XC bindings.") Signed-off-by: Edwin Török Signed-off-by: Andrew Cooper Acked-by: Christian Lindig (cherry picked from commit ff8b560be80b9211c303d74df7e4b3921d2bb8ca) --- diff --git a/tools/ocaml/libs/xb/xenbus_stubs.c b/tools/ocaml/libs/xb/xenbus_stubs.c index 3065181a55..97116b0782 100644 --- a/tools/ocaml/libs/xb/xenbus_stubs.c +++ b/tools/ocaml/libs/xb/xenbus_stubs.c @@ -30,10 +30,9 @@ #include #include -CAMLprim value stub_header_size(void) +CAMLprim value stub_header_size(value unit) { - CAMLparam0(); - CAMLreturn(Val_int(sizeof(struct xsd_sockmsg))); + return Val_int(sizeof(struct xsd_sockmsg)); } CAMLprim value stub_header_of_string(value s) diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c index f37848ae0b..6eb0ea69da 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -67,9 +67,9 @@ static void Noreturn failwith_xc(xc_interface *xch) caml_raise_with_string(*caml_named_value("xc.error"), error_str); } -CAMLprim value stub_xc_interface_open(void) +CAMLprim value stub_xc_interface_open(value unit) { - CAMLparam0(); + CAMLparam1(unit); xc_interface *xch; /* Don't assert XC_OPENFLAG_NON_REENTRANT because these bindings