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

ruby-changes:43098

From: nobu <ko1@a...>
Date: Thu, 26 May 2016 14:11:13 +0900 (JST)
Subject: [ruby-changes:43098] nobu:r55172 (trunk): revert r55171

nobu	2016-05-26 14:11:07 +0900 (Thu, 26 May 2016)

  New Revision: 55172

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

  Log:
    revert r55171
    
    Revert r55171, "ruby.h: fix clang warnings", it did fix
    array-bounds warnings, but caused string-plus-int warnings
    instead.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/ruby.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55171)
+++ ChangeLog	(revision 55172)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Thu May 26 10:30:30 2016  Nobuyoshi Nakada  <nobu@r...>
-
-	* include/ruby/ruby.h (rb_scan_args0): use pointer dereference
-	  forms instead of array forms, to get rid of warnings by clang.
-
 Thu May 26 09:45:41 2016  Martin Duerst  <duerst@i...>
 
 	* test/ruby/enc/test_case_comprehensive.rb: Add set of comprehensive
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 55171)
+++ include/ruby/ruby.h	(revision 55172)
@@ -2166,64 +2166,64 @@ ERRORFUNC(("variable argument length doe https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2166
 # define rb_scan_args_isdigit(c) ((unsigned char)((c)-'0')<10)
 
 # define rb_scan_args_count_block(fmt, ofs) \
-    (*(""fmt+ofs)=='&')
+    ((fmt)[ofs]=='&')
 
 # define rb_scan_args_count_hash(fmt, ofs) \
-    (*(""fmt+ofs)!=':' ? \
+    ((fmt)[ofs]!=':' ? \
      rb_scan_args_count_block(fmt, ofs) : \
-     rb_scan_args_count_block(fmt, ofs+1)+1)
+     rb_scan_args_count_block(fmt, (ofs)+1)+1)
 
 # define rb_scan_args_count_trail(fmt, ofs) \
-    (!rb_scan_args_isdigit(*(""fmt+ofs)) ? \
+    (!rb_scan_args_isdigit((fmt)[ofs]) ? \
      rb_scan_args_count_hash(fmt, ofs) : \
-     (*(""fmt+ofs)-'0') + rb_scan_args_count_hash(fmt, ofs+1))
+     ((fmt)[ofs]-'0') + rb_scan_args_count_hash(fmt, (ofs)+1))
 
 # define rb_scan_args_count_var(fmt, ofs) \
-    (*(""fmt+ofs)!='*' ? \
+    ((fmt)[ofs]!='*' ? \
      rb_scan_args_count_trail(fmt, ofs) : \
-     rb_scan_args_count_trail(fmt, ofs+1)+1)
+     rb_scan_args_count_trail(fmt, (ofs)+1)+1)
 
 # define rb_scan_args_count(fmt) \
-    (!rb_scan_args_isdigit(*(""fmt+0)) ? rb_scan_args_count_var(fmt, 0) : \
-     !rb_scan_args_isdigit(*(""fmt+1)) ? rb_scan_args_count_var(fmt, 1)+*(""fmt+0)-'0' : \
-     rb_scan_args_count_var(fmt, 2)+*(""fmt+0)-'0'+*(""fmt+1)-'0')
-
-# define rb_scan_args_lead_p(fmt) rb_scan_args_isdigit(*(""fmt+0))
-# define rb_scan_args_n_lead(fmt) (rb_scan_args_lead_p(fmt) ? *(""fmt+0)-'0' : 0)
-# define rb_scan_args_opt_p(fmt) (rb_scan_args_lead_p(fmt) && rb_scan_args_isdigit(*(""fmt+1)))
-# define rb_scan_args_n_opt(fmt) (rb_scan_args_opt_p(fmt) ? *(""fmt+1)-'0' : 0)
+    (!rb_scan_args_isdigit((fmt)[0]) ? rb_scan_args_count_var(fmt, 0) : \
+     !rb_scan_args_isdigit((fmt)[1]) ? rb_scan_args_count_var(fmt, 1)+(fmt)[0]-'0' : \
+     rb_scan_args_count_var(fmt, 2)+(fmt)[0]-'0'+(fmt)[1]-'0')
+
+# define rb_scan_args_lead_p(fmt) rb_scan_args_isdigit((fmt)[0])
+# define rb_scan_args_n_lead(fmt) (rb_scan_args_lead_p(fmt) ? (fmt)[0]-'0' : 0)
+# define rb_scan_args_opt_p(fmt) (rb_scan_args_lead_p(fmt) && rb_scan_args_isdigit((fmt)[1]))
+# define rb_scan_args_n_opt(fmt) (rb_scan_args_opt_p(fmt) ? (fmt)[1]-'0' : 0)
 # define rb_scan_args_var_idx(fmt) \
-    (!rb_scan_args_lead_p(fmt) ? 0 : !rb_scan_args_isdigit(*(""fmt+1)) ? 1 : 2)
-# define rb_scan_args_f_var(fmt) (*(""fmt+rb_scan_args_var_idx(fmt))=='*')
+    (!rb_scan_args_lead_p(fmt) ? 0 : !rb_scan_args_isdigit((fmt)[1]) ? 1 : 2)
+# define rb_scan_args_f_var(fmt) ((fmt)[rb_scan_args_var_idx(fmt)]=='*')
 # define rb_scan_args_trail_idx(fmt) \
     (rb_scan_args_lead_p(fmt) ? \
-     (rb_scan_args_isdigit(*(""fmt+1)) || *(""fmt+1)=='*')+1 : \
-     (*(""fmt+0)=='*'))
+     (rb_scan_args_isdigit((fmt)[1]) || (fmt)[1]=='*')+1 : \
+     ((fmt)[0]=='*'))
 # define rb_scan_args_trail_p(fmt) \
     (rb_scan_args_lead_p(fmt) ? \
-     (rb_scan_args_isdigit(*(""fmt+1)) || *(""fmt+1)=='*') && \
-     rb_scan_args_isdigit(*(""fmt+2)) : \
-     *(""fmt+0)=='*' && rb_scan_args_isdigit(*(""fmt+1)))
+     (rb_scan_args_isdigit((fmt)[1]) || (fmt)[1]=='*') && \
+     rb_scan_args_isdigit((fmt)[2]) : \
+     (fmt)[0]=='*' && rb_scan_args_isdigit((fmt)[1]))
 # define rb_scan_args_n_trail(fmt) \
     (rb_scan_args_lead_p(fmt) ? \
-     ((rb_scan_args_isdigit(*(""fmt+1)) || *(""fmt+1)=='*') && \
-      rb_scan_args_isdigit(*(""fmt+2)) ? *(""fmt+2)-'0' : 0) : \
-     (*(""fmt+0)=='*' && rb_scan_args_isdigit(*(""fmt+1)) ? *(""fmt+1)-'0' : 0))
+     ((rb_scan_args_isdigit((fmt)[1]) || (fmt)[1]=='*') && \
+      rb_scan_args_isdigit((fmt)[2]) ? (fmt)[2]-'0' : 0) : \
+     ((fmt)[0]=='*' && rb_scan_args_isdigit((fmt)[1]) ? (fmt)[1]-'0' : 0))
 # define rb_scan_args_hash_idx(fmt) \
     (rb_scan_args_trail_idx(fmt)+rb_scan_args_trail_p(fmt))
