summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--gc.c8
-rw-r--r--include/ruby/ruby.h8
3 files changed, 20 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index bda4b0b212e..2b548567f49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Feb 21 08:27:19 2014 Eric Wong <e@80x24.org>
+
+ * include/ruby/ruby.h (RB_GC_GUARD):
+ use rb_gc_guarded_ptr_val on non-GCC/MSC
+ * gc.c (rb_gc_guarded_ptr_val): rename and adjust argument.
+ RB_GC_GUARD should be robust enough for any compiler.
+ [ruby-core:60816] [Bug #7805]
+
Thu Feb 20 22:21:26 2014 Tanaka Akira <akr@fsij.org>
* ext/socket/raddrinfo.c (numeric_getaddrinfo): Use xcalloc.
diff --git a/gc.c b/gc.c
index fc85cd4cee0..7f9e54f08a9 100644
--- a/gc.c
+++ b/gc.c
@@ -88,10 +88,14 @@
#define rb_setjmp(env) RUBY_SETJMP(env)
#define rb_jmp_buf rb_jmpbuf_t
-#if defined(HAVE_RB_GC_GUARDED_PTR) && HAVE_RB_GC_GUARDED_PTR
+#if defined(HAVE_RB_GC_GUARDED_PTR_VAL) && HAVE_RB_GC_GUARDED_PTR_VAL
+/* trick the compiler into thinking a external signal handler uses this */
+volatile VALUE rb_gc_guarded_val;
volatile VALUE *
-rb_gc_guarded_ptr(volatile VALUE *ptr)
+rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val)
{
+ rb_gc_guarded_val = val;
+
return ptr;
}
#endif
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 55ea252d98c..abd4b4bad3c 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -515,12 +515,16 @@ static inline int rb_type(VALUE obj);
static inline volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr) {return ptr;}
#pragma optimize("", on)
#else
-volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr);
-#define HAVE_RB_GC_GUARDED_PTR 1
+volatile VALUE *rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val);
+#define HAVE_RB_GC_GUARDED_PTR_VAL 1
+#define RB_GC_GUARD(v) (*rb_gc_guarded_ptr_val(&(v),(v)))
#endif
#define RB_GC_GUARD_PTR(ptr) rb_gc_guarded_ptr(ptr)
#endif
+
+#ifndef RB_GC_GUARD
#define RB_GC_GUARD(v) (*RB_GC_GUARD_PTR(&(v)))
+#endif
#ifdef __GNUC__
#define RB_UNUSED_VAR(x) x __attribute__ ((unused))