ruby-changes:49440
From: shyouhei <ko1@a...>
Date: Tue, 2 Jan 2018 18:09:33 +0900 (JST)
Subject: [ruby-changes:49440] shyouhei:r61557 (trunk): statement experssion is a GCCism
shyouhei 2018-01-02 15:41:53 +0900 (Tue, 02 Jan 2018) New Revision: 61557 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61557 Log: statement experssion is a GCCism should mark as such. Modified files: trunk/include/ruby/ruby.h trunk/internal.h trunk/ruby_atomic.h Index: internal.h =================================================================== --- internal.h (revision 61556) +++ internal.h (revision 61557) @@ -109,7 +109,7 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/internal.h#L109 __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" { https://github.com/ruby/ruby/blob/trunk/internal.h#L122 #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 Index: ruby_atomic.h =================================================================== --- ruby_atomic.h (revision 61556) +++ ruby_atomic.h (revision 61557) @@ -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) \ -({ __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) Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 61556) +++ include/ruby/ruby.h (revision 61557) @@ -1151,10 +1151,10 @@ void *rb_check_typeddata(VALUE, const rb https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1151 (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 https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1169 (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)) \ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/