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

ruby-changes:26300

From: shugo <ko1@a...>
Date: Thu, 13 Dec 2012 12:09:35 +0900 (JST)
Subject: [ruby-changes:26300] shugo:r38351 (trunk): * include/ruby/ruby.h (RB_UNUSED_VAR): new macro to suppress

shugo	2012-12-13 12:09:22 +0900 (Thu, 13 Dec 2012)

  New Revision: 38351

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38351

  Log:
    * include/ruby/ruby.h (RB_UNUSED_VAR): new macro to suppress
      warnings for unused variables.
    
    * ext/bigdecimal/bigdecimal.c (ENTER): use RB_UNUSED_VAR() to
      suppress annoying warnings by -Wunused-but-set-variable in gcc 4.6.

  Modified files:
    trunk/ChangeLog
    trunk/ext/bigdecimal/bigdecimal.c
    trunk/include/ruby/ruby.h

Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 38350)
+++ include/ruby/ruby.h	(revision 38351)
@@ -529,6 +529,12 @@ static inline volatile VALUE *rb_gc_guar https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L529
 #endif
 #define RB_GC_GUARD(v) (*RB_GC_GUARD_PTR(&(v)))
 
+#ifdef __GNUC__
+#define RB_UNUSED_VAR(x) x __attribute__ ((unused)) 
+#else
+#define RB_UNUSED_VAR(x) x
+#endif
+
 void rb_check_type(VALUE,int);
 #define Check_Type(v,t) rb_check_type((VALUE)(v),(t))
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38350)
+++ ChangeLog	(revision 38351)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Dec 13 12:07:25 2012  Shugo Maeda  <shugo@r...>
+
+	* include/ruby/ruby.h (RB_UNUSED_VAR): new macro to suppress
+	  warnings for unused variables.
+	  
+	* ext/bigdecimal/bigdecimal.c (ENTER): use RB_UNUSED_VAR() to
+	  suppress annoying warnings by -Wunused-but-set-variable in gcc 4.6.
+
 Thu Dec 13 11:22:33 2012  Koichi Sasada  <ko1@a...>
 
 	* method.h: remove "VM_METHOD_TYPE__MAX" from rb_method_type_t.
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 38350)
+++ ext/bigdecimal/bigdecimal.c	(revision 38351)
@@ -60,7 +60,7 @@ static ID id_to_r; https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L60
 static ID id_eq;
 
 /* MACRO's to guard objects from GC by keeping them in stack */
-#define ENTER(n) volatile VALUE vStack[n];int iStack=0
+#define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
 #define PUSH(x)  vStack[iStack++] = (VALUE)(x);
 #define SAVE(p)  PUSH(p->obj);
 #define GUARD_OBJ(p,y) {p=y;SAVE(p);}

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

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