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

ruby-changes:63021

From: nagachika <ko1@a...>
Date: Sun, 20 Sep 2020 20:24:21 +0900 (JST)
Subject: [ruby-changes:63021] 1b39a995b5 (ruby_2_7): Revert "statement experssion is a GCCism" to pass ICC CI.

https://git.ruby-lang.org/ruby.git/commit/?id=1b39a995b5

From 1b39a995b559677bf4bf2d0ac3a1c924928a936f Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@r...>
Date: Sun, 20 Sep 2020 20:23:12 +0900
Subject: Revert "statement experssion is a GCCism" to pass ICC CI.

This reverts commit a6b50f379d4b71acac73ac6b22cbe2d2c5b50b3f.

diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 9b7c984..1ce73d5 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -1218,10 +1218,10 @@ void *rb_check_typeddata(VALUE, const rb_data_type_t *); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1218
     (void)((sval) = (type *)DATA_PTR(result));
 
 #ifdef __GNUC__
-#define Data_Make_Struct(klass,type,mark,free,sval) RB_GNUC_EXTENSION_BLOCK(\
+#define Data_Make_Struct(klass,type,mark,free,sval) ({\
     Data_Make_Struct0(data_struct_obj, klass, type, sizeof(type), mark, free, sval); \
-    data_struct_obj \
-)
+    data_struct_obj; \
+})
 #else
 #define Data_Make_Struct(klass,type,mark,free,sval) (\
     rb_data_object_make((klass),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free),(void **)&(sval),sizeof(type)) \
@@ -1236,10 +1236,10 @@ void *rb_check_typeddata(VALUE, const rb_data_type_t *); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1236
     (void)((sval) = (type *)DATA_PTR(result));
 
 #ifdef __GNUC__
-#define TypedData_Make_Struct(klass, type, data_type, sval) RB_GNUC_EXTENSION_BLOCK(\
+#define TypedData_Make_Struct(klass, type, data_type, sval) ({\
     TypedData_Make_Struct0(data_struct_obj, klass, type, sizeof(type), data_type, sval); \
-    data_struct_obj \
-)
+    data_struct_obj; \
+})
 #else
 #define TypedData_Make_Struct(klass, type, data_type, sval) (\
     rb_data_typed_object_make((klass),(data_type),(void **)&(sval),sizeof(type)) \
diff --git a/internal.h b/internal.h
index d5f1b93..b431c47 100644
--- a/internal.h
+++ b/internal.h
@@ -252,7 +252,7 @@ asan_unpoison_object(VALUE obj, bool newobj_p) https://github.com/ruby/ruby/blob/trunk/internal.h#L252
     __builtin_mul_overflow_p((a), (b), (__typeof__(a * b))0)
 #elif defined HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW
 #define MUL_OVERFLOW_P(a, b) \
-    RB_GNUC_EXTENSION_BLOCK(__typeof__(a) c; __builtin_mul_overflow((a), (b), &c))
+    ({__typeof__(a) c; __builtin_mul_overflow((a), (b), &c);})
 #endif
 
 #define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
@@ -265,10 +265,10 @@ asan_unpoison_object(VALUE obj, bool newobj_p) https://github.com/ruby/ruby/blob/trunk/internal.h#L265
 #ifdef HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW_P
 /* __builtin_mul_overflow_p can take bitfield */
 /* and GCC permits bitfields for integers other than int */
-#define MUL_OVERFLOW_FIXNUM_P(a, b) RB_GNUC_EXTENSION_BLOCK( \
+#define MUL_OVERFLOW_FIXNUM_P(a, b) ({ \
     struct { long fixnum : SIZEOF_LONG * CHAR_BIT - 1; } c; \
     __builtin_mul_overflow_p((a), (b), c.fixnum); \
-)
+})
 #else
 #define MUL_OVERFLOW_FIXNUM_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
 #endif
diff --git a/ruby_atomic.h b/ruby_atomic.h
index 1b395cd..2516dbf 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -9,10 +9,10 @@ typedef unsigned int rb_atomic_t; https://github.com/ruby/ruby/blob/trunk/ruby_atomic.h#L9
 # define ATOMIC_DEC(var) __atomic_fetch_sub(&(var), 1, __ATOMIC_SEQ_CST)
 # define ATOMIC_OR(var, val) __atomic_fetch_or(&(var), (val), __ATOMIC_SEQ_CST)
 # define ATOMIC_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
-# define ATOMIC_CAS(var, oldval, newval) RB_GNUC_EXTENSION_BLOCK( \
-   __typeof__(var) oldvaldup = (oldval); /* oldval should not be modified */ \
+# define ATOMIC_CAS(var, oldval, newval) \
+({ __typeof__(var) oldvaldup = (oldval); /* oldval should not be modified */ \
    __atomic_compare_exchange_n(&(var), &oldvaldup, (newval), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); \
-   oldvaldup )
+   oldvaldup; })
 
 # define ATOMIC_SIZE_ADD(var, val) __atomic_fetch_add(&(var), (val), __ATOMIC_SEQ_CST)
 # define ATOMIC_SIZE_SUB(var, val) __atomic_fetch_sub(&(var), (val), __ATOMIC_SEQ_CST)
-- 
cgit v0.10.2


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

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