ruby-changes:49426
From: shyouhei <ko1@a...>
Date: Tue, 2 Jan 2018 15:41:45 +0900 (JST)
Subject: [ruby-changes:49426] shyouhei:r61542 (trunk): explicit cast to void* required for %p
shyouhei 2018-01-02 15:41:40 +0900 (Tue, 02 Jan 2018) New Revision: 61542 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61542 Log: 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. Modified files: trunk/cont.c trunk/gc.c trunk/proc.c trunk/thread.c trunk/vm.c trunk/vm_dump.c trunk/vm_eval.c trunk/vm_insnhelper.c trunk/vm_method.c Index: vm_dump.c =================================================================== --- vm_dump.c (revision 61541) +++ vm_dump.c (revision 61542) @@ -1083,7 +1083,7 @@ rb_vmdebug_stack_dump_all_threads(void) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L1083 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); } Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 61541) +++ vm_insnhelper.c (revision 61542) @@ -1862,7 +1862,7 @@ vm_cfp_consistent_p(rb_execution_context https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1862 #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 * Index: proc.c =================================================================== --- proc.c (revision 61541) +++ proc.c (revision 61542) @@ -1279,7 +1279,7 @@ rb_block_to_s(VALUE self, const struct r https://github.com/ruby/ruby/blob/trunk/proc.c#L1279 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; } Index: thread.c =================================================================== --- thread.c (revision 61541) +++ thread.c (revision 61542) @@ -473,7 +473,7 @@ rb_threadptr_unlock_all_locking_mutexes( https://github.com/ruby/ruby/blob/trunk/thread.c#L473 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 https://github.com/ruby/ruby/blob/trunk/thread.c#L4966 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; } } Index: gc.c =================================================================== --- gc.c (revision 61541) +++ gc.c (revision 61542) @@ -1437,7 +1437,7 @@ heap_page_add_freeobj(rb_objspace_t *obj https://github.com/ruby/ruby/blob/trunk/gc.c#L1437 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 *objspa https://github.com/ruby/ruby/blob/trunk/gc.c#L1590 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 https://github.com/ruby/ruby/blob/trunk/gc.c#L1631 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 https://github.com/ruby/ruby/blob/trunk/gc.c#L2029 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 https://github.com/ruby/ruby/blob/trunk/gc.c#L4703 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 *objsp https://github.com/ruby/ruby/blob/trunk/gc.c#L5248 } } 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; Index: cont.c =================================================================== --- cont.c (revision 61541) +++ cont.c (revision 61542) @@ -222,7 +222,7 @@ rb_ec_verify(const rb_execution_context_ https://github.com/ruby/ruby/blob/trunk/cont.c#L222 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); Index: vm.c =================================================================== --- vm.c (revision 61541) +++ vm.c (revision 61542) @@ -262,7 +262,7 @@ rb_vm_cref_new_toplevel(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L262 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)))); Index: vm_eval.c =================================================================== --- vm_eval.c (revision 61541) +++ vm_eval.c (revision 61542) @@ -1148,7 +1148,7 @@ rb_iterate0(VALUE (* it_proc) (VALUE), V https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1148 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(); Index: vm_method.c =================================================================== --- vm_method.c (revision 61541) +++ vm_method.c (revision 61542) @@ -151,14 +151,14 @@ rb_method_definition_release(rb_method_d https://github.com/ruby/ruby/blob/trunk/vm_method.c#L151 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 * https://github.com/ruby/ruby/blob/trunk/vm_method.c#L350 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 * https://github.com/ruby/ruby/blob/trunk/vm_method.c#L358 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; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/