From: Florian Krohm Date: Mon, 3 Aug 2015 21:05:20 +0000 (+0000) Subject: Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness. X-Git-Tag: svn/VALGRIND_3_11_0~178 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19e5e87c75bb825e3b20e2b499da14b6a7ee53c8;p=thirdparty%2Fvalgrind.git Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15479 --- diff --git a/exp-bbv/bbv_main.c b/exp-bbv/bbv_main.c index db7835f41c..c199cc0bb6 100644 --- a/exp-bbv/bbv_main.c +++ b/exp-bbv/bbv_main.c @@ -116,8 +116,8 @@ static void dumpPcFile(void) /* and function name for each basic block */ VG_(OSetGen_ResetIter)(instr_info_table); while ( (bb_elem = VG_(OSetGen_Next)(instr_info_table)) ) { - VG_(fprintf)( fp, "F:%d:%x:%s\n", bb_elem->block_num, - (Int)bb_elem->BB_addr, bb_elem->fn_name); + VG_(fprintf)( fp, "F:%d:%lx:%s\n", bb_elem->block_num, + bb_elem->BB_addr, bb_elem->fn_name); } VG_(fclose)(fp); @@ -565,10 +565,10 @@ static void bbv_fini(Int exitcode) VG_(sprintf)(buf,"\n\n" "# Thread %d\n" "# Total intervals: %d (Interval Size %d)\n" - "# Total instructions: %lld\n" - "# Total reps: %lld\n" - "# Unique reps: %lld\n" - "# Total fldcw instructions: %lld\n\n", + "# Total instructions: %llu\n" + "# Total reps: %llu\n" + "# Unique reps: %llu\n" + "# Total fldcw instructions: %llu\n\n", i, (Int)(bbv_thread[i].total_instr/(ULong)interval_size), interval_size, diff --git a/exp-dhat/dh_main.c b/exp-dhat/dh_main.c index 471c3edc62..b9dfff0809 100644 --- a/exp-dhat/dh_main.c +++ b/exp-dhat/dh_main.c @@ -494,7 +494,7 @@ void* new_block ( ThreadId tid, void* p, SizeT req_szB, SizeT req_alignB, intro_Block(bk); - if (0) VG_(printf)("ALLOC %ld -> %p\n", req_szB, p); + if (0) VG_(printf)("ALLOC %lu -> %p\n", req_szB, p); return p; } @@ -537,7 +537,7 @@ void die_block ( void* p, Bool custom_free ) static void* renew_block ( ThreadId tid, void* p_old, SizeT new_req_szB ) { - if (0) VG_(printf)("REALL %p %ld\n", p_old, new_req_szB); + if (0) VG_(printf)("REALL %p %lu\n", p_old, new_req_szB); void* p_new = NULL; tl_assert(new_req_szB > 0); // map 0 to 1 diff --git a/exp-sgcheck/pc_common.c b/exp-sgcheck/pc_common.c index de6bb16ce1..57be8bda09 100644 --- a/exp-sgcheck/pc_common.c +++ b/exp-sgcheck/pc_common.c @@ -564,8 +564,8 @@ void pc_pp_Error ( const Error* err ) what, s ); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); - emit( " Address %#lx is %ld bytes inside a " - "%ld-byte block free'd\n", + emit( " Address %#lx is %lu bytes inside a " + "%lu-byte block free'd\n", lo, lo-Seg__addr(seglo), Seg__size(seglo) ); VG_(pp_ExeContext)(Seg__where(seglo)); @@ -575,8 +575,8 @@ void pc_pp_Error ( const Error* err ) what, s ); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); - emit( " Address %#lx is %ld bytes inside a " - "%ld-byte block free'd\n", + emit( " Address %#lx is %lu bytes inside a " + "%lu-byte block free'd\n", lo, lo-Seg__addr(seglo), Seg__size(seglo) ); VG_(pp_ExeContext)(Seg__where(seglo)); @@ -595,8 +595,8 @@ void pc_pp_Error ( const Error* err ) emit( " First byte is " "not inside a known block\n" ); } else { - emit( " First byte (%#lx) is %ld bytes inside a " - "%ld-byte block alloc'd\n", + emit( " First byte (%#lx) is %lu bytes inside a " + "%lu-byte block alloc'd\n", lo, lo-Seg__addr(seglo), Seg__size(seglo) ); VG_(pp_ExeContext)(Seg__where(seglo)); } @@ -605,8 +605,8 @@ void pc_pp_Error ( const Error* err ) emit( " Last byte is " "not inside a known block\n" ); } else { - emit( " Last byte (%#lx) is %ld bytes inside a " - "%ld-byte block alloc'd\n", + emit( " Last byte (%#lx) is %lu bytes inside a " + "%lu-byte block alloc'd\n", hi, hi-Seg__addr(seghi), Seg__size(seghi) ); VG_(pp_ExeContext)(Seg__where(seghi)); } @@ -620,8 +620,8 @@ void pc_pp_Error ( const Error* err ) if (UNKNOWN == seglo) { emit( " First byte is not inside a known block\n" ); } else { - emit( " First byte (%#lx) is %ld bytes inside a " - "%ld-byte block alloc'd\n", + emit( " First byte (%#lx) is %lu bytes inside a " + "%lu-byte block alloc'd\n", lo, lo-Seg__addr(seglo), Seg__size(seglo) ); VG_(pp_ExeContext)(Seg__where(seglo)); } @@ -629,8 +629,8 @@ void pc_pp_Error ( const Error* err ) if (UNKNOWN == seghi) { emit( " Last byte is not inside a known block\n" ); } else { - emit( " Last byte (%#lx) is %ld bytes inside a " - "%ld-byte block alloc'd\n", + emit( " Last byte (%#lx) is %lu bytes inside a " + "%lu-byte block alloc'd\n", hi, hi-Seg__addr(seghi), Seg__size(seghi) ); VG_(pp_ExeContext)(Seg__where(seghi)); } diff --git a/exp-sgcheck/sg_main.c b/exp-sgcheck/sg_main.c index 0b2c50ef5b..1910ae686e 100644 --- a/exp-sgcheck/sg_main.c +++ b/exp-sgcheck/sg_main.c @@ -631,7 +631,7 @@ typedef static void GlobalTreeNode__pp ( GlobalTreeNode* nd ) { tl_assert(nd->descr); - VG_(printf)("GTNode [%#lx,+%ld) %s", + VG_(printf)("GTNode [%#lx,+%lu) %s", nd->addr, nd->szB, nd->descr->name); } @@ -1648,7 +1648,7 @@ static void classify_address ( /*OUT*/Invar* inv, sKey.szB = szB; gKey.addr = ea; gKey.szB = szB; - if (0) VG_(printf)("Tree sizes %ld %ld\n", + if (0) VG_(printf)("Tree sizes %lu %lu\n", VG_(sizeFM)(siTrees[tid]), VG_(sizeFM)(giTree)); sOK = VG_(findBoundsFM)( siTrees[tid], (UWord*)&sLB, NULL/*unused*/, @@ -1896,7 +1896,7 @@ void shadowStack_new_frame ( ThreadId tid, if (0 && (sb || gb)) VG_(message)(Vg_DebugMsg, "exp-sgcheck: new max tree sizes: " - "StackTree %ld, GlobalTree %ld\n", + "StackTree %lu, GlobalTree %lu\n", stats__max_sitree_size, stats__max_gitree_size ); } } else { diff --git a/massif/ms_main.c b/massif/ms_main.c index 5053c4f0ae..1ca0cd1db4 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -1115,7 +1115,7 @@ static void VERB_snapshot(Int verbosity, const HChar* prefix, Int i) default: tl_assert2(0, "VERB_snapshot: unknown snapshot kind: %d", snapshot->kind); } - VERB(verbosity, "%s S%s%3d (t:%lld, hp:%ld, ex:%ld, st:%ld)\n", + VERB(verbosity, "%s S%s%3d (t:%lld, hp:%lu, ex:%lu, st:%lu)\n", prefix, suffix, i, snapshot->time, snapshot->heap_szB, @@ -1722,7 +1722,8 @@ void* realloc_block ( ThreadId tid, void* p_old, SizeT new_req_szB ) } VERB(3, ">>> (%ld, %ld)\n", - new_req_szB - old_req_szB, new_slop_szB - old_slop_szB); + (SSizeT)(new_req_szB - old_req_szB), + (SSizeT)(new_slop_szB - old_slop_szB)); } return p_new; @@ -1902,7 +1903,7 @@ static void update_stack_stats(SSizeT stack_szB_delta) static INLINE void new_mem_stack_2(SizeT len, const HChar* what) { if (have_started_executing_code) { - VERB(3, "<<< new_mem_stack (%ld)\n", len); + VERB(3, "<<< new_mem_stack (%lu)\n", len); n_stack_allocs++; update_stack_stats(len); maybe_take_snapshot(Normal, what); @@ -1913,7 +1914,7 @@ static INLINE void new_mem_stack_2(SizeT len, const HChar* what) static INLINE void die_mem_stack_2(SizeT len, const HChar* what) { if (have_started_executing_code) { - VERB(3, "<<< die_mem_stack (%ld)\n", -len); + VERB(3, "<<< die_mem_stack (-%lu)\n", len); n_stack_frees++; maybe_take_snapshot(Peak, "stkPEAK"); update_stack_stats(-len); @@ -2149,7 +2150,7 @@ static void pp_snapshot_SXPt(VgFile *fp, SXPt* sxpt, Int depth, } // Do the non-ip_desc part first... - FP("%sn%d: %lu ", depth_str, sxpt->Sig.n_children, sxpt->szB); + FP("%sn%u: %lu ", depth_str, sxpt->Sig.n_children, sxpt->szB); // For ip_descs beginning with "0xABCD...:" addresses, we first // measure the length of the "0xabcd: " address at the start of the @@ -2407,7 +2408,7 @@ static void ms_print_stats (void) STATS("stack allocs: %u\n", n_stack_allocs); STATS("stack frees: %u\n", n_stack_frees); STATS("XPts: %u\n", n_xpts); - STATS("top-XPts: %u (%d%%)\n", + STATS("top-XPts: %u (%u%%)\n", alloc_xpt->n_children, ( n_xpts ? alloc_xpt->n_children * 100 / n_xpts : 0)); STATS("XPt init expansions: %u\n", n_xpt_init_expansions);