1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

explicit cast to void* required for %p

These functions take variadic arguments so no automatic type
promotion is expected.  You have to do it by hand.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shyouhei 2018-01-02 06:41:40 +00:00
parent b4b0e8bd0b
commit b6a2d63eb3
9 changed files with 24 additions and 24 deletions

2
cont.c
View file

@ -222,7 +222,7 @@ rb_ec_verify(const rb_execution_context_t *ec)
static void
fiber_status_set(const rb_fiber_t *fib, enum fiber_status s)
{
if (0) fprintf(stderr, "fib: %p, status: %s -> %s\n", fib, fiber_status_name(fib->status), fiber_status_name(s));
if (0) fprintf(stderr, "fib: %p, status: %s -> %s\n", (void *)fib, fiber_status_name(fib->status), fiber_status_name(s));
VM_ASSERT(!FIBER_TERMINATED_P(fib));
VM_ASSERT(fib->status != s);
fiber_verify(fib);

18
gc.c
View file

@ -1437,7 +1437,7 @@ heap_page_add_freeobj(rb_objspace_t *objspace, struct heap_page *page, VALUE obj
page->freelist = p;
if (RGENGC_CHECK_MODE && !is_pointer_to_heap(objspace, p)) {
rb_bug("heap_page_add_freeobj: %p is not rvalue.", p);
rb_bug("heap_page_add_freeobj: %p is not rvalue.", (void *)p);
}
gc_report(3, objspace, "heap_page_add_freeobj: add %p to freelist\n", (void *)obj);
@ -1590,7 +1590,7 @@ heap_page_allocate(rb_objspace_t *objspace)
page_body->header.page = page;
for (p = start; p != end; p++) {
gc_report(3, objspace, "assign_heap_page: %p is added to freelist\n", p);
gc_report(3, objspace, "assign_heap_page: %p is added to freelist\n", (void *)p);
heap_page_add_freeobj(objspace, page, (VALUE)p);
}
page->free_slots = limit;
@ -1631,7 +1631,7 @@ heap_page_create(rb_objspace_t *objspace)
method = "allocate";
}
if (0) fprintf(stderr, "heap_page_create: %s - %p, heap_allocated_pages: %d, heap_allocated_pages: %d, tomb->total_pages: %d\n",
method, page, (int)heap_pages_sorted_length, (int)heap_allocated_pages, (int)heap_tomb->total_pages);
method, (void *)page, (int)heap_pages_sorted_length, (int)heap_allocated_pages, (int)heap_tomb->total_pages);
return page;
}
@ -2029,7 +2029,7 @@ VALUE
rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line)
{
VALUE memo = rb_imemo_new(type, v1, v2, v3, v0);
fprintf(stderr, "memo %p (type: %d) @ %s:%d\n", memo, imemo_type(memo), file, line);
fprintf(stderr, "memo %p (type: %d) @ %s:%d\n", (void *)memo, imemo_type(memo), file, line);
return memo;
}
#endif
@ -4703,7 +4703,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj)
if (BUILTIN_TYPE(obj) == T_NONE) rb_bug("rb_gc_mark(): %p is T_NONE", (void *)obj);
if (BUILTIN_TYPE(obj) == T_ZOMBIE) rb_bug("rb_gc_mark(): %p is T_ZOMBIE", (void *)obj);
rb_bug("rb_gc_mark(): unknown data type 0x%x(%p) %s",
BUILTIN_TYPE(obj), any,
BUILTIN_TYPE(obj), (void *)any,
is_pointer_to_heap(objspace, any) ? "corrupted object" : "non object");
}
}
@ -5248,22 +5248,22 @@ gc_verify_heap_page(rb_objspace_t *objspace, struct heap_page *page, VALUE obj)
}
}
rb_bug("page %p's has_remembered_objects should be false, but there are remembered old objects (%d). %s",
page, rememberd_old_objects, obj ? obj_info(obj) : "");
(void *)page, rememberd_old_objects, obj ? obj_info(obj) : "");
}
if (page->flags.has_uncollectible_shady_objects == FALSE && has_remembered_shady == TRUE) {
rb_bug("page %p's has_remembered_shady should be false, but there are remembered shady objects. %s",
page, obj ? obj_info(obj) : "");
(void *)page, obj ? obj_info(obj) : "");
}
if (0) {
/* free_slots may not equal to free_objects */
if (page->free_slots != free_objects) {
rb_bug("page %p's free_slots should be %d, but %d\n", page, (int)page->free_slots, free_objects);
rb_bug("page %p's free_slots should be %d, but %d\n", (void *)page, (int)page->free_slots, free_objects);
}
}
if (page->final_slots != zombie_objects) {
rb_bug("page %p's final_slots should be %d, but %d\n", page, (int)page->final_slots, zombie_objects);
rb_bug("page %p's final_slots should be %d, but %d\n", (void *)page, (int)page->final_slots, zombie_objects);
}
return rememberd_old_objects;

2
proc.c
View file

@ -1279,7 +1279,7 @@ rb_block_to_s(VALUE self, const struct rb_block *block, const char *additional_i
rb_str_catf(str, "%p(&%+"PRIsVALUE")", (void *)self, block->as.symbol);
break;
case block_type_ifunc:
rb_str_catf(str, "%p", block->as.captured.code.ifunc);
rb_str_catf(str, "%p", (void *)block->as.captured.code.ifunc);
break;
}

View file

