From: Ivan Maidanski Date: Thu, 20 Oct 2016 22:54:17 +0000 (+0300) Subject: Eliminate 'printf format specifies type void*' GCC pedantic warnings X-Git-Tag: v7.6.2~345 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2061e9090acb0106292581e4d2707b2ad0d427f7;p=gc Eliminate 'printf format specifies type void*' GCC pedantic warnings Explicitly cast pointer arguments (passed to printf and ABORT_ARGn) to void* to match %p format specifier. * allchblk.c [!NO_DEBUGGING] (GC_dump_regions): Cast arguments to void* those printf format specifier is %p. * alloc.c [!NO_DEBUGGING] (GC_print_heap_sects): Likewise. * backgraph.c [MAKE_BACK_GRAPH] (backwards_height): Likewise. * blacklst.c (GC_default_print_heap_obj_proc): Likewise. * blacklst.c [PRINT_BLACK_LIST] (GC_print_blacklisted_ptr): Likewise. * cord/cordbscs.c (CORD_dump_inner): Likewise. * darwin_stop_world.c [DEBUG_THREADS_EXTRA] (GC_FindTopOfStack): Likewise. * darwin_stop_world.c [DEBUG_THREADS] (GC_stack_range_for): Likewise. * dbg_mlc.c (GC_print_obj): Likewise. * dbg_mlc.c [!SHORT_DBG_HDRS] (GC_print_smashed_obj): Likewise. * dyn_load.c [HAVE_DL_ITERATE_PHDR] (GC_register_dynamic_libraries_dl_iterate_phdr): Likewise. * dyn_load.c [IRIX5] (GC_register_dynamic_libraries): Likewise. * finalize.c [!NO_DEBUGGING] (GC_dump_finalization_links, GC_dump_finalization): Likewise. * include/private/gc_pmark.h [MARK_BIT_PER_GRANULE || MARK_BIT_PER_OBJ] (PUSH_CONTENTS_HDR): Likewise. * mark.c [ENABLE_TRACE] (GC_mark_from): Likewise. * mark_rts.c [!NO_DEBUGGING] (GC_print_static_roots): Likewise. * mark_rts.c [DEBUG_ADD_DEL_ROOTS] (GC_add_roots_inner, GC_remove_root_at_pos): Likewise. * misc.c [ENABLE_TRACE] (GC_init): Likewise. * os_dep.c [LINUX || HURD] (GC_init_linux_data_start): Likewise. * os_dep.c [!OS2 && !MSWIN32] (GC_register_data_segments): Likewise. * os_dep.c [USE_MUNMAP && !USE_WINALLOC && !NACL] (GC_remap): Likewise. * os_dep.c [!DARWIN && !MSWIN32 && !MSWINCE] (GC_write_fault_handler): Likewise. * os_dep.c [PROC_VDB && DEBUG_DIRTY_BITS] (GC_read_dirty): Likewise. * os_dep.c [MPROTECT_VDB && DARWIN && BROKEN_EXCEPTION_HANDLING] (catch_exception_raise): Likewise. * pthread_stop_world.c [DEBUG_THREADS] (GC_push_all_stacks): Likewise. * pthread_support.c [DEBUG_THREADS] (GC_unregister_my_thread_inner, GC_unregister_my_thread, GC_start_rtn_prepare_thread): Likewise. * reclaim.c [!NO_DEBUGGING] (GC_print_free_list): Likewise. * specific.c [USE_CUSTOM_SPECIFIC && GC_ASSERTIONS] (GC_check_tsd_marks): Likewise. * win32_threads.c [DEBUG_THREADS] (GC_push_stack_for): Likewise. * win32_threads.c [GC_PTHREADS && DEBUG_THREADS] (GC_pthread_join, GC_pthread_create, GC_pthread_start_inner, GC_thread_exit_proc): Likewise. * dbg_mlc.c: Remove duplicate check of SHORT_DBG_HDRS. * include/private/gc_pmark.h [MARK_BIT_PER_GRANULE || MARK_BIT_PER_OBJ] (PUSH_CONTENTS_HDR): Add missing parentheses around "source" argument when casting it to ptr_t. --- diff --git a/allchblk.c b/allchblk.c index 42bfed2c..90331dc8 100644 --- a/allchblk.c +++ b/allchblk.c @@ -182,12 +182,13 @@ GC_API void GC_CALL GC_dump_regions(void) ++i; end = GC_heap_sects[i].hs_start + GC_heap_sects[i].hs_bytes; } - GC_printf("***Section from %p to %p\n", start, end); + GC_printf("***Section from %p to %p\n", (void *)start, (void *)end); for (p = start; (word)p < (word)end; ) { hdr *hhdr = HDR(p); if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { - GC_printf("\t%p Missing header!!(%p)\n", p, (void *)hhdr); + GC_printf("\t%p Missing header!!(%p)\n", + (void *)p, (void *)hhdr); p += HBLKSIZE; continue; } @@ -196,8 +197,8 @@ GC_API void GC_CALL GC_dump_regions(void) divHBLKSZ(hhdr -> hb_sz)); int actual_index; - GC_printf("\t%p\tfree block of size 0x%lx bytes%s\n", p, - (unsigned long)(hhdr -> hb_sz), + GC_printf("\t%p\tfree block of size 0x%lx bytes%s\n", + (void *)p, (unsigned long)(hhdr -> hb_sz), IS_MAPPED(hhdr) ? "" : " (unmapped)"); actual_index = free_list_index_of(hhdr); if (-1 == actual_index) { @@ -209,8 +210,8 @@ GC_API void GC_CALL GC_dump_regions(void) } p += hhdr -> hb_sz; } else { - GC_printf("\t%p\tused for blocks of size 0x%lx bytes\n", p, - (unsigned long)(hhdr -> hb_sz)); + GC_printf("\t%p\tused for blocks of size 0x%lx bytes\n", + (void *)p, (unsigned long)(hhdr -> hb_sz)); p += HBLKSIZE * OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz); } } diff --git a/alloc.c b/alloc.c index 29b3656f..0db6458b 100644 --- a/alloc.c +++ b/alloc.c @@ -1204,7 +1204,7 @@ GC_INNER void GC_add_to_heap(struct hblk *p, size_t bytes) if (GC_is_black_listed(h, HBLKSIZE)) nbl++; } GC_printf("Section %d from %p to %p %lu/%lu blacklisted\n", - i, start, start + len, + i, (void *)start, (void *)&start[len], (unsigned long)nbl, (unsigned long)divHBLKSZ(len)); } } diff --git a/backgraph.c b/backgraph.c index 5485091c..6e7a6bb8 100644 --- a/backgraph.c +++ b/backgraph.c @@ -383,7 +383,8 @@ static word backwards_height(ptr_t p) FOR_EACH_PRED(q, p, { word this_height; if (GC_is_marked(q) && !(FLAG_MANY & (word)GET_OH_BG_PTR(p))) { - GC_COND_LOG_PRINTF("Found bogus pointer from %p to %p\n", q, p); + GC_COND_LOG_PRINTF("Found bogus pointer from %p to %p\n", + (void *)q, (void *)p); /* Reachable object "points to" unreachable one. */ /* Could be caused by our lax treatment of GC descriptors. */ this_height = 1; diff --git a/blacklst.c b/blacklst.c index d080944e..449130df 100644 --- a/blacklst.c +++ b/blacklst.c @@ -60,7 +60,7 @@ GC_INNER void GC_default_print_heap_obj_proc(ptr_t p) int kind = HDR(base)->hb_obj_kind; GC_err_printf("object at %p of appr. %lu bytes (%s)\n", - base, (unsigned long)GC_size(base), + (void *)base, (unsigned long)GC_size(base), kind == PTRFREE ? "atomic" : IS_UNCOLLECTABLE(kind) ? "uncollectable" : "composite"); } @@ -75,7 +75,7 @@ GC_INNER void (*GC_print_heap_obj)(ptr_t p) = GC_default_print_heap_obj_proc; if (0 == base) { GC_err_printf("Black listing (%s) %p referenced from %p in %s\n", - kind_str, (ptr_t)p, source, + kind_str, (void *)p, (void *)source, NULL != source ? "root set" : "register"); } else { /* FIXME: We can't call the debug version of GC_print_heap_obj */ @@ -83,8 +83,8 @@ GC_INNER void (*GC_print_heap_obj)(ptr_t p) = GC_default_print_heap_obj_proc; /* the world is stopped. */ GC_err_printf("Black listing (%s) %p referenced from %p in" " object at %p of appr. %lu bytes\n", - kind_str, (ptr_t)p, source, - base, (unsigned long)GC_size(base)); + kind_str, (void *)p, (void *)source, + (void *)base, (unsigned long)GC_size(base)); } } #endif /* PRINT_BLACK_LIST */ diff --git a/cord/cordbscs.c b/cord/cordbscs.c index 300180a2..38b1c958 100644 --- a/cord/cordbscs.c +++ b/cord/cordbscs.c @@ -126,14 +126,14 @@ void CORD_dump_inner(CORD x, unsigned n) register struct Concatenation * conc = &(((CordRep *)x) -> concatenation); printf("Concatenation: %p (len: %d, depth: %d)\n", - x, (int)(conc -> len), (int)(conc -> depth)); + (void *)x, (int)(conc -> len), (int)(conc -> depth)); CORD_dump_inner(conc -> left, n+1); CORD_dump_inner(conc -> right, n+1); } else /* function */{ register struct Function * func = &(((CordRep *)x) -> function); if (IS_SUBSTR(x)) printf("(Substring) "); - printf("Function: %p (len: %d): ", x, (int)(func -> len)); + printf("Function: %p (len: %d): ", (void *)x, (int)(func -> len)); for (i = 0; i < 20 && i < func -> len; i++) { putchar((*(func -> fn))(i, func -> client_data)); } diff --git a/darwin_stop_world.c b/darwin_stop_world.c index aef1a55c..7cd5775f 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -73,7 +73,7 @@ GC_INNER ptr_t GC_FindTopOfStack(unsigned long stack_start) } # ifdef DEBUG_THREADS_EXTRA - GC_log_printf("FindTopOfStack start at sp = %p\n", frame); + GC_log_printf("FindTopOfStack start at sp = %p\n", (void *)frame); # endif while (frame->savedSP != 0) { /* if there are no more stack frames, stop */ @@ -87,7 +87,7 @@ GC_INNER ptr_t GC_FindTopOfStack(unsigned long stack_start) break; /* if the next LR is bogus, stop */ } # ifdef DEBUG_THREADS_EXTRA - GC_log_printf("FindTopOfStack finish at sp = %p\n", frame); + GC_log_printf("FindTopOfStack finish at sp = %p\n", (void *)frame); # endif return (ptr_t)frame; } @@ -331,7 +331,7 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p, } # ifdef DEBUG_THREADS GC_log_printf("Darwin: Stack for thread %p = [%p,%p)\n", - (void *)(word)thread, lo, *phi); + (void *)(word)thread, (void *)lo, (void *)(*phi)); # endif return lo; } diff --git a/dbg_mlc.c b/dbg_mlc.c index 7a6ac460..21d423da 100644 --- a/dbg_mlc.c +++ b/dbg_mlc.c @@ -404,13 +404,14 @@ STATIC void GC_print_obj(ptr_t p) if (NULL != kind_str) { GC_err_printf("%p (%s:%d," IF_NOT_SHORTDBG_HDRS(" sz=%lu,") " %s)\n", - (ptr_t)ohdr + sizeof(oh), + (void *)((ptr_t)ohdr + sizeof(oh)), ohdr->oh_string, GET_OH_LINENUM(ohdr) /*, */ COMMA_IFNOT_SHORTDBG_HDRS((unsigned long)ohdr->oh_sz), kind_str); } else { GC_err_printf("%p (%s:%d," IF_NOT_SHORTDBG_HDRS(" sz=%lu,") - " kind=%d descr=0x%lx)\n", (ptr_t)ohdr + sizeof(oh), + " kind=%d descr=0x%lx)\n", + (void *)((ptr_t)ohdr + sizeof(oh)), ohdr->oh_string, GET_OH_LINENUM(ohdr) /*, */ COMMA_IFNOT_SHORTDBG_HDRS((unsigned long)ohdr->oh_sz), kind, (unsigned long)hhdr->hb_descr); @@ -445,11 +446,11 @@ STATIC void GC_debug_print_heap_obj_proc(ptr_t p) || ohdr -> oh_string == 0) { GC_err_printf( "%s %p in or near object at %p(, appr. sz = %lu)\n", - msg, clobbered_addr, p, + msg, (void *)clobbered_addr, (void *)p, (unsigned long)(GC_size((ptr_t)ohdr) - DEBUG_BYTES)); } else { GC_err_printf("%s %p in or near object at %p (%s:%d, sz=%lu)\n", - msg, clobbered_addr, p, + msg, (void *)clobbered_addr, (void *)p, (word)(ohdr -> oh_string) < HBLKSIZE ? "(smashed string)" : ohdr -> oh_string[0] == '\0' ? "EMPTY(smashed?)" : ohdr -> oh_string, @@ -457,9 +458,7 @@ STATIC void GC_debug_print_heap_obj_proc(ptr_t p) PRINT_CALL_CHAIN(ohdr); } } -#endif -#ifndef SHORT_DBG_HDRS STATIC void GC_check_heap_proc (void); STATIC void GC_print_all_smashed_proc (void); #else diff --git a/dyn_load.c b/dyn_load.c index b4a1ef51..42534c1e 100644 --- a/dyn_load.c +++ b/dyn_load.c @@ -624,7 +624,7 @@ STATIC GC_bool GC_register_dynamic_libraries_dl_iterate_phdr(void) if (NULL == *(char * volatile *)&datastart || (word)datastart > (word)dataend) ABORT_ARG2("Wrong DATASTART/END pair", - ": %p .. %p", datastart, dataend); + ": %p .. %p", (void *)datastart, (void *)dataend); /* dl_iterate_phdr may forget the static data segment in */ /* statically linked executables. */ @@ -634,7 +634,7 @@ STATIC GC_bool GC_register_dynamic_libraries_dl_iterate_phdr(void) /* Subtract one to check also for NULL */ /* without a compiler warning. */ ABORT_ARG2("Wrong DATASTART/END2 pair", - ": %p .. %p", DATASTART2, DATAEND2); + ": %p .. %p", (void *)DATASTART2, (void *)DATAEND2); } GC_add_roots_inner(DATASTART2, DATAEND2, TRUE); # endif @@ -826,7 +826,7 @@ GC_INNER void GC_register_dynamic_libraries(void) if (ioctl(fd, PIOCMAP, addr_map) < 0) { ABORT_ARG3("/proc PIOCMAP ioctl failed", ": errcode= %d, needed_sz= %d, addr_map= %p", - errno, needed_sz, addr_map); + errno, needed_sz, (void *)addr_map); }; if (GC_n_heap_sects > 0) { heap_end = GC_heap_sects[GC_n_heap_sects-1].hs_start diff --git a/finalize.c b/finalize.c index 26cd6683..00130970 100644 --- a/finalize.c +++ b/finalize.c @@ -806,7 +806,8 @@ GC_API void GC_CALL GC_register_finalizer_unreachable(void * obj, ptr_t real_ptr = GC_REVEAL_POINTER(curr_dl -> dl_hidden_obj); ptr_t real_link = GC_REVEAL_POINTER(curr_dl -> dl_hidden_link); - GC_printf("Object: %p, link: %p\n", real_ptr, real_link); + GC_printf("Object: %p, link: %p\n", + (void *)real_ptr, (void *)real_link); } } } @@ -830,7 +831,7 @@ GC_API void GC_CALL GC_register_finalizer_unreachable(void * obj, curr_fo != NULL; curr_fo = fo_next(curr_fo)) { ptr_t real_ptr = GC_REVEAL_POINTER(curr_fo -> fo_hidden_base); - GC_printf("Finalizable object: %p\n", real_ptr); + GC_printf("Finalizable object: %p\n", (void *)real_ptr); } } } diff --git a/include/private/gc_pmark.h b/include/private/gc_pmark.h index 8303af8b..65f7ef82 100644 --- a/include/private/gc_pmark.h +++ b/include/private/gc_pmark.h @@ -279,9 +279,9 @@ GC_INNER mse * GC_signal_mark_stack_overflow(mse *msp); (unsigned)GC_gc_no)); \ TRACE_TARGET(base, \ GC_log_printf("GC #%u: marking %p from %p instead\n", \ - (unsigned)GC_gc_no, base, source)); \ + (unsigned)GC_gc_no, (void *)base, (void *)(source))); \ INCR_MARKS(hhdr); \ - GC_STORE_BACK_PTR((ptr_t)source, base); \ + GC_STORE_BACK_PTR((ptr_t)(source), base); \ PUSH_OBJ(base, hhdr, mark_stack_top, mark_stack_limit); \ } while (0) #endif /* MARK_BIT_PER_GRANULE */ @@ -336,9 +336,9 @@ GC_INNER mse * GC_signal_mark_stack_overflow(mse *msp); (unsigned)GC_gc_no)); \ TRACE_TARGET(base, \ GC_log_printf("GC #%u: marking %p from %p instead\n", \ - (unsigned)GC_gc_no, base, source)); \ + (unsigned)GC_gc_no, (void *)base, (void *)(source))); \ INCR_MARKS(hhdr); \ - GC_STORE_BACK_PTR((ptr_t)source, base); \ + GC_STORE_BACK_PTR((ptr_t)(source), base); \ PUSH_OBJ(base, hhdr, mark_stack_top, mark_stack_limit); \ } while (0) #endif /* MARK_BIT_PER_OBJ */ diff --git a/mark.c b/mark.c index eb0f7846..e882b236 100644 --- a/mark.c +++ b/mark.c @@ -644,7 +644,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, if ((word)GC_trace_addr >= (word)current_p && (word)GC_trace_addr < (word)(current_p + descr)) { GC_log_printf("GC #%u: large section; start %p, len %lu\n", - (unsigned)GC_gc_no, current_p, (unsigned long)descr); + (unsigned)GC_gc_no, (void *)current_p, + (unsigned long)descr); } # endif /* ENABLE_TRACE */ # ifdef PARALLEL_MARK @@ -661,7 +662,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, if ((word)GC_trace_addr >= (word)current_p && (word)GC_trace_addr < (word)(current_p + descr)) { GC_log_printf("GC #%u: splitting (parallel) %p at %p\n", - (unsigned)GC_gc_no, current_p, current_p + new_size); + (unsigned)GC_gc_no, (void *)current_p, + (void *)(current_p + new_size)); } # endif /* ENABLE_TRACE */ current_p += new_size; @@ -677,7 +679,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, if ((word)GC_trace_addr >= (word)current_p && (word)GC_trace_addr < (word)(current_p + descr)) { GC_log_printf("GC #%u: splitting %p at %p\n", - (unsigned)GC_gc_no, current_p, limit); + (unsigned)GC_gc_no, (void *)current_p, + (void *)limit); } # endif /* ENABLE_TRACE */ /* Make sure that pointers overlapping the two ranges are */ @@ -691,7 +694,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, && (word)GC_trace_addr < (word)(current_p + WORDS_TO_BYTES(WORDSZ-2))) { GC_log_printf("GC #%u: tracing from %p bitmap descr %lu\n", - (unsigned)GC_gc_no, current_p, + (unsigned)GC_gc_no, (void *)current_p, (unsigned long)descr); } # endif /* ENABLE_TRACE */ @@ -706,8 +709,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, # ifdef ENABLE_TRACE if (GC_trace_addr == current_p) { GC_log_printf("GC #%u: considering(3) %p -> %p\n", - (unsigned)GC_gc_no, current_p, - (ptr_t)current); + (unsigned)GC_gc_no, (void *)current_p, + (void *)current); } # endif /* ENABLE_TRACE */ PUSH_CONTENTS((ptr_t)current, mark_stack_top, @@ -725,7 +728,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, && GC_base(current_p) != 0 && GC_base(current_p) == GC_base(GC_trace_addr)) { GC_log_printf("GC #%u: tracing from %p, proc descr %lu\n", - (unsigned)GC_gc_no, current_p, + (unsigned)GC_gc_no, (void *)current_p, (unsigned long)descr); } # endif /* ENABLE_TRACE */ @@ -799,7 +802,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, if ((word)GC_trace_addr >= (word)current_p && (word)GC_trace_addr < (word)limit) { GC_log_printf("GC #%u: Tracing from %p, length is %lu\n", - (unsigned)GC_gc_no, current_p, (unsigned long)descr); + (unsigned)GC_gc_no, (void *)current_p, + (unsigned long)descr); } # endif /* ENABLE_TRACE */ /* The simple case in which we're scanning a range. */ @@ -856,7 +860,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, # ifdef ENABLE_TRACE if (GC_trace_addr == current_p) { GC_log_printf("GC #%u: considering(1) %p -> %p\n", - (unsigned)GC_gc_no, current_p, (ptr_t)current); + (unsigned)GC_gc_no, (void *)current_p, + (void *)current); } # endif /* ENABLE_TRACE */ PUSH_CONTENTS((ptr_t)current, mark_stack_top, @@ -872,7 +877,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, # ifdef ENABLE_TRACE if (GC_trace_addr == current_p) { GC_log_printf("GC #%u: considering(2) %p -> %p\n", - (unsigned)GC_gc_no, current_p, (ptr_t)deferred); + (unsigned)GC_gc_no, (void *)current_p, + (void *)deferred); } # endif /* ENABLE_TRACE */ PUSH_CONTENTS((ptr_t)deferred, mark_stack_top, diff --git a/mark_rts.c b/mark_rts.c index f3250113..4726af16 100644 --- a/mark_rts.c +++ b/mark_rts.c @@ -62,7 +62,8 @@ static int n_root_sets = 0; for (i = 0; i < n_root_sets; i++) { GC_printf("From %p to %p%s\n", - GC_static_roots[i].r_start, GC_static_roots[i].r_end, + (void *)GC_static_roots[i].r_start, + (void *)GC_static_roots[i].r_end, GC_static_roots[i].r_tmp ? " (temporary)" : ""); } GC_printf("GC_root_size: %lu\n", (unsigned long)GC_root_size); @@ -250,7 +251,8 @@ void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp) # ifdef DEBUG_ADD_DEL_ROOTS GC_log_printf("Adding data root section %d: %p .. %p%s\n", - n_root_sets, b, e, tmp ? " (temporary)" : ""); + n_root_sets, (void *)b, (void *)e, + tmp ? " (temporary)" : ""); # endif GC_static_roots[n_root_sets].r_start = (ptr_t)b; GC_static_roots[n_root_sets].r_end = (ptr_t)e; @@ -288,7 +290,8 @@ STATIC void GC_remove_root_at_pos(int i) { # ifdef DEBUG_ADD_DEL_ROOTS GC_log_printf("Remove data root section at %d: %p .. %p%s\n", - i, GC_static_roots[i].r_start, GC_static_roots[i].r_end, + i, (void *)GC_static_roots[i].r_start, + (void *)GC_static_roots[i].r_end, GC_static_roots[i].r_tmp ? " (temporary)" : ""); # endif GC_root_size -= (GC_static_roots[i].r_end - GC_static_roots[i].r_start); diff --git a/misc.c b/misc.c index 7414f7ad..5761ab52 100644 --- a/misc.c +++ b/misc.c @@ -1045,7 +1045,7 @@ GC_API void GC_CALL GC_init(void) # else word addr = (word)STRTOULL(addr_string, NULL, 16); if (addr < 0x1000) - WARN("Unlikely trace address: %p\n", addr); + WARN("Unlikely trace address: %p\n", (void *)addr); GC_trace_addr = (ptr_t)addr; # endif } diff --git a/os_dep.c b/os_dep.c index a07942e4..1423f72d 100644 --- a/os_dep.c +++ b/os_dep.c @@ -446,7 +446,7 @@ GC_INNER char * GC_get_maps(void) if (GC_data_start != NULL) { if ((word)GC_data_start > (word)data_end) ABORT_ARG2("Wrong __data_start/_end pair", - ": %p .. %p", GC_data_start, data_end); + ": %p .. %p", (void *)GC_data_start, (void *)data_end); return; } # ifdef DEBUG_ADD_DEL_ROOTS @@ -1919,7 +1919,7 @@ void GC_register_data_segments(void) if ((word)region_start - 1U >= (word)DATAEND) ABORT_ARG2("Wrong DATASTART/END pair", - ": %p .. %p", region_start, DATAEND); + ": %p .. %p", (void *)region_start, (void *)DATAEND); for (;;) { ptr_t region_end = GC_find_limit_openbsd(region_start, DATAEND); @@ -1954,13 +1954,13 @@ void GC_register_data_segments(void) /* Subtract one to check also for NULL */ /* without a compiler warning. */ ABORT_ARG2("Wrong DATASTART/END pair", - ": %p .. %p", DATASTART, DATAEND); + ": %p .. %p", (void *)DATASTART, (void *)DATAEND); } GC_add_roots_inner(DATASTART, DATAEND, FALSE); # ifdef GC_HAVE_DATAREGION2 if ((word)DATASTART2 - 1U >= (word)DATAEND2) ABORT_ARG2("Wrong DATASTART/END2 pair", - ": %p .. %p", DATASTART2, DATAEND2); + ": %p .. %p", (void *)DATASTART2, (void *)DATAEND2); GC_add_roots_inner(DATASTART2, DATAEND2, FALSE); # endif # endif @@ -2501,7 +2501,7 @@ GC_INNER void GC_remap(ptr_t start, size_t bytes) | (GC_pages_executable ? PROT_EXEC : 0)) != 0) { ABORT_ARG3("mprotect remapping failed", " at %p (length %lu), errcode= %d", - start_addr, (unsigned long)len, errno); + (void *)start_addr, (unsigned long)len, errno); } # endif /* !NACL */ } @@ -3216,7 +3216,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) if (old_handler == (SIG_HNDLR_PTR)SIG_DFL) { # if !defined(MSWIN32) && !defined(MSWINCE) ABORT_ARG1("Unexpected bus error or segmentation fault", - " at %p", addr); + " at %p", (void *)addr); # else return(EXCEPTION_CONTINUE_SEARCH); # endif @@ -3267,7 +3267,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) return EXCEPTION_CONTINUE_SEARCH; # else ABORT_ARG1("Unexpected bus error or segmentation fault", - " at %p", addr); + " at %p", (void *)addr); # endif } @@ -3629,7 +3629,7 @@ GC_INNER void GC_read_dirty(void) # ifdef DEBUG_DIRTY_BITS GC_log_printf( "pr_vaddr= %p, npage= %lu, mflags= 0x%x, pagesize= 0x%x\n", - vaddr, npages, map->pr_mflags, pagesize); + (void *)vaddr, npages, map->pr_mflags, pagesize); # endif bufp += sizeof(struct prasmap); @@ -3639,7 +3639,7 @@ GC_INNER void GC_read_dirty(void) register struct hblk * h; ptr_t next_vaddr = vaddr + pagesize; # ifdef DEBUG_DIRTY_BITS - GC_log_printf("dirty page at: %p\n", vaddr); + GC_log_printf("dirty page at: %p\n", (void *)vaddr); # endif for (h = (struct hblk *)vaddr; (word)h < (word)next_vaddr; h++) { @@ -4282,8 +4282,8 @@ catch_exception_raise(mach_port_t exception_port GC_ATTR_UNUSED, return KERN_SUCCESS; } - GC_err_printf( - "Unexpected KERN_PROTECTION_FAILURE at %p; aborting...\n", addr); + GC_err_printf("Unexpected KERN_PROTECTION_FAILURE at %p; aborting...\n", + (void *)addr); /* Can't pass it along to the signal handler because that is */ /* ignoring SIGBUS signals. We also shouldn't call ABORT here as */ /* signals don't always work too well from the exception handler. */ diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 79d34a85..6ee4282b 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -545,7 +545,7 @@ GC_INNER void GC_push_all_stacks(void) } # ifdef DEBUG_THREADS GC_log_printf("Stack for thread %p = [%p,%p)\n", - (void *)p->id, lo, hi); + (void *)p->id, (void *)lo, (void *)hi); # endif if (0 == lo) ABORT("GC_push_all_stacks: sp not set!"); if (p->altstack != NULL && (word)p->altstack <= (word)lo @@ -569,7 +569,7 @@ GC_INNER void GC_push_all_stacks(void) # ifdef IA64 # ifdef DEBUG_THREADS GC_log_printf("Reg stack for thread %p = [%p,%p)\n", - (void *)p->id, bs_lo, bs_hi); + (void *)p->id, (void *)bs_lo, (void *)bs_hi); # endif /* FIXME: This (if p->id==self) may add an unbounded number of */ /* entries, and hence overflow the mark stack, which is bad. */ diff --git a/pthread_support.c b/pthread_support.c index 211972a4..86e6c44c 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -1379,7 +1379,7 @@ STATIC void GC_unregister_my_thread_inner(GC_thread me) # ifdef DEBUG_THREADS GC_log_printf( "Unregistering thread %p, gc_thread = %p, n_threads = %d\n", - (void *)me->id, me, GC_count_threads()); + (void *)me->id, (void *)me, GC_count_threads()); # endif GC_ASSERT(!(me -> flags & FINISHED)); # if defined(THREAD_LOCAL_ALLOC) @@ -1420,7 +1420,7 @@ GC_API int GC_CALL GC_unregister_my_thread(void) # ifdef DEBUG_THREADS GC_log_printf( "Called GC_unregister_my_thread on %p, gc_thread = %p\n", - (void *)self, me); + (void *)self, (void *)me); # endif GC_ASSERT(me->id == self); GC_unregister_my_thread_inner(me); @@ -1679,7 +1679,7 @@ GC_INNER_PTHRSTART GC_thread GC_start_rtn_prepare_thread( # ifdef DEBUG_THREADS GC_log_printf("Starting thread %p, pid = %ld, sp = %p\n", - (void *)self, (long)getpid(), &arg); + (void *)self, (long)getpid(), (void *)&arg); # endif LOCK(); me = GC_register_my_thread_inner(sb, self); diff --git a/reclaim.c b/reclaim.c index 2a113e7d..cee985de 100644 --- a/reclaim.c +++ b/reclaim.c @@ -575,7 +575,7 @@ void GC_print_free_list(int kind, size_t sz_in_granules) for (n = 0; flh; n++) { struct hblk *block = HBLKPTR(flh); GC_printf("Free object in heap block %p [%d]: %p\n", - (void *)block, n, flh); + (void *)block, n, (void *)flh); flh = obj_link(flh); } } diff --git a/specific.c b/specific.c index ba23e47d..540bb319 100644 --- a/specific.c +++ b/specific.c @@ -151,14 +151,16 @@ GC_INNER void * GC_slow_getspecific(tsd * key, word qtid, for (i = 0; i < TS_HASH_SIZE; ++i) { for (p = key->hash[i].p; p != 0; p = p -> next) { if (!GC_is_marked(GC_base(p))) { - ABORT_ARG1("Unmarked thread-specific-data entry", " at %p", p); + ABORT_ARG1("Unmarked thread-specific-data entry", + " at %p", (void *)p); } } } for (i = 0; i < TS_CACHE_SIZE; ++i) { p = key -> cache[i]; if (p != &invalid_tse && !GC_is_marked(GC_base(p))) { - ABORT_ARG1("Unmarked cached thread-specific-data entry", " at %p", p); + ABORT_ARG1("Unmarked cached thread-specific-data entry", + " at %p", (void *)p); } } } diff --git a/win32_threads.c b/win32_threads.c index fc4b1631..60f2f63d 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1496,7 +1496,8 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me) if ((word)sp >= (word)stack_min && (word)sp < (word)thread->stack_base) { # ifdef DEBUG_THREADS GC_log_printf("Pushing stack for 0x%x from sp %p to %p from 0x%x\n", - (int)thread -> id, sp, thread -> stack_base, (int)me); + (int)thread->id, (void *)sp, (void *)thread->stack_base, + (int)me); # endif GC_push_all_stack_sections(sp, thread->stack_base, traced_stack_sect); } else { @@ -1509,7 +1510,8 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me) sp); # ifdef DEBUG_THREADS GC_log_printf("Pushing stack for 0x%x from (min) %p to %p from 0x%x\n", - (int)thread->id, stack_min, thread->stack_base, (int)me); + (int)thread->id, (void *)stack_min, + (void *)thread->stack_base, (int)me); # endif /* Push everything - ignore "traced stack section" data. */ GC_push_all_stack(stack_min, thread->stack_base); @@ -2515,8 +2517,9 @@ GC_INNER void GC_thr_init(void) GC_ASSERT(!GC_win32_dll_threads); # ifdef DEBUG_THREADS GC_log_printf("thread %p(0x%lx) is joining thread %p\n", - GC_PTHREAD_PTRVAL(pthread_self()), - (long)GetCurrentThreadId(), GC_PTHREAD_PTRVAL(pthread_id)); + (void *)GC_PTHREAD_PTRVAL(pthread_self()), + (long)GetCurrentThreadId(), + (void *)GC_PTHREAD_PTRVAL(pthread_id)); # endif /* Thread being joined might not have registered itself yet. */ @@ -2541,8 +2544,9 @@ GC_INNER void GC_thr_init(void) # ifdef DEBUG_THREADS GC_log_printf("thread %p(0x%lx) completed join with thread %p\n", - GC_PTHREAD_PTRVAL(pthread_self()), - (long)GetCurrentThreadId(), GC_PTHREAD_PTRVAL(pthread_id)); + (void *)GC_PTHREAD_PTRVAL(pthread_self()), + (long)GetCurrentThreadId(), + (void *)GC_PTHREAD_PTRVAL(pthread_id)); # endif return result; } @@ -2576,7 +2580,7 @@ GC_INNER void GC_thr_init(void) # ifdef DEBUG_THREADS GC_log_printf("About to create a thread from %p(0x%lx)\n", - GC_PTHREAD_PTRVAL(pthread_self()), + (void *)GC_PTHREAD_PTRVAL(pthread_self()), (long)GetCurrentThreadId()); # endif # ifndef GC_ALWAYS_MULTITHREADED @@ -2604,7 +2608,7 @@ GC_INNER void GC_thr_init(void) # ifdef DEBUG_THREADS GC_log_printf("thread %p(0x%x) starting...\n", - GC_PTHREAD_PTRVAL(pthread_id), (int)thread_id); + (void *)GC_PTHREAD_PTRVAL(pthread_id), (int)thread_id); # endif GC_ASSERT(!GC_win32_dll_threads); @@ -2633,7 +2637,7 @@ GC_INNER void GC_thr_init(void) # ifdef DEBUG_THREADS GC_log_printf("thread %p(0x%x) returned from start routine\n", - GC_PTHREAD_PTRVAL(pthread_id), (int)thread_id); + (void *)GC_PTHREAD_PTRVAL(pthread_id), (int)thread_id); # endif return(result); } @@ -2651,7 +2655,7 @@ GC_INNER void GC_thr_init(void) GC_ASSERT(!GC_win32_dll_threads); # ifdef DEBUG_THREADS GC_log_printf("thread %p(0x%lx) called pthread_exit()\n", - GC_PTHREAD_PTRVAL(pthread_self()), + (void *)GC_PTHREAD_PTRVAL(pthread_self()), (long)GetCurrentThreadId()); # endif