summaryrefslogtreecommitdiff
path: root/include/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-11 00:04:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-11 00:04:10 +0000
commit2503de61fc96c932c4172d7c4b48d2dded5679e6 (patch)
treea5f5ce2673f383b9c5ae565630c385a58383a627 /include/ruby
parenteac0bd97145056be0db3284d935d04b83eead301 (diff)
downloadruby-2503de61fc96c932c4172d7c4b48d2dded5679e6.tar.gz
* include/ruby/ruby.h (RB_GC_GUARD_PTR): workaround for gcc
optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
-rw-r--r--include/ruby/ruby.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 6e86cbeec6..19f146e4ad 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -387,7 +387,13 @@ enum ruby_value_type {
static inline int rb_type(VALUE obj);
#define TYPE(x) rb_type((VALUE)(x))
-#define RB_GC_GUARD(v) (*(volatile VALUE *)&(v))
+#ifdef __GNUC__
+#define RB_GC_GUARD_PTR(ptr) \
+ __extension__ ({volatile VALUE *rb_gc_guarded_ptr = (ptr); rb_gc_guarded_ptr;})
+#else
+#define RB_GC_GUARD_PTR(ptr) (volatile VALUE *)(ptr)
+#endif
+#define RB_GC_GUARD(v) (*RB_GC_GUARD_PTR(&(v)))
void rb_check_type(VALUE,int);
#define Check_Type(v,t) rb_check_type((VALUE)(v),t)