Bug #14425 » 0001-ruby.h-relax-rb_funcall-check-on-extra-args-for-clan.patch
ext/-test-/funcall/passing_block.c → ext/-test-/funcall/funcall.c | ||
---|---|---|
return rb_funcall_passing_block(self, rb_intern("target"), argc, argv);
|
||
}
|
||
static VALUE
|
||
extra_args_name(VALUE self)
|
||
{
|
||
/*
|
||
* at least clang 5.x gets tripped by the extra 0 arg
|
||
* [ruby-core:85266] [Bug #14425]
|
||
*/
|
||
return rb_funcall(self, rb_intern("name"), 0, 0);
|
||
}
|
||
void
|
||
Init_funcall(void)
|
||
{
|
||
VALUE cRelay = rb_path2class("TestFuncall::Relay");
|
||
VALUE cTestFuncall = rb_path2class("TestFuncall");
|
||
VALUE cRelay = rb_define_module_under(cTestFuncall, "Relay");
|
||
rb_define_singleton_method(cRelay,
|
||
"with_funcall2",
|
||
... | ... | |
"with_funcall_passing_block",
|
||
with_funcall_passing_block,
|
||
-1);
|
||
rb_define_singleton_method(cTestFuncall, "extra_args_name",
|
||
extra_args_name,
|
||
0);
|
||
}
|
include/ruby/ruby.h | ||
---|---|---|
# if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P)
|
||
# if HAVE_ATTRIBUTE_ERRORFUNC
|
||
ERRORFUNC((" argument length doesn't match"), int rb_varargs_bad_length(int,int));
|
||
# elif defined(__clang__) /* [ruby-core:85266] [Bug #14425] */
|
||
# define rb_varargs_bad_length(argc, vargc) ((argc)/((argc) <= (vargc)))
|
||
# else
|
||
# define rb_varargs_bad_length(argc, vargc) ((argc)/((argc) == (vargc)))
|
||
# endif
|
test/-ext-/funcall/test_funcall.rb | ||
---|---|---|
# frozen_string_literal: true
|
||
require 'test/unit'
|
||
class TestFuncall < Test::Unit::TestCase
|
||
require '-test-/funcall'
|
||
def test_funcall_extra_args
|
||
assert_equal 'TestFuncall', TestFuncall.extra_args_name,
|
||
'[ruby-core:85266] [Bug #14425]'
|
||
end
|
||
end
|
- « Previous
- 1
- 2
- Next »