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

ruby-changes:56835

From: Nobuyoshi <ko1@a...>
Date: Tue, 6 Aug 2019 11:54:35 +0900 (JST)
Subject: [ruby-changes:56835] Nobuyoshi Nakada: 5cff9968ae (master): Distinguish bad scan format from no argument variables

https://git.ruby-lang.org/ruby.git/commit/?id=5cff9968ae

From 5cff9968aefe2f407731df705830888d9d61409d Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 6 Aug 2019 11:52:17 +0900
Subject: Distinguish bad scan format from no argument variables


diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 86d4c39..89e49e1 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -2322,7 +2322,7 @@ int ruby_vsnprintf(char *str, size_t n, char const *fmt, va_list ap); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2322
         rb_scan_args0(argc,argvp,fmt,\
 		      (sizeof((VALUE*[]){__VA_ARGS__})/sizeof(VALUE*)), \
 		      ((VALUE*[]){__VA_ARGS__})), \
-        rb_scan_args(argc,argvp,fmt,__VA_ARGS__))
+        rb_scan_args(argc,argvp,fmt,##__VA_ARGS__))
 # if HAVE_ATTRIBUTE_ERRORFUNC
 ERRORFUNC(("bad scan arg format"), int rb_scan_args_bad_format(const char*));
 ERRORFUNC(("variable argument length doesn't match"), int rb_scan_args_length_mismatch(const char*,int));
@@ -2502,7 +2502,7 @@ rb_scan_args_set(int argc, const VALUE *argv, https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2502
 		 int f_var, int f_hash, int f_block,
 		 VALUE *vars[], RB_UNUSED_VAR(char *fmt), RB_UNUSED_VAR(int varc))
 # if defined(__has_attribute) && __has_attribute(diagnose_if)
-    __attribute__((diagnose_if(rb_scan_args_count(fmt)==0,"bad scan arg format","error")))
+    __attribute__((diagnose_if(rb_scan_args_count(fmt)<0,"bad scan arg format","error")))
     __attribute__((diagnose_if(rb_scan_args_count(fmt)!=varc,"variable argument length doesn't match","error")))
 # endif
 {
-- 
cgit v0.10.2


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

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