Ruby: Fix warnings in generated code about missing parameter in variadic macro
The Ruby C API function 'rb_funcall' is used in various places in generated code for invoking a Ruby method without parameters. The C function uses a variadic parameter list for the arguments passed to Ruby, therefore in these cases the list of variadic parameters is empty. As an optimization Ruby may implement the 'rb_funcall' function as a macro which however will not accept an empty list of arguments for '...' as of C99 and C++11. In order to prevent compiler warnings, this commit replaces all such occurrences with a call to 'rb_funcall2' (which in its current name 'rb_funcallv' is invoked by the 'rb_funcall' macro anyway, at least for Ruby 2.6.6).
This commit is contained in:
parent
c7cfabd0a7
commit
5a10e10399
9 changed files with 13 additions and 13 deletions
|
|
@ -207,8 +207,8 @@ namespace swig {
|
||||||
(VALUEFUNC(swig_rescue_swallow)), Qnil);
|
(VALUEFUNC(swig_rescue_swallow)), Qnil);
|
||||||
}
|
}
|
||||||
if (ret == Qnil) {
|
if (ret == Qnil) {
|
||||||
VALUE a = rb_funcall( _obj, hash_id, 0 );
|
VALUE a = rb_funcall2( _obj, hash_id, 0, 0 );
|
||||||
VALUE b = rb_funcall( VALUE(other), hash_id, 0 );
|
VALUE b = rb_funcall2( VALUE(other), hash_id, 0, 0 );
|
||||||
res = op_func(a, b);
|
res = op_func(a, b);
|
||||||
} else {
|
} else {
|
||||||
res = RTEST(ret);
|
res = RTEST(ret);
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,12 @@ SWIGINTERN int SWIG_Is_Complex( VALUE obj ) {
|
||||||
|
|
||||||
SWIGINTERN VALUE SWIG_Complex_Real(VALUE obj) {
|
SWIGINTERN VALUE SWIG_Complex_Real(VALUE obj) {
|
||||||
static ID real_id = rb_intern("real");
|
static ID real_id = rb_intern("real");
|
||||||
return rb_funcall(obj, real_id, 0);
|
return rb_funcall2(obj, real_id, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN VALUE SWIG_Complex_Imaginary(VALUE obj) {
|
SWIGINTERN VALUE SWIG_Complex_Imaginary(VALUE obj) {
|
||||||
static ID imag_id = rb_intern("imag");
|
static ID imag_id = rb_intern("imag");
|
||||||
return rb_funcall(obj, imag_id, 0);
|
return rb_funcall2(obj, imag_id, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -803,9 +803,9 @@ namespace swig
|
||||||
static ID id_start = rb_intern("begin");
|
static ID id_start = rb_intern("begin");
|
||||||
static ID id_noend = rb_intern("exclude_end?");
|
static ID id_noend = rb_intern("exclude_end?");
|
||||||
|
|
||||||
VALUE start = rb_funcall( i, id_start, 0 );
|
VALUE start = rb_funcall2( i, id_start, 0, 0 );
|
||||||
VALUE end = rb_funcall( i, id_end, 0 );
|
VALUE end = rb_funcall2( i, id_end, 0, 0 );
|
||||||
bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue );
|
bool noend = ( rb_funcall2( i, id_noend, 0, 0 ) == Qtrue );
|
||||||
|
|
||||||
int len = $self->size();
|
int len = $self->size();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -443,7 +443,7 @@ int SWIG_Ruby_arity( VALUE proc, int minimal )
|
||||||
{
|
{
|
||||||
if ( rb_respond_to( proc, swig_arity_id ) )
|
if ( rb_respond_to( proc, swig_arity_id ) )
|
||||||
{
|
{
|
||||||
VALUE num = rb_funcall( proc, swig_arity_id, 0 );
|
VALUE num = rb_funcall2( proc, swig_arity_id, 0, 0 );
|
||||||
int arity = NUM2INT(num);
|
int arity = NUM2INT(num);
|
||||||
if ( arity < 0 && (arity+1) < -minimal ) return 1;
|
if ( arity < 0 && (arity+1) < -minimal ) return 1;
|
||||||
if ( arity == minimal ) return 1;
|
if ( arity == minimal ) return 1;
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
int res = SWIG_ERROR;
|
int res = SWIG_ERROR;
|
||||||
if ( TYPE(obj) == T_HASH ) {
|
if ( TYPE(obj) == T_HASH ) {
|
||||||
static ID id_to_a = rb_intern("to_a");
|
static ID id_to_a = rb_intern("to_a");
|
||||||
VALUE items = rb_funcall(obj, id_to_a, 0);
|
VALUE items = rb_funcall2(obj, id_to_a, 0, 0);
|
||||||
res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val);
|
res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||||
} else {
|
} else {
|
||||||
map_type *p;
|
map_type *p;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
int res = SWIG_ERROR;
|
int res = SWIG_ERROR;
|
||||||
if ( TYPE(obj) == T_HASH ) {
|
if ( TYPE(obj) == T_HASH ) {
|
||||||
static ID id_to_a = rb_intern("to_a");
|
static ID id_to_a = rb_intern("to_a");
|
||||||
VALUE items = rb_funcall(obj, id_to_a, 0);
|
VALUE items = rb_funcall2(obj, id_to_a, 0, 0);
|
||||||
return traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
return traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||||
} else {
|
} else {
|
||||||
multimap_type *p;
|
multimap_type *p;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
int res = SWIG_ERROR;
|
int res = SWIG_ERROR;
|
||||||
if (TYPE(obj) == T_HASH) {
|
if (TYPE(obj) == T_HASH) {
|
||||||
static ID id_to_a = rb_intern("to_a");
|
static ID id_to_a = rb_intern("to_a");
|
||||||
VALUE items = rb_funcall(obj, id_to_a, 0);
|
VALUE items = rb_funcall2(obj, id_to_a, 0, 0);
|
||||||
res = traits_asptr_stdseq<std::unordered_map<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
|
res = traits_asptr_stdseq<std::unordered_map<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
|
||||||
} else {
|
} else {
|
||||||
map_type *p;
|
map_type *p;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
int res = SWIG_ERROR;
|
int res = SWIG_ERROR;
|
||||||
if ( TYPE(obj) == T_HASH ) {
|
if ( TYPE(obj) == T_HASH ) {
|
||||||
static ID id_to_a = rb_intern("to_a");
|
static ID id_to_a = rb_intern("to_a");
|
||||||
VALUE items = rb_funcall(obj, id_to_a, 0);
|
VALUE items = rb_funcall2(obj, id_to_a, 0, 0);
|
||||||
return traits_asptr_stdseq<std::unordered_multimap<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
|
return traits_asptr_stdseq<std::unordered_multimap<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
|
||||||
} else {
|
} else {
|
||||||
multimap_type *p;
|
multimap_type *p;
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ struct timeval rb_time_timeval(VALUE);
|
||||||
if (NIL_P($input))
|
if (NIL_P($input))
|
||||||
$1 = (time_t)-1;
|
$1 = (time_t)-1;
|
||||||
else
|
else
|
||||||
$1 = NUM2LONG(rb_funcall($input, rb_intern("tv_sec"), 0));
|
$1 = NUM2LONG(rb_funcall2($input, rb_intern("tv_sec"), 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(typecheck) time_t
|
%typemap(typecheck) time_t
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue