From a6b50f379d4b71acac73ac6b22cbe2d2c5b50b3f Mon Sep 17 00:00:00 2001 From: shyouhei Date: Tue, 2 Jan 2018 06:41:53 +0000 Subject: [PATCH] statement experssion is a GCCism should mark as such. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/ruby.h | 12 ++++++------ internal.h | 6 +++--- ruby_atomic.h | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 07e8f71311..3f9250dbe7 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -1151,10 +1151,10 @@ void *rb_check_typeddata(VALUE, const rb_data_type_t *); (void)((sval) = (type *)DATA_PTR(result)); #ifdef __GNUC__ -#define Data_Make_Struct(klass,type,mark,free,sval) ({\ +#define Data_Make_Struct(klass,type,mark,free,sval) RB_GNUC_EXTENSION_BLOCK(\ 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)) \ @@ -1169,10 +1169,10 @@ void *rb_check_typeddata(VALUE, const rb_data_type_t *); (void)((sval) = (type *)DATA_PTR(result)); #ifdef __GNUC__ -#define TypedData_Make_Struct(klass, type, data_type, sval) ({\ +#define TypedData_Make_Struct(klass, type, data_type, sval) RB_GNUC_EXTENSION_BLOCK(\ 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 8d92d9510a..25b382e554 100644 --- a/internal.h +++ b/internal.h @@ -109,7 +109,7 @@ extern "C" { __builtin_mul_overflow_p((a), (b), (__typeof__(a * b))0) #elif defined HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW #define MUL_OVERFLOW_P(a, b) \ - ({__typeof__(a) c; __builtin_mul_overflow((a), (b), &c);}) + RB_GNUC_EXTENSION_BLOCK(__typeof__(a) c; __builtin_mul_overflow((a), (b), &c)) #endif #define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \ @@ -122,10 +122,10 @@ extern "C" { #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) ({ \ +#define MUL_OVERFLOW_FIXNUM_P(a, b) RB_GNUC_EXTENSION_BLOCK( \ 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 4bc9f37e0d..f74cf997a1 100644 --- a/ruby_atomic.h +++ b/ruby_atomic.h @@ -9,10 +9,10 @@ typedef unsigned int rb_atomic_t; # 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) \ -({ __typeof__(var) oldvaldup = (oldval); /* oldval should not be modified */ \ +# define ATOMIC_CAS(var, oldval, newval) RB_GNUC_EXTENSION_BLOCK( \ + __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)