summaryrefslogtreecommitdiffstats
path: root/include
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
commitc118aee7ee5718110c83caa8d5ce3f91f6bc9ed4 (patch)
treea5f5ce2673f383b9c5ae565630c385a58383a627 /include
parent34f79a9691205244675ec471427e60f51201b26d (diff)
downloadruby-c118aee7ee5718110c83caa8d5ce3f91f6bc9ed4.tar.gz
ruby-c118aee7ee5718110c83caa8d5ce3f91f6bc9ed4.tar.xz
ruby-c118aee7ee5718110c83caa8d5ce3f91f6bc9ed4.zip
* include/ruby/ruby.h (RB_GC_GUARD_PTR): workaround for gcc
optimization. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-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 6e86cbeec..19f146e4a 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)