ruby-changes:40802
From: nobu <ko1@a...>
Date: Fri, 4 Dec 2015 16:32:11 +0900 (JST)
Subject: [ruby-changes:40802] nobu:r52881 (trunk): ruby.h: make flag setting macros void
nobu 2015-12-04 16:32:05 +0900 (Fri, 04 Dec 2015) New Revision: 52881 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52881 Log: ruby.h: make flag setting macros void * include/ruby/ruby.h (RB_FL_{SET,UNSET,REVERSE,INFECT,FREEZE}): turn into void expressions not to use unexpected results. these macros were statements till 2.2. Modified files: trunk/include/ruby/ruby.h Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 52880) +++ include/ruby/ruby.h (revision 52881) @@ -1293,12 +1293,12 @@ struct RStruct { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1293 #define RB_FL_ANY(x,f) RB_FL_TEST((x),(f)) #define RB_FL_ALL_RAW(x,f) (RB_FL_TEST_RAW((x),(f)) == (f)) #define RB_FL_ALL(x,f) (RB_FL_TEST((x),(f)) == (f)) -#define RB_FL_SET_RAW(x,f) (RBASIC(x)->flags |= (f)) -#define RB_FL_SET(x,f) (RB_FL_ABLE(x) ? RB_FL_SET_RAW(x, f) : 0) -#define RB_FL_UNSET_RAW(x,f) (RBASIC(x)->flags &= ~(f)) -#define RB_FL_UNSET(x,f) (RB_FL_ABLE(x) ? RB_FL_UNSET_RAW(x, f) : 0) -#define RB_FL_REVERSE_RAW(x,f) (RBASIC(x)->flags ^= (f)) -#define RB_FL_REVERSE(x,f) (RB_FL_ABLE(x) ? RB_FL_REVERSE_RAW(x, f) : 0) +#define RB_FL_SET_RAW(x,f) (void)(RBASIC(x)->flags |= (f)) +#define RB_FL_SET(x,f) (RB_FL_ABLE(x) ? RB_FL_SET_RAW(x, f) : (void)0) +#define RB_FL_UNSET_RAW(x,f) (void)(RBASIC(x)->flags &= ~(f)) +#define RB_FL_UNSET(x,f) (RB_FL_ABLE(x) ? RB_FL_UNSET_RAW(x, f) : (void)0) +#define RB_FL_REVERSE_RAW(x,f) (void)(RBASIC(x)->flags ^= (f)) +#define RB_FL_REVERSE(x,f) (RB_FL_ABLE(x) ? RB_FL_REVERSE_RAW(x, f) : (void)0) #define RB_OBJ_TAINTABLE(x) (RB_FL_ABLE(x) && RB_BUILTIN_TYPE(x) != RUBY_T_BIGNUM && RB_BUILTIN_TYPE(x) != RUBY_T_FLOAT) #define RB_OBJ_TAINTED_RAW(x) RB_FL_TEST_RAW(x, RUBY_FL_TAINT) @@ -1310,11 +1310,11 @@ struct RStruct { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1310 #define RB_OBJ_INFECT_RAW(x,s) RB_FL_SET_RAW(x, RB_OBJ_TAINTED_RAW(s)) #define RB_OBJ_INFECT(x,s) ( \ (RB_OBJ_TAINTABLE(x) && RB_FL_ABLE(s)) ? \ - RB_OBJ_INFECT_RAW(x, s) : 0) + RB_OBJ_INFECT_RAW(x, s) : (void)0) #define RB_OBJ_FROZEN_RAW(x) (RBASIC(x)->flags&RUBY_FL_FREEZE) #define RB_OBJ_FROZEN(x) (!RB_FL_ABLE(x) || RB_OBJ_FROZEN_RAW(x)) -#define RB_OBJ_FREEZE_RAW(x) (RBASIC(x)->flags |= RUBY_FL_FREEZE) +#define RB_OBJ_FREEZE_RAW(x) (void)(RBASIC(x)->flags |= RUBY_FL_FREEZE) #define RB_OBJ_FREEZE(x) rb_obj_freeze_inline((VALUE)x) #define FL_ABLE(x) RB_FL_ABLE(x) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/