From 079b42ca1d02d94fb88a9e1eb32ee0fa4f25a500 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 4 Aug 2015 21:26:10 +0000 Subject: [PATCH] Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15486 --- memcheck/mc_errors.c | 12 ++++++------ memcheck/mc_leakcheck.c | 4 ++-- memcheck/mc_main.c | 30 +++++++++++++++--------------- memcheck/mc_malloc_wrappers.c | 20 ++++++++++---------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c index 4d8e863586..174b4a765d 100644 --- a/memcheck/mc_errors.c +++ b/memcheck/mc_errors.c @@ -375,8 +375,8 @@ static void pp_LossRecord(UInt n_this_record, UInt n_total_records, lr->num_blocks, d_num_blocks, str_leak_lossmode(lr->key.state), n_this_record, n_total_records ); - emit( " %ld\n", lr->szB); - emit( " %d\n", lr->num_blocks); + emit( " %lu\n", lr->szB); + emit( " %u\n", lr->num_blocks); emit( " \n" ); } VG_(pp_ExeContext)(lr->key.allocated_at); @@ -439,7 +439,7 @@ void MC_(pp_Error) ( const Error* err ) MC_(any_value_errors) = True; if (xml) { emit( " UninitValue\n" ); - emit( " Use of uninitialised value of size %ld\n", + emit( " Use of uninitialised value of size %lu\n", extra->Err.Value.szB ); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); if (extra->Err.Value.origin_ec) @@ -448,7 +448,7 @@ void MC_(pp_Error) ( const Error* err ) } else { /* Could also show extra->Err.Cond.otag if debugging origin tracking */ - emit( "Use of uninitialised value of size %ld\n", + emit( "Use of uninitialised value of size %lu\n", extra->Err.Value.szB ); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); if (extra->Err.Value.origin_ec) @@ -594,7 +594,7 @@ void MC_(pp_Error) ( const Error* err ) if (xml) { emit( " Invalid%s\n", extra->Err.Addr.isWrite ? "Write" : "Read" ); - emit( " Invalid %s of size %ld\n", + emit( " Invalid %s of size %lu\n", extra->Err.Addr.isWrite ? "write" : "read", extra->Err.Addr.szB ); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); @@ -602,7 +602,7 @@ void MC_(pp_Error) ( const Error* err ) &extra->Err.Addr.ai, extra->Err.Addr.maybe_gcc ); } else { - emit( "Invalid %s of size %ld\n", + emit( "Invalid %s of size %lu\n", extra->Err.Addr.isWrite ? "write" : "read", extra->Err.Addr.szB ); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c index a8c6247d67..42aeacb7fb 100644 --- a/memcheck/mc_leakcheck.c +++ b/memcheck/mc_leakcheck.c @@ -1875,11 +1875,11 @@ search_address_in_GP_reg(ThreadId tid, const HChar* regname, Addr addr_in_reg) && addr_in_reg < searched_wpa + searched_szB) { if (addr_in_reg == searched_wpa) VG_(umsg) - ("tid %d register %s pointing at %#lx\n", + ("tid %u register %s pointing at %#lx\n", tid, regname, searched_wpa); else VG_(umsg) - ("tid %d register %s interior pointing %lu bytes inside %#lx\n", + ("tid %u register %s interior pointing %lu bytes inside %#lx\n", tid, regname, (long unsigned) addr_in_reg - searched_wpa, searched_wpa); } diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index 78120813c2..5c3635d468 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -6122,7 +6122,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req) VG_(printf) ("\n"); if (unaddressable) { VG_(printf) - ("Address %p len %ld has %d bytes unaddressable\n", + ("Address %p len %lu has %d bytes unaddressable\n", (void *)address, szB, unaddressable); } } @@ -6272,11 +6272,11 @@ static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req) case -1: break; case 0: /* addressable */ if (is_mem_addressable ( address, szB, &bad_addr )) - VG_(printf) ("Address %p len %ld addressable\n", + VG_(printf) ("Address %p len %lu addressable\n", (void *)address, szB); else VG_(printf) - ("Address %p len %ld not addressable:\nbad address %p\n", + ("Address %p len %lu not addressable:\nbad address %p\n", (void *)address, szB, (void *) bad_addr); MC_(pp_describe_addr) (address); break; @@ -6284,7 +6284,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req) res = is_mem_defined ( address, szB, &bad_addr, &otag ); if (MC_AddrErr == res) VG_(printf) - ("Address %p len %ld not addressable:\nbad address %p\n", + ("Address %p len %lu not addressable:\nbad address %p\n", (void *)address, szB, (void *) bad_addr); else if (MC_ValueErr == res) { okind = otag & 3; @@ -6300,7 +6300,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req) default: tl_assert(0); } VG_(printf) - ("Address %p len %ld not defined:\n" + ("Address %p len %lu not defined:\n" "Uninitialised value at %p%s\n", (void *)address, szB, (void *) bad_addr, src); ecu = otag & ~3; @@ -6310,7 +6310,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req) } } else - VG_(printf) ("Address %p len %ld defined\n", + VG_(printf) ("Address %p len %lu defined\n", (void *)address, szB); MC_(pp_describe_addr) (address); break; @@ -6390,7 +6390,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req) gdb_xb (address + szB - szB % 8, szB % 8, res); if (unaddressable) { VG_(printf) - ("Address %p len %ld has %d bytes unaddressable\n", + ("Address %p len %lu has %d bytes unaddressable\n", (void *)address, szB, unaddressable); } } @@ -7392,7 +7392,7 @@ static void mc_post_clo_init ( void ) static void print_SM_info(const HChar* type, Int n_SMs) { VG_(message)(Vg_DebugMsg, - " memcheck: SMs: %s = %d (%ldk, %ldM)\n", + " memcheck: SMs: %s = %d (%luk, %luM)\n", type, n_SMs, n_SMs * sizeof(SecMap) / 1024UL, @@ -7409,18 +7409,18 @@ static void mc_print_stats (void) " memcheck: sanity checks: %d cheap, %d expensive\n", n_sanity_cheap, n_sanity_expensive ); VG_(message)(Vg_DebugMsg, - " memcheck: auxmaps: %lld auxmap entries (%lldk, %lldM) in use\n", + " memcheck: auxmaps: %llu auxmap entries (%lluk, %lluM) in use\n", n_auxmap_L2_nodes, n_auxmap_L2_nodes * 64, n_auxmap_L2_nodes / 16 ); VG_(message)(Vg_DebugMsg, - " memcheck: auxmaps_L1: %lld searches, %lld cmps, ratio %lld:10\n", + " memcheck: auxmaps_L1: %llu searches, %llu cmps, ratio %llu:10\n", n_auxmap_L1_searches, n_auxmap_L1_cmps, (10ULL * n_auxmap_L1_cmps) / (n_auxmap_L1_searches ? n_auxmap_L1_searches : 1) ); VG_(message)(Vg_DebugMsg, - " memcheck: auxmaps_L2: %lld searches, %lld nodes\n", + " memcheck: auxmaps_L2: %llu searches, %llu nodes\n", n_auxmap_L2_searches, n_auxmap_L2_nodes ); @@ -7444,7 +7444,7 @@ static void mc_print_stats (void) max_shmem_szB = sizeof(primary_map) + max_SMs_szB + max_secVBit_szB; VG_(message)(Vg_DebugMsg, - " memcheck: max sec V bit nodes: %d (%ldk, %ldM)\n", + " memcheck: max sec V bit nodes: %d (%luk, %luM)\n", max_secVBit_nodes, max_secVBit_szB / 1024, max_secVBit_szB / (1024 * 1024)); VG_(message)(Vg_DebugMsg, @@ -7452,7 +7452,7 @@ static void mc_print_stats (void) sec_vbits_new_nodes + sec_vbits_updates, sec_vbits_new_nodes, sec_vbits_updates ); VG_(message)(Vg_DebugMsg, - " memcheck: max shadow mem size: %ldk, %ldM\n", + " memcheck: max shadow mem size: %luk, %luM\n", max_shmem_szB / 1024, max_shmem_szB / (1024 * 1024)); if (MC_(clo_mc_level) >= 3) { @@ -7472,8 +7472,8 @@ static void mc_print_stats (void) stats_ocacheL1_found_at_N, stats_ocacheL1_movefwds ); VG_(message)(Vg_DebugMsg, - " ocacheL1: %'12lu sizeB %'12u useful\n", - (UWord)sizeof(OCache), + " ocacheL1: %'12lu sizeB %'12d useful\n", + (SizeT)sizeof(OCache), 4 * OC_W32S_PER_LINE * OC_LINES_PER_SET * OC_N_SETS ); VG_(message)(Vg_DebugMsg, " ocacheL2: %'12lu refs %'12lu misses\n", diff --git a/memcheck/mc_malloc_wrappers.c b/memcheck/mc_malloc_wrappers.c index 630c9c7e15..778f07d26a 100644 --- a/memcheck/mc_malloc_wrappers.c +++ b/memcheck/mc_malloc_wrappers.c @@ -680,7 +680,7 @@ void MC_(create_mempool)(Addr pool, UInt rzB, Bool is_zeroed) MC_Mempool* mp; if (VG_(clo_verbosity) > 2) { - VG_(message)(Vg_UserMsg, "create_mempool(0x%lx, %d, %d)\n", + VG_(message)(Vg_UserMsg, "create_mempool(0x%lx, %u, %d)\n", pool, rzB, is_zeroed); VG_(get_and_pp_StackTrace) (VG_(get_running_tid)(), MEMPOOL_DEBUG_STACKTRACE_DEPTH); @@ -779,7 +779,7 @@ check_mempool_sane(MC_Mempool* mp) } VG_(message)(Vg_UserMsg, - "Total mempools active: %d pools, %d chunks\n", + "Total mempools active: %u pools, %u chunks\n", total_pools, total_chunks); tick = 0; } @@ -792,7 +792,7 @@ check_mempool_sane(MC_Mempool* mp) for (i = 0; i < n_chunks-1; i++) { if (chunks[i]->data > chunks[i+1]->data) { VG_(message)(Vg_UserMsg, - "Mempool chunk %d / %d is out of order " + "Mempool chunk %u / %u is out of order " "wrt. its successor\n", i+1, n_chunks); bad = 1; @@ -803,7 +803,7 @@ check_mempool_sane(MC_Mempool* mp) for (i = 0; i < n_chunks-1; i++) { if (chunks[i]->data + chunks[i]->szB > chunks[i+1]->data ) { VG_(message)(Vg_UserMsg, - "Mempool chunk %d / %d overlaps with its successor\n", + "Mempool chunk %u / %u overlaps with its successor\n", i+1, n_chunks); bad = 1; } @@ -811,11 +811,11 @@ check_mempool_sane(MC_Mempool* mp) if (bad) { VG_(message)(Vg_UserMsg, - "Bad mempool (%d chunks), dumping chunks for inspection:\n", + "Bad mempool (%u chunks), dumping chunks for inspection:\n", n_chunks); for (i = 0; i < n_chunks; ++i) { VG_(message)(Vg_UserMsg, - "Mempool chunk %d / %d: %ld bytes " + "Mempool chunk %u / %u: %lu bytes " "[%lx,%lx), allocated:\n", i+1, n_chunks, @@ -834,7 +834,7 @@ void MC_(mempool_alloc)(ThreadId tid, Addr pool, Addr addr, SizeT szB) MC_Mempool* mp; if (VG_(clo_verbosity) > 2) { - VG_(message)(Vg_UserMsg, "mempool_alloc(0x%lx, 0x%lx, %ld)\n", + VG_(message)(Vg_UserMsg, "mempool_alloc(0x%lx, 0x%lx, %lu)\n", pool, addr, szB); VG_(get_and_pp_StackTrace) (tid, MEMPOOL_DEBUG_STACKTRACE_DEPTH); } @@ -884,7 +884,7 @@ void MC_(mempool_free)(Addr pool, Addr addr) if (VG_(clo_verbosity) > 2) { VG_(message)(Vg_UserMsg, - "mempool_free(0x%lx, 0x%lx) freed chunk of %ld bytes\n", + "mempool_free(0x%lx, 0x%lx) freed chunk of %lu bytes\n", pool, addr, mc->szB + 0UL); } @@ -902,7 +902,7 @@ void MC_(mempool_trim)(Addr pool, Addr addr, SizeT szB) VgHashNode** chunks; if (VG_(clo_verbosity) > 2) { - VG_(message)(Vg_UserMsg, "mempool_trim(0x%lx, 0x%lx, %ld)\n", + VG_(message)(Vg_UserMsg, "mempool_trim(0x%lx, 0x%lx, %lu)\n", pool, addr, szB); VG_(get_and_pp_StackTrace) (tid, MEMPOOL_DEBUG_STACKTRACE_DEPTH); } @@ -1036,7 +1036,7 @@ void MC_(mempool_change)(Addr pool, Addr addrA, Addr addrB, SizeT szB) ThreadId tid = VG_(get_running_tid)(); if (VG_(clo_verbosity) > 2) { - VG_(message)(Vg_UserMsg, "mempool_change(0x%lx, 0x%lx, 0x%lx, %ld)\n", + VG_(message)(Vg_UserMsg, "mempool_change(0x%lx, 0x%lx, 0x%lx, %lu)\n", pool, addrA, addrB, szB); VG_(get_and_pp_StackTrace) (tid, MEMPOOL_DEBUG_STACKTRACE_DEPTH); } -- 2.47.2