diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-22 03:31:22 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-22 03:31:22 +0000 |
commit | 9f065292da016f1a53dd247b8ad2c5648c7a4d4c (patch) | |
tree | 7f3e7ca9e2bb4776ee8449e1e69cc8a180b1126c | |
parent | 355591da8d6f9518be485861b6f37a58b713fbd4 (diff) | |
download | ruby-9f065292da016f1a53dd247b8ad2c5648c7a4d4c.tar.gz |
* include/ruby/ruby.h (rb_scan_args): use original rb_scan_args
when fmt is dynamic.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | include/ruby/ruby.h | 6 |
2 files changed, 9 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Sun May 22 12:14:06 2016 NARUSE, Yui <naruse@ruby-lang.org> + + * include/ruby/ruby.h (rb_scan_args): use original rb_scan_args + when fmt is dynamic. + Sun May 22 11:41:12 2016 NARUSE, Yui <naruse@ruby-lang.org> * class.c (rb_scan_args): moved to bottom of the file to make the diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 4d8dc8bbdf..fe2297c567 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -2150,9 +2150,11 @@ unsigned long ruby_strtoul(const char *str, char **endptr, int base); PRINTF_ARGS(int ruby_snprintf(char *str, size_t n, char const *fmt, ...), 3, 4); int ruby_vsnprintf(char *str, size_t n, char const *fmt, va_list ap); -#if defined(__GNUC__) && defined(__OPTIMIZE__) +#if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P) && defined(__OPTIMIZE__) # define rb_scan_args(argc,argvp,fmt,...) \ - rb_scan_args0(argc,argv,fmt,(sizeof((VALUE*[]){__VA_ARGS__})/sizeof(VALUE*)),(VALUE*[]){__VA_ARGS__}) + __builtin_choose_expr(__builtin_constant_p(fmt), \ + rb_scan_args0(argc,argv,fmt,(sizeof((VALUE*[]){__VA_ARGS__})/sizeof(VALUE*)),(VALUE*[]){__VA_ARGS__}), \ + rb_scan_args(argc,argvp,fmt,__VA_ARGS__)) ALWAYS_INLINE(static int rb_scan_args0(int argc, const VALUE *argv, const char *fmt, int varc, VALUE *vars[])); inline int |