summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-04 07:32:05 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-04 07:32:05 +0000
commit7eb6942dbb0b2567739b6dba7c94741d14501c52 (patch)
tree84f506ca6514a45c0994925c716eea12e85fa4b8
parente2cf71a0858715eb884996b4fc2d6fd39b0c0f8c (diff)
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
-rw-r--r--include/ruby/ruby.h16
1 files changed, 8 insertions, 8 deletions
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)