@ -473,7 +473,7 @@ rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th)
while (mutexes) {
mutex = mutexes;
/* rb_warn("mutex #<%p> remains to be locked by terminated thread",
mutexes); */
(void *)mutexes); */
mutexes = mutex->next_mutex;
err = rb_mutex_unlock_th(mutex, th);
if (err) rb_bug("invalid keeping_mutexes: %s", err);
@ -4966,21 +4966,21 @@ debug_deadlock_check(rb_vm_t *vm, VALUE msg)
VALUE sep = rb_str_new_cstr("\n ");
rb_str_catf(msg, "\n%d threads, %d sleeps current:%p main thread:%p\n",
vm_living_thread_num(vm), vm->sleeper, GET_THREAD(), vm->main_thread);
vm_living_thread_num(vm), vm->sleeper, (void *)GET_THREAD(), (void *)vm->main_thread);
list_for_each(&vm->living_threads, th, vmlt_node) {
rb_str_catf(msg, "* %+"PRIsVALUE"\n rb_thread_t:%p "
"native:%"PRI_THREAD_ID" int:%u",
th->self, th, thread_id_str(th), th->ec->interrupt_flag);
th->self, (void *)th, thread_id_str(th), th->ec->interrupt_flag);
if (th->locking_mutex) {
rb_mutex_t *mutex;
GetMutexPtr(th->locking_mutex, mutex);
rb_str_catf(msg, " mutex:%p cond:%"PRIuSIZE,
mutex->th, rb_mutex_num_waiting(mutex));
(void *)mutex->th, rb_mutex_num_waiting(mutex));
}
{
rb_thread_list_t *list = th->join_list;
while (list) {
rb_str_catf(msg, "\n depended by: tb_thread_id:%p", list->th);
rb_str_catf(msg, "\n depended by: tb_thread_id:%p", (void *)list->th);
list = list->next;
}
}

2
vm.c
View file

@ -262,7 +262,7 @@ rb_vm_cref_new_toplevel(void)
static void
vm_cref_dump(const char *mesg, const rb_cref_t *cref)
{
fprintf(stderr, "vm_cref_dump: %s (%p)\n", mesg, cref);
fprintf(stderr, "vm_cref_dump: %s (%p)\n", mesg, (void *)cref);
while (cref) {
fprintf(stderr, "= cref| klass: %s\n", RSTRING_PTR(rb_class_path(CREF_CLASS(cref))));

View file

@ -1083,7 +1083,7 @@ rb_vmdebug_stack_dump_all_threads(void)
ruby_fill_thread_id_string(th->thread_id, buf);
fprintf(stderr, "th: %p, native_id: %s\n", th, buf);
#else
fprintf(stderr, "th: %p, native_id: %p\n", th, (void *)th->thread_id);
fprintf(stderr, "th: %p, native_id: %p\n", (void *)th, (void *)th->thread_id);
#endif
rb_vmdebug_stack_dump_raw(th->ec, th->ec->cfp);
}

View file

@ -1148,7 +1148,7 @@ rb_iterate0(VALUE (* it_proc) (VALUE), VALUE data1,
retval = THROW_DATA_VAL(err);
}
else if (0) {
SDR(); fprintf(stderr, "%p, %p\n", cfp, escape_cfp);
SDR(); fprintf(stderr, "%p, %p\n", (void *)cfp, (void *)escape_cfp);
}
}
EC_POP_TAG();

View file

@ -1862,7 +1862,7 @@ vm_cfp_consistent_p(rb_execution_context_t *ec, const rb_control_frame_t *reg_cf
#define CHECK_CFP_CONSISTENCY(func) \
(LIKELY(vm_cfp_consistent_p(ec, reg_cfp)) ? (void)0 : \
rb_bug(func ": cfp consistency error (%p, %p)", reg_cfp, ec->cfp+1))
rb_bug(func ": cfp consistency error (%p, %p)", (void *)reg_cfp, (void *)(ec->cfp+1)))
static inline
const rb_method_cfunc_t *

View file

@ -151,14 +151,14 @@ rb_method_definition_release(rb_method_definition_t *def, int complemented)
VM_ASSERT(complemented_count >= 0);
if (alias_count + complemented_count == 0) {
if (METHOD_DEBUG) fprintf(stderr, "-%p-%s:%d,%d (remove)\n", def, rb_id2name(def->original_id), alias_count, complemented_count);
if (METHOD_DEBUG) fprintf(stderr, "-%p-%s:%d,%d (remove)\n", (void *)def, rb_id2name(def->original_id), alias_count, complemented_count);
xfree(def);
}
else {
if (complemented) def->complemented_count--;
else if (def->alias_count > 0) def->alias_count--;
if (METHOD_DEBUG) fprintf(stderr, "-%p-%s:%d->%d,%d->%d (dec)\n", def, rb_id2name(def->original_id),
if (METHOD_DEBUG) fprintf(stderr, "-%p-%s:%d->%d,%d->%d (dec)\n", (void *)def, rb_id2name(def->original_id),
alias_count, def->alias_count, complemented_count, def->complemented_count);
}
}
@ -350,7 +350,7 @@ static rb_method_definition_t *
method_definition_addref(rb_method_definition_t *def)
{
def->alias_count++;
if (METHOD_DEBUG) fprintf(stderr, "+%p-%s:%d\n", def, rb_id2name(def->original_id), def->alias_count);
if (METHOD_DEBUG) fprintf(stderr, "+%p-%s:%d\n", (void *)def, rb_id2name(def->original_id), def->alias_count);
return def;
}
@ -358,7 +358,7 @@ static rb_method_definition_t *
method_definition_addref_complement(rb_method_definition_t *def)
{
def->complemented_count++;
if (METHOD_DEBUG) fprintf(stderr, "+%p-%s:%d\n", def, rb_id2name(def->original_id), def->complemented_count);
if (METHOD_DEBUG) fprintf(stderr, "+%p-%s:%d\n", (void *)def, rb_id2name(def->original_id), def->complemented_count);
return def;
}