Skip to content

Commit

Permalink
ruby.h: remove RB_GC_GUARD_PTR
Browse files Browse the repository at this point in the history
* include/ruby/ruby.h (RB_GC_GUARD_PTR): remove intermediate
  macro, and expand for each RB_GC_GUARD.  [Fix rubyGH-1293]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Mar 17, 2016
1 parent 7aa690b commit e6877a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Thu Mar 17 22:21:34 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>

* include/ruby/ruby.h (RB_GC_GUARD_PTR): remove intermediate
macro, and expand for each RB_GC_GUARD. [Fix GH-1293]

Thu Mar 17 22:08:33 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>

* compile.c (iseq_specialized_instruction): move specialization
Expand Down
16 changes: 4 additions & 12 deletions include/ruby/ruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,27 +551,19 @@ static inline int rb_type(VALUE obj);
((type) == RUBY_T_FLOAT) ? RB_FLOAT_TYPE_P(obj) : \
(!RB_SPECIAL_CONST_P(obj) && RB_BUILTIN_TYPE(obj) == (type)))

/* RB_GC_GUARD_PTR() is an intermediate macro, and has no effect by
* itself. don't use it directly */
#ifdef __GNUC__
#define RB_GC_GUARD_PTR(ptr) \
__extension__ ({volatile VALUE *rb_gc_guarded_ptr = (ptr); rb_gc_guarded_ptr;})
#else
#ifdef _MSC_VER
#define RB_GC_GUARD(v) \
(*__extension__ ({volatile VALUE *rb_gc_guarded_ptr = &(v); rb_gc_guarded_ptr;}))
#elif defined _MSC_VER
#pragma optimize("", off)
static inline volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr) {return ptr;}
#pragma optimize("", on)
#define RB_GC_GUARD(v) (*rb_gc_guarded_ptr(&(v)))
#else
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))
Expand Down

0 comments on commit e6877a0

Please sign in to comment.