]> xenbits.xensource.com Git - xen.git/commitdiff
tools/ocaml/libs: Don't declare stubs as taking void
authorEdwin Török <edwin.torok@cloud.com>
Thu, 12 Jan 2023 11:28:29 +0000 (11:28 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 9 Feb 2023 15:55:25 +0000 (15:55 +0000)
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 <edwin.torok@cloud.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
(cherry picked from commit ff8b560be80b9211c303d74df7e4b3921d2bb8ca)

tools/ocaml/libs/xb/xenbus_stubs.c
tools/ocaml/libs/xc/xenctrl_stubs.c

index 3065181a55e666898943054f271bdd8c0d11e97d..97116b07826a764531088fd7937e8b95c5e42916 100644 (file)
 #include <xenctrl.h>
 #include <xen/io/xs_wire.h>
 
-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)
index f37848ae0bb3c4d749af5764a04c9d44b8c4ae99..6eb0ea69daced1a1bb27986eb531bbe2f77408e0 100644 (file)
@@ -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