-# define rb_scan_args_f_hash(fmt) (*(""fmt+rb_scan_args_hash_idx(fmt))==':')
+# define rb_scan_args_f_hash(fmt) ((fmt)[rb_scan_args_hash_idx(fmt)]==':')
 # define rb_scan_args_block_idx(fmt) \
     (rb_scan_args_hash_idx(fmt)+rb_scan_args_f_hash(fmt))
-# define rb_scan_args_f_block(fmt) (*(""fmt+rb_scan_args_block_idx(fmt))=='&')
+# define rb_scan_args_f_block(fmt) ((fmt)[rb_scan_args_block_idx(fmt)]=='&')
 # define rb_scan_args_end_idx(fmt) \
     (rb_scan_args_block_idx(fmt)+rb_scan_args_f_block(fmt))
 
 # define rb_scan_args_validate(fmt, varc) \
-    (!rb_scan_args_isdigit(*(""fmt+0)) ? \
+    (!rb_scan_args_isdigit((fmt)[0]) ? \
      rb_scan_args_validate_var(fmt, 0, varc) : \
-     !rb_scan_args_isdigit(*(""fmt+1)) ? \
-     rb_scan_args_validate_var(fmt, 1, (varc-*(""fmt+0)+'0')) : \
-     rb_scan_args_validate_var(fmt, 2, (varc-*(""fmt+0)+'0'-*(""fmt+1)+'0')))
+     !rb_scan_args_isdigit((fmt)[1]) ? \
+     rb_scan_args_validate_var(fmt, 1, (varc-(fmt)[0]+'0')) : \
+     rb_scan_args_validate_var(fmt, 2, (varc-(fmt)[0]+'0'-(fmt)[1]+'0')))
 # define rb_scan_args_validate_var(fmt, ofs, varc) \
     ((fmt)[ofs]=='*' ? \
      rb_scan_args_validate_trail(fmt, ofs+1, (varc-1)) : \

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

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