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:
Thomas Reitmayr 2021-06-01 19:07:05 +02:00 • committed by Olly Betts
commit 5a10e10399
9 changed files with 13 additions and 13 deletions

View file

@ -803,9 +803,9 @@ namespace swig
static ID id_start = rb_intern("begin");
static ID id_noend = rb_intern("exclude_end?");
VALUE start = rb_funcall( i, id_start, 0 );
VALUE end = rb_funcall( i, id_end, 0 );
bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue );
VALUE start = rb_funcall2( i, id_start, 0, 0 );
VALUE end = rb_funcall2( i, id_end, 0, 0 );
bool noend = ( rb_funcall2( i, id_noend, 0, 0 ) == Qtrue );
int len = $self->size();