Add support for Ruby 2.7

This commit fixes the signatures of various callback methods
and cleans up the macro definitions used for casting callbacks.

Note that the transparent version of the macro RUBY_METHOD_FUNC
is currently masked behind RUBY_DEVEL, see commit
1d91feaf13
In order to still support strict signature checking and prevent
nasty deprecation warnings, the use of RUBY_METHOD_FUNC had to
be replaced with VALUEFUNC.
This commit is contained in:
Thomas Reitmayr 2019-12-30 20:11:03 +01:00
commit 00e291b319
5 changed files with 38 additions and 49 deletions

View file

@ -174,7 +174,7 @@ namespace swig {
return rb_inspect(_obj);
}
static VALUE swig_rescue_swallow(VALUE)
static VALUE swig_rescue_swallow(VALUE, VALUE)
{
/*
VALUE errstr = rb_obj_as_string(rb_errinfo());
@ -203,8 +203,8 @@ namespace swig {
args.id = op_id;
args.nargs = 1;
args.target = VALUE(other);
ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
(RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args),
(VALUEFUNC(swig_rescue_swallow)), Qnil);
}
if (ret == Qnil) {
VALUE a = rb_funcall( _obj, hash_id, 0 );
@ -243,8 +243,8 @@ namespace swig {
args.id = op_id;
args.nargs = 0;
args.target = Qnil;
ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
(RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args),
(VALUEFUNC(swig_rescue_swallow)), Qnil);
SWIG_RUBY_THREAD_END_BLOCK;
return ret;
}
@ -262,8 +262,8 @@ namespace swig {
args.id = op_id;
args.nargs = 1;
args.target = VALUE(other);
ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
(RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args),
(VALUEFUNC(swig_rescue_swallow)), Qnil);
SWIG_RUBY_THREAD_END_BLOCK;
return GC_VALUE(ret);
}