ruby-changes:50033
From: nobu <ko1@a...>
Date: Thu, 1 Feb 2018 12:56:01 +0900 (JST)
Subject: [ruby-changes:50033] nobu:r62151 (trunk): ruby.h: relax rb_funcall(obj, id, 0, 0) case only
nobu 2018-02-01 12:55:55 +0900 (Thu, 01 Feb 2018) New Revision: 62151 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62151 Log: 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] Modified files: trunk/include/ruby/ruby.h Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 62150) +++ include/ruby/ruby.h (revision 62151) @@ -1780,17 +1780,19 @@ VALUE rb_check_symbol(volatile VALUE *na https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1780 (((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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/