mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ruby.h: relax rb_funcall(obj, id, 0, 0) case only
* include/ruby/ruby.h (rb_varargs_argc_valid_p): relax rb_funcall check on extra args only if argc == 0, for the compatibility with wrong code which is probably confused with rb_funcallv. [Bug #14425] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
044e6f12be
commit
6eeb0f7ef4
1 changed files with 6 additions and 4 deletions
|
@ -1780,17 +1780,19 @@ VALUE rb_check_symbol(volatile VALUE *namep);
|
|||
(((argc) <= (vargc)) ? (argc) : \
|
||||
(rb_fatal("argc(%d) exceeds actual arguments(%d)", \
|
||||
argc, vargc), 0))
|
||||
# define rb_varargs_argc_valid_p(argc, vargc) \
|
||||
((argc) == 0 ? (vargc) <= 1 : /* [ruby-core:85266] [Bug #14425] */ \
|
||||
(argc) == (vargc))
|
||||
# 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)))
|
||||
# define rb_varargs_bad_length(argc, vargc) \
|
||||
((argc)/rb_varargs_argc_valid_p(argc, vargc))
|
||||
# endif
|
||||
# define rb_varargs_argc_check(argc, vargc) \
|
||||
__builtin_choose_expr(__builtin_constant_p(argc), \
|
||||
(((argc) == (vargc)) ? (argc) : \
|
||||
(rb_varargs_argc_valid_p(argc, vargc) ? (argc) : \
|
||||
rb_varargs_bad_length(argc, vargc)), \
|
||||
rb_varargs_argc_check_runtime(argc, vargc))
|
||||
# else
|
||||
|
|
Loading…
Reference in a new issue