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

ruby-changes:40384

From: ngoto <ko1@a...>
Date: Fri, 6 Nov 2015 18:19:27 +0900 (JST)
Subject: [ruby-changes:40384] ngoto:r52465 (trunk): * include/ruby/ruby.h (rb_array_const_ptr, rb_struct_const_ptr):

ngoto	2015-11-06 18:19:14 +0900 (Fri, 06 Nov 2015)

  New Revision: 52465

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

  Log:
    * include/ruby/ruby.h (rb_array_const_ptr, rb_struct_const_ptr):
      Suppress pointer type mismatch warnings occurred with old version
      of Fujitsu C Compiler (fcc) on Solaris 10. The warnings cause
      failure of TestMkmf::TestConvertible. [Bug #11644] [ruby-dev:49326]
    * include/ruby/ruby.h (FIX_CONST_VALUE_PTR): macro for the above,
      only effective with fcc.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/ruby.h
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 52464)
+++ include/ruby/ruby.h	(revision 52465)
@@ -2004,11 +2004,19 @@ rb_array_len(VALUE a) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2004
 	RARRAY_EMBED_LEN(a) : RARRAY(a)->as.heap.len;
 }
 
+#if defined(__fcc__) || defined(__fcc_version) || \
+    defined(__FCC__) || defined(__FCC_VERSION)
+/* workaround for old version of Fujitsu C Compiler (fcc) */
+# define FIX_CONST_VALUE_PTR(x) ((const VALUE *)(x))
+#else
+# define FIX_CONST_VALUE_PTR(x) (x)
+#endif
+
 static inline const VALUE *
 rb_array_const_ptr(VALUE a)
 {
-    return (RBASIC(a)->flags & RARRAY_EMBED_FLAG) ?
-	RARRAY(a)->as.ary : RARRAY(a)->as.heap.ptr;
+    return FIX_CONST_VALUE_PTR((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ?
+	RARRAY(a)->as.ary : RARRAY(a)->as.heap.ptr);
 }
 
 static inline long
@@ -2021,8 +2029,8 @@ rb_struct_len(VALUE st) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2029
 static inline const VALUE *
 rb_struct_const_ptr(VALUE st)
 {
-    return (RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
-	RSTRUCT(st)->as.ary : RSTRUCT(st)->as.heap.ptr;
+    return FIX_CONST_VALUE_PTR((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
+	RSTRUCT(st)->as.ary : RSTRUCT(st)->as.heap.ptr);
 }
 
 #if defined(EXTLIB) && defined(USE_DLN_A_OUT)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52464)
+++ ChangeLog	(revision 52465)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Nov  6 18:07:47 2015  Naohisa Goto  <ngotogenome@g...>
+
+	* include/ruby/ruby.h (rb_array_const_ptr, rb_struct_const_ptr):
+	  Suppress pointer type mismatch warnings occurred with old version
+	  of Fujitsu C Compiler (fcc) on Solaris 10. The warnings cause
+	  failure of TestMkmf::TestConvertible. [Bug #11644] [ruby-dev:49326]
+	* include/ruby/ruby.h (FIX_CONST_VALUE_PTR): macro for the above,
+	  only effective with fcc.
+
 Fri Nov  6 12:39:21 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* defs/id.def (token_ops), parse.y (parser_yylex): change DOTQ

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

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