[BRLTTY] Patch: support for OCaml-4.04
Shérab
Sebastien.Hinderer at ens-lyon.org
Tue Nov 8 11:41:59 EST 2016
Jaroslav Skarvada (2016/11/08 11:19 -0500):
>
>
> ----- Original Message -----
> > [quoted lines by Jaroslav Skarvada on 2016/11/08 at 07:58 -0500]
> >
> > >it seems that brltty-5.4 doesn't compile with OCaml-4.04.
> > >Tthe code uses CAMLlocal without calling CAMLparam which is against
> > >current OCaml documentation. More details in Fedora bug [1]. Attached
> > >patch should fix the problem
> >
> > This gives me the following two warnings. How can they be resolved?
> >
> > ./brlapi_stubs.c: In function ‘raise_brlapi_error’:
> > ./brlapi_stubs.c:147:29: warning: unused variable ‘caml__frame’
> > [-Wunused-variable]
> > ./brlapi_stubs.c: In function ‘raise_brlapi_exception’:
> > ./brlapi_stubs.c:161:29: warning: unused variable ‘caml__frame’
> > [-Wunused-variable]
> >
>
> Which version of OCaml? I haven't encountered these warnings with OCaml-4.04.
> To be honest I don't know much about OCaml, but this looks like OCaml bug,
> I can forward it to OCaml maintainer
No no it's not a bug. See https://github.com/brltty/brltty/pull/81
Shérab.
-------------- next part --------------
diff --git a/Bindings/OCaml/brlapi_stubs.c b/Bindings/OCaml/brlapi_stubs.c
index 1e66f9e..aabdc14 100644
--- a/Bindings/OCaml/brlapi_stubs.c
+++ b/Bindings/OCaml/brlapi_stubs.c
@@ -145,12 +145,14 @@ CAMLprim value brlapiml_errorCode_of_error(value camlError)
static void raise_brlapi_error(void)
{
static value *exception = NULL;
+ CAMLparam0();
CAMLlocal1(res);
if (exception==NULL) exception = caml_named_value("Brlapi_error");
res = caml_alloc(2,0);
Store_field(res, 0, *exception);
Store_field(res, 1, constrCamlError(&brlapi_error));
caml_raise(res);
+ CAMLreturn0;
}
/* Function : raise_brlapi_exception */
@@ -159,6 +161,7 @@ static void BRLAPI_STDCALL raise_brlapi_exception(int err, brlapi_packetType_t t
{
static value *exception = NULL;
int i;
+ CAMLparam0();
CAMLlocal2(str, res);
str = caml_alloc_string(size);
for (i=0; i<size; i++) Byte(str, i) = ((char *) packet)[i];
@@ -169,6 +172,7 @@ static void BRLAPI_STDCALL raise_brlapi_exception(int err, brlapi_packetType_t t
Store_field(res, 2, caml_copy_int32(type));
Store_field(res, 3, str);
caml_raise(res);
+ CAMLreturn0;
}
/* function packDots */
More information about the BRLTTY
mailing list