[OCaml] Fix compilation errors with OCaml 4.09.0

caml_named_value() was modified to return a const value* in OCaml
4.09.0.

Closes #1686.
This commit is contained in:
Zackery Spytz 2019-12-29 22:41:43 -07:00
commit 02862fb278
5 changed files with 10 additions and 7 deletions

View file

@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.0.2 (in progress)
===========================
2019-12-29: ZackerySpytz
[OCaml] #1686 Fix compilation errors with OCaml 4.09.0.
2019-12-10: wsfulton
#1679 Fix parsing of C++11 identifiers with special meaning (final and override) when
they are used as part of the scope name of an identifier, such as a namespace name.

View file

@ -77,7 +77,7 @@ type _value = c_obj
%typemap(out) SWIGTYPE [] {
int i;
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
const CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
$result = caml_array_new($1_dim0);
for( i = 0; i < $1_dim0; i++ ) {

View file

@ -62,7 +62,7 @@
#if 0
%typemap(argout) SWIGTYPE & {
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
const CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
if( fromval ) {
swig_result =
caml_list_append(swig_result,
@ -75,7 +75,7 @@
}
}
%typemap(argout) SWIGTYPE && {
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
const CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
if( fromval ) {
swig_result =
caml_list_append(swig_result,

View file

@ -407,7 +407,7 @@ extern "C" {
CAMLreturn((long)SWIG_Int64_val(SWIG_Field(SWIG_Field(v,0),0)));
case C_enum: {
SWIG_CAMLlocal1(ret);
CAML_VALUE *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int");
const CAML_VALUE *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int");
if( !name ) caml_failwith( "Not an enum conversion" );
ret = caml_callback2(*enum_to_int,*caml_named_value(name),v);
CAMLreturn(caml_long_val(ret));
@ -451,7 +451,7 @@ extern "C" {
CAMLparam1(v);
void *outptr = NULL;
swig_type_info *outdescr = NULL;
static CAML_VALUE *func_val = NULL;
static const CAML_VALUE *func_val = NULL;
if( v == Val_unit ) {
*out = 0;
@ -574,7 +574,7 @@ extern "C" {
CAMLparam0();
SWIG_CAMLlocal1(result);
CAML_VALUE *fromval = caml_named_value(name);
const CAML_VALUE *fromval = caml_named_value(name);
if (fromval) {
result = caml_callback(*fromval, caml_val_ptr(ptr, descriptor));
} else {

View file

@ -1619,7 +1619,7 @@ public:
/* pass the method call on to the OCaml object */
Printv(w->code,
"swig_result = caml_swig_alloc(1,C_list);\n" "SWIG_Store_field(swig_result,0,args);\n" "args = swig_result;\n" "swig_result = Val_unit;\n", 0);
Printf(w->code, "static CAML_VALUE *swig_ocaml_func_val = NULL;\n" "if (!swig_ocaml_func_val) {\n");
Printf(w->code, "static const CAML_VALUE *swig_ocaml_func_val = NULL;\n" "if (!swig_ocaml_func_val) {\n");
Printf(w->code, " swig_ocaml_func_val = caml_named_value(\"swig_runmethod\");\n }\n");
Printf(w->code, "swig_result = caml_callback3(*swig_ocaml_func_val,swig_get_self(),caml_copy_string(\"%s\"),args);\n", Getattr(n, "name"));
/* exception handling */