[前][次][番号順一覧][スレッド一覧]

ruby-changes:43037

From: naruse <ko1@a...>
Date: Sun, 22 May 2016 12:31:28 +0900 (JST)
Subject: [ruby-changes:43037] naruse:r55111 (trunk): * include/ruby/ruby.h (rb_scan_args): use original rb_scan_args

naruse	2016-05-22 12:31:22 +0900 (Sun, 22 May 2016)

  New Revision: 55111

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55111

  Log:
    * include/ruby/ruby.h (rb_scan_args): use original rb_scan_args
      when fmt is dynamic.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/ruby.h
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 55110)
+++ include/ruby/ruby.h	(revision 55111)
@@ -2150,9 +2150,11 @@ unsigned long ruby_strtoul(const char *s https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2150
 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
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55110)
+++ ChangeLog	(revision 55111)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun May 22 12:14:06 2016  NARUSE, Yui  <naruse@r...>
+
+	* 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@r...>
 
 	* class.c (rb_scan_args): moved to bottom of the file to make the

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]