From 3f856ab0ffaa24ca13feb901c3a961533de3d521 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 4 Dec 2015 07:32:05 +0000 Subject: 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/ruby.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index e7f2f0d990..09705243e8 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -1293,12 +1293,12 @@ struct RStruct { #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 { #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) -- cgit v1.2.3