summaryrefslogtreecommitdiff
path: root/gc.h
diff options
context:
space:
mode:
Diffstat (limited to 'gc.h')
-rw-r--r--gc.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/gc.h b/gc.h
index 4d3132a..e782ad4 100644
--- a/gc.h
+++ b/gc.h
@@ -3,9 +3,9 @@
#define RUBY_GC_H 1
#if defined(__x86_64__) && defined(__GNUC__)
-#define SET_MACHINE_STACK_END(p) __asm__("movq\t%%rsp, %0" : "=r" (*p))
+#define SET_MACHINE_STACK_END(p) __asm__("movq\t%%rsp, %0" : "=r" (*(p)))
#elif defined(__i386) && defined(__GNUC__)
-#define SET_MACHINE_STACK_END(p) __asm__("movl\t%%esp, %0" : "=r" (*p))
+#define SET_MACHINE_STACK_END(p) __asm__("movl\t%%esp, %0" : "=r" (*(p)))
#else
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
#define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
@@ -43,10 +43,10 @@ rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
fflush(stdout);
}
-#define RUBY_MARK_ENTER(msg) rb_gc_debug_body("mark", msg, 1, ptr)
-#define RUBY_MARK_LEAVE(msg) rb_gc_debug_body("mark", msg, 0, ptr)
-#define RUBY_FREE_ENTER(msg) rb_gc_debug_body("free", msg, 1, ptr)
-#define RUBY_FREE_LEAVE(msg) rb_gc_debug_body("free", msg, 0, ptr)
+#define RUBY_MARK_ENTER(msg) rb_gc_debug_body("mark", (msg), 1, ptr)
+#define RUBY_MARK_LEAVE(msg) rb_gc_debug_body("mark", (msg), 0, ptr)
+#define RUBY_FREE_ENTER(msg) rb_gc_debug_body("free", (msg), 1, ptr)
+#define RUBY_FREE_LEAVE(msg) rb_gc_debug_body("free", (msg), 0, ptr)
#define RUBY_GC_INFO rb_gc_debug_indent(); printf
#else
@@ -61,9 +61,9 @@ rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
#define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);}
#if STACK_GROW_DIRECTION > 0
-# define STACK_UPPER(x, a, b) a
+# define STACK_UPPER(x, a, b) (a)
#elif STACK_GROW_DIRECTION < 0
-# define STACK_UPPER(x, a, b) b
+# define STACK_UPPER(x, a, b) (b)
#else
RUBY_EXTERN int ruby_stack_grow_direction;
int ruby_get_stack_grow_direction(volatile VALUE *addr);
@@ -71,15 +71,15 @@ int ruby_get_stack_grow_direction(volatile VALUE *addr);
(ruby_stack_grow_direction ? \
ruby_stack_grow_direction : \
ruby_get_stack_grow_direction(x)) > 0)
-# define STACK_UPPER(x, a, b) (stack_growup_p(x) ? a : b)
+# define STACK_UPPER(x, a, b) (stack_growup_p(x) ? (a) : (b))
#endif
#if STACK_GROW_DIRECTION
#define STACK_GROW_DIR_DETECTION
-#define STACK_DIR_UPPER(a,b) STACK_UPPER(0, a, b)
+#define STACK_DIR_UPPER(a,b) STACK_UPPER(0, (a), (b))
#else
#define STACK_GROW_DIR_DETECTION VALUE stack_grow_dir_detection
-#define STACK_DIR_UPPER(a,b) STACK_UPPER(&stack_grow_dir_detection, a, b)
+#define STACK_DIR_UPPER(a,b) STACK_UPPER(&stack_grow_dir_detection, (a), (b))
#endif
#if defined __GNUC__ && __GNUC__ >= 4