* gc.c: parenthesize macro arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-12-14 11:32:59 +00:00
parent 949e6d454e
commit 8c757a3268
2 changed files with 21 additions and 17 deletions

View File

@ -1,3 +1,7 @@
Tue Dec 14 20:31:33 2010 Tanaka Akira <akr@fsij.org>
* gc.c: parenthesize macro arguments.
Tue Dec 14 18:31:48 2010 NAKAMURA Usaku <usa@ruby-lang.org> Tue Dec 14 18:31:48 2010 NAKAMURA Usaku <usa@ruby-lang.org>
* lib/test/unit.rb: help messages. * lib/test/unit.rb: help messages.

34
gc.c
View File

@ -39,10 +39,10 @@
#ifdef HAVE_VALGRIND_MEMCHECK_H #ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h> # include <valgrind/memcheck.h>
# ifndef VALGRIND_MAKE_MEM_DEFINED # ifndef VALGRIND_MAKE_MEM_DEFINED
# define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE(p, n) # define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
# endif # endif
# ifndef VALGRIND_MAKE_MEM_UNDEFINED # ifndef VALGRIND_MAKE_MEM_UNDEFINED
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE(p, n) # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
# endif # endif
#else #else
# define VALGRIND_MAKE_MEM_DEFINED(p, n) /* empty */ # define VALGRIND_MAKE_MEM_DEFINED(p, n) /* empty */
@ -215,13 +215,13 @@ getrusage_time(void)
#define GC_PROF_SET_HEAP_INFO(record) do {\ #define GC_PROF_SET_HEAP_INFO(record) do {\
live = objspace->heap.live_num;\ live = objspace->heap.live_num;\
total = heaps_used * HEAP_OBJ_LIMIT;\ total = heaps_used * HEAP_OBJ_LIMIT;\
record.heap_use_slots = heaps_used;\ (record).heap_use_slots = heaps_used;\
record.heap_live_objects = live;\ (record).heap_live_objects = live;\
record.heap_free_objects = total - live;\ (record).heap_free_objects = total - live;\
record.heap_total_objects = total;\ (record).heap_total_objects = total;\
record.have_finalize = deferred_final_list ? Qtrue : Qfalse;\ (record).have_finalize = deferred_final_list ? Qtrue : Qfalse;\
record.heap_use_size = live * sizeof(RVALUE);\ (record).heap_use_size = live * sizeof(RVALUE);\
record.heap_total_size = total * sizeof(RVALUE);\ (record).heap_total_size = total * sizeof(RVALUE);\
} while(0) } while(0)
#define GC_PROF_INC_LIVE_NUM objspace->heap.live_num++ #define GC_PROF_INC_LIVE_NUM objspace->heap.live_num++
#define GC_PROF_DEC_LIVE_NUM objspace->heap.live_num-- #define GC_PROF_DEC_LIVE_NUM objspace->heap.live_num--
@ -236,9 +236,9 @@ getrusage_time(void)
#define GC_PROF_SET_HEAP_INFO(record) do {\ #define GC_PROF_SET_HEAP_INFO(record) do {\
live = objspace->heap.live_num;\ live = objspace->heap.live_num;\
total = heaps_used * HEAP_OBJ_LIMIT;\ total = heaps_used * HEAP_OBJ_LIMIT;\
record.heap_total_objects = total;\ (record).heap_total_objects = total;\
record.heap_use_size = live * sizeof(RVALUE);\ (record).heap_use_size = live * sizeof(RVALUE);\
record.heap_total_size = total * sizeof(RVALUE);\ (record).heap_total_size = total * sizeof(RVALUE);\
} while(0) } while(0)
#define GC_PROF_INC_LIVE_NUM #define GC_PROF_INC_LIVE_NUM
#define GC_PROF_DEC_LIVE_NUM #define GC_PROF_DEC_LIVE_NUM
@ -1330,7 +1330,7 @@ rb_gc_mark_locations(VALUE *start, VALUE *end)
gc_mark_locations(&rb_objspace, start, end); gc_mark_locations(&rb_objspace, start, end);
} }
#define rb_gc_mark_locations(start, end) gc_mark_locations(objspace, start, end) #define rb_gc_mark_locations(start, end) gc_mark_locations(objspace, (start), (end))
struct mark_tbl_arg { struct mark_tbl_arg {
rb_objspace_t *objspace; rb_objspace_t *objspace;
@ -2273,13 +2273,13 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
void rb_vm_mark(void *ptr); void rb_vm_mark(void *ptr);
#if STACK_GROW_DIRECTION < 0 #if STACK_GROW_DIRECTION < 0
#define GET_STACK_BOUNDS(start, end, appendix) (start = STACK_END, end = STACK_START) #define GET_STACK_BOUNDS(start, end, appendix) ((start) = STACK_END, (end) = STACK_START)
#elif STACK_GROW_DIRECTION > 0 #elif STACK_GROW_DIRECTION > 0
#define GET_STACK_BOUNDS(start, end, appendix) (start = STACK_START, end = STACK_END+appendix) #define GET_STACK_BOUNDS(start, end, appendix) ((start) = STACK_START, (end) = STACK_END+(appendix))
#else #else
#define GET_STACK_BOUNDS(start, end, appendix) \ #define GET_STACK_BOUNDS(start, end, appendix) \
((STACK_END < STACK_START) ? \ ((STACK_END < STACK_START) ? \
(start = STACK_END, end = STACK_START) : (start = STACK_START, end = STACK_END+appendix)) ((start) = STACK_END, (end) = STACK_START) : ((start) = STACK_START, (end) = STACK_END+(appendix)))
#endif #endif
#define numberof(array) (int)(sizeof(array) / sizeof((array)[0])) #define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
@ -3173,7 +3173,7 @@ count_objects(int argc, VALUE *argv, VALUE os)
for (i = 0; i <= T_MASK; i++) { for (i = 0; i <= T_MASK; i++) {
VALUE type; VALUE type;
switch (i) { switch (i) {
#define COUNT_TYPE(t) case t: type = ID2SYM(rb_intern(#t)); break; #define COUNT_TYPE(t) case (t): type = ID2SYM(rb_intern(#t)); break;
COUNT_TYPE(T_NONE); COUNT_TYPE(T_NONE);
COUNT_TYPE(T_OBJECT); COUNT_TYPE(T_OBJECT);
COUNT_TYPE(T_CLASS); COUNT_TYPE(T_CLASS);