Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15495 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_barrier.c b/drd/drd_barrier.c
index 24bec96..12cb7e9 100644
--- a/drd/drd_barrier.c
+++ b/drd/drd_barrier.c
@@ -259,11 +259,11 @@
 
    if (s_trace_barrier) {
       if (reinitialization)
-         DRD_(trace_msg)("[%d] barrier_reinit    %s 0x%lx count %ld -> %ld",
+         DRD_(trace_msg)("[%u] barrier_reinit    %s 0x%lx count %ld -> %ld",
                          DRD_(thread_get_running_tid)(),
                          barrier_get_typename(p), barrier, p->count, count);
       else
-         DRD_(trace_msg)("[%d] barrier_init      %s 0x%lx",
+         DRD_(trace_msg)("[%u] barrier_init      %s 0x%lx",
                          DRD_(thread_get_running_tid)(),
                          barrier_get_typename(p),
                          barrier);
@@ -293,7 +293,7 @@
    p = DRD_(barrier_get)(barrier);
 
    if (s_trace_barrier)
-      DRD_(trace_msg)("[%d] barrier_destroy   %s 0x%lx",
+      DRD_(trace_msg)("[%u] barrier_destroy   %s 0x%lx",
                       DRD_(thread_get_running_tid)(),
                       barrier_get_typename(p), barrier);
 
@@ -352,7 +352,7 @@
    tl_assert(p);
 
    if (s_trace_barrier)
-      DRD_(trace_msg)("[%d] barrier_pre_wait  %s 0x%lx iteration %ld",
+      DRD_(trace_msg)("[%u] barrier_pre_wait  %s 0x%lx iteration %ld",
                       DRD_(thread_get_running_tid)(),
                       barrier_get_typename(p), barrier, p->pre_iteration);
 
@@ -413,7 +413,7 @@
    p = DRD_(barrier_get)(barrier);
 
    if (s_trace_barrier)
-      DRD_(trace_msg)("[%d] barrier_post_wait %s 0x%lx iteration %ld%s",
+      DRD_(trace_msg)("[%u] barrier_post_wait %s 0x%lx iteration %ld%s",
                       tid, p ? barrier_get_typename(p) : "(?)",
                       barrier, p ? p->post_iteration : -1,
                       serializing ? " (serializing)" : "");
diff --git a/drd/drd_clientobj.c b/drd/drd_clientobj.c
index 44234f9..66c1f10 100644
--- a/drd/drd_clientobj.c
+++ b/drd/drd_clientobj.c
@@ -132,7 +132,7 @@
    tl_assert(VG_(OSetGen_Lookup)(s_clientobj_set, &a1) == 0);
 
    if (s_trace_clientobj)
-      DRD_(trace_msg)("Adding client object 0x%lx of type %d", a1, t);
+     DRD_(trace_msg)("Adding client object 0x%lx of type %d", a1, (Int)t);
 
    p = VG_(OSetGen_AllocNode)(s_clientobj_set, sizeof(*p));
    VG_(memset)(p, 0, sizeof(*p));
@@ -179,7 +179,7 @@
 
    if (s_trace_clientobj) {
       DRD_(trace_msg)("Removing client object 0x%lx of type %d", p->any.a1,
-                      p->any.type);
+                      (Int)p->any.type);
 #if 0
       VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(),
                                  VG_(clo_backtrace_size));
diff --git a/drd/drd_cond.c b/drd/drd_cond.c
index bcdef30..ccab081 100644
--- a/drd/drd_cond.c
+++ b/drd/drd_cond.c
@@ -147,7 +147,7 @@
    struct cond_info* p;
 
    if (DRD_(s_trace_cond))
-      DRD_(trace_msg)("[%d] cond_init       cond 0x%lx",
+      DRD_(trace_msg)("[%u] cond_init       cond 0x%lx",
                       DRD_(thread_get_running_tid)(), cond);
 
    p = DRD_(cond_get)(cond);
@@ -170,7 +170,7 @@
    struct cond_info* p;
 
    if (DRD_(s_trace_cond))
-      DRD_(trace_msg)("[%d] cond_destroy    cond 0x%lx",
+      DRD_(trace_msg)("[%u] cond_destroy    cond 0x%lx",
                       DRD_(thread_get_running_tid)(), cond);
 
    p = DRD_(cond_get)(cond);
@@ -210,7 +210,7 @@
    struct mutex_info* q;
 
    if (DRD_(s_trace_cond))
-      DRD_(trace_msg)("[%d] cond_pre_wait   cond 0x%lx",
+      DRD_(trace_msg)("[%u] cond_pre_wait   cond 0x%lx",
                       DRD_(thread_get_running_tid)(), cond);
 
    p = cond_get_or_allocate(cond);
@@ -271,7 +271,7 @@
    struct cond_info* p;
 
    if (DRD_(s_trace_cond))
-      DRD_(trace_msg)("[%d] cond_post_wait  cond 0x%lx",
+      DRD_(trace_msg)("[%u] cond_post_wait  cond 0x%lx",
                       DRD_(thread_get_running_tid)(), cond);
 
    p = DRD_(cond_get)(cond);
@@ -352,7 +352,7 @@
 
    p = DRD_(cond_get)(cond);
    if (DRD_(s_trace_cond))
-      DRD_(trace_msg)("[%d] cond_signal     cond 0x%lx",
+      DRD_(trace_msg)("[%u] cond_signal     cond 0x%lx",
                       DRD_(thread_get_running_tid)(), cond);
 
    tl_assert(DRD_(pthread_cond_initializer));
@@ -375,7 +375,7 @@
    struct cond_info* p;
 
    if (DRD_(s_trace_cond))
-      DRD_(trace_msg)("[%d] cond_broadcast  cond 0x%lx",
+      DRD_(trace_msg)("[%u] cond_broadcast  cond 0x%lx",
                       DRD_(thread_get_running_tid)(), cond);
 
    p = DRD_(cond_get)(cond);
diff --git a/drd/drd_error.c b/drd/drd_error.c
index eb92689..fd963df 100644
--- a/drd/drd_error.c
+++ b/drd/drd_error.c
@@ -199,7 +199,7 @@
       describe_malloced_addr(dri->addr, &ai);
    }
 
-   print_err_detail("%sConflicting %s by thread %d at 0x%08lx size %ld%s\n",
+   print_err_detail("%sConflicting %s by thread %u at 0x%08lx size %lu%s\n",
                     what_prefix, dri->access_type == eStore ? "store" : "load",
                     dri->tid, dri->addr, dri->size, what_suffix);
 
@@ -316,7 +316,7 @@
       MutexErrInfo* p = (MutexErrInfo*)(VG_(get_error_extra)(e));
       tl_assert(p);
       if (p->recursion_count >= 0) {
-         print_err_detail("%s%s: mutex 0x%lx, recursion count %d, owner %d."
+         print_err_detail("%s%s: mutex 0x%lx, recursion count %d, owner %u."
                           "%s\n", what_prefix, VG_(get_error_string)(e),
                           p->mutex, p->recursion_count, p->owner, what_suffix);
       } else {
@@ -337,7 +337,7 @@
    }
    case CondDestrErr: {
       CondDestrErrInfo* cdi = (CondDestrErrInfo*)(VG_(get_error_extra)(e));
-      print_err_detail("%s%s: cond 0x%lx, mutex 0x%lx locked by thread %d%s\n",
+      print_err_detail("%s%s: cond 0x%lx, mutex 0x%lx locked by thread %u%s\n",
                        what_prefix, VG_(get_error_string)(e), cdi->cond,
                        cdi->mutex, cdi->owner, what_suffix);
       VG_(pp_ExeContext)(VG_(get_error_where)(e));
@@ -384,7 +384,7 @@
       if (bei->other_context) {
          if (xml)
             print_err_detail("  <confl_wait_call>\n");
-         print_err_detail("%sConflicting wait call by thread %d:%s\n",
+         print_err_detail("%sConflicting wait call by thread %u:%s\n",
                           what_prefix, bei->other_tid, what_suffix);
          VG_(pp_ExeContext)(bei->other_context);
          if (xml)
@@ -413,8 +413,8 @@
       VG_(pp_ExeContext)(p->acquired_at);
       if (xml)
          print_err_detail("  </acquired_at>\n");
-      print_err_detail("%sLock on %s 0x%lx was held during %d ms"
-                       " (threshold: %d ms).%s\n", what_prefix,
+      print_err_detail("%sLock on %s 0x%lx was held during %u ms"
+                       " (threshold: %u ms).%s\n", what_prefix,
                        VG_(get_error_string)(e), p->synchronization_object,
                        p->hold_time_ms, p->threshold_ms, what_suffix);
       VG_(pp_ExeContext)(VG_(get_error_where)(e));
diff --git a/drd/drd_hb.c b/drd/drd_hb.c
index aeb9ded..d4ea6d3 100644
--- a/drd/drd_hb.c
+++ b/drd/drd_hb.c
@@ -164,7 +164,7 @@
 
    p = DRD_(hb_get_or_allocate)(hb);
    if (DRD_(s_trace_hb))
-      DRD_(trace_msg)("[%d] happens_before 0x%lx",
+      DRD_(trace_msg)("[%u] happens_before 0x%lx",
                       DRD_(thread_get_running_tid)(), hb);
 
    if (!p)
@@ -198,7 +198,7 @@
    p = DRD_(hb_get_or_allocate)(hb);
 
    if (DRD_(s_trace_hb))
-      DRD_(trace_msg)("[%d] happens_after  0x%lx",
+      DRD_(trace_msg)("[%u] happens_after  0x%lx",
                       DRD_(thread_get_running_tid)(), hb);
 
    if (!p)
@@ -230,7 +230,7 @@
    struct hb_info* p;
 
    if (DRD_(s_trace_hb))
-      DRD_(trace_msg)("[%d] happens_done  0x%lx",
+      DRD_(trace_msg)("[%u] happens_done  0x%lx",
                       DRD_(thread_get_running_tid)(), hb);
 
    p = DRD_(hb_get)(hb);
diff --git a/drd/drd_load_store.c b/drd/drd_load_store.c
index 88e4d44..99be669 100644
--- a/drd/drd_load_store.c
+++ b/drd/drd_load_store.c
@@ -103,7 +103,7 @@
 
       vc = DRD_(vc_aprint)(DRD_(thread_get_vc)(DRD_(thread_get_running_tid)()));
       if (access_type == eStore && size <= sizeof(HWord)) {
-         DRD_(trace_msg_w_bt)("store 0x%lx size %ld val %ld/0x%lx (thread %d /"
+         DRD_(trace_msg_w_bt)("store 0x%lx size %lu val %lu/0x%lx (thread %u /"
                               " vc %s)", addr, size, stored_value_lo,
                               stored_value_lo, DRD_(thread_get_running_tid)(),
                               vc);
@@ -112,11 +112,11 @@
 
          tl_assert(sizeof(HWord) == 4);
          sv = ((ULong)stored_value_hi << 32) | stored_value_lo;
-         DRD_(trace_msg_w_bt)("store 0x%lx size %ld val %lld/0x%llx (thread %d"
+         DRD_(trace_msg_w_bt)("store 0x%lx size %lu val %llu/0x%llx (thread %u"
                               " / vc %s)", addr, size, sv, sv,
                               DRD_(thread_get_running_tid)(), vc);
       } else {
-         DRD_(trace_msg_w_bt)("%s 0x%lx size %ld (thread %d / vc %s)",
+         DRD_(trace_msg_w_bt)("%s 0x%lx size %lu (thread %u / vc %s)",
                               access_type == eLoad ? "load "
                               : access_type == eStore ? "store"
                               : access_type == eStart ? "start"
diff --git a/drd/drd_main.c b/drd/drd_main.c
index 504aa6a..d96256f 100644
--- a/drd/drd_main.c
+++ b/drd/drd_main.c
@@ -163,7 +163,7 @@
       DRD_(start_tracing_address_range)(addr, addr + 1, False);
    }
    if (ptrace_address) {
-      char *plus = VG_(strchr)(ptrace_address, '+');
+      HChar *plus = VG_(strchr)(ptrace_address, '+');
       Addr addr, length;
       if (plus)
          *plus = '\0';
@@ -339,7 +339,7 @@
    tl_assert(a1 <= a2);
 
    if (!is_stack_mem && s_trace_alloc)
-      DRD_(trace_msg)("Started using memory range 0x%lx + %ld%s",
+      DRD_(trace_msg)("Started using memory range 0x%lx + %lu%s",
                       a1, len, DRD_(running_thread_inside_pthread_create)()
                       ? " (inside pthread_create())" : "");
 
@@ -383,7 +383,7 @@
       DRD_(trace_mem_access)(a1, len, eEnd, 0, 0);
 
    if (!is_stack_mem && s_trace_alloc)
-      DRD_(trace_msg)("Stopped using memory range 0x%lx + %ld",
+      DRD_(trace_msg)("Stopped using memory range 0x%lx + %lu",
                       a1, len);
 
    if (!is_stack_mem || DRD_(get_check_stack_accesses)())
@@ -430,7 +430,7 @@
    const DebugInfo* di;
 
    if (trace_sectsuppr)
-      VG_(dmsg)("Evaluating range @ 0x%lx size %ld\n", a, len);
+      VG_(dmsg)("Evaluating range @ 0x%lx size %lu\n", a, len);
 
    for (di = VG_(next_DebugInfo)(0); di; di = VG_(next_DebugInfo)(di)) {
       Addr  avma;
@@ -451,7 +451,7 @@
       if (size > 0 &&
           VG_(strcmp)(VG_(DebugInfo_get_soname)(di), "libpthread.so.0") == 0) {
 	 if (trace_sectsuppr)
-	    VG_(dmsg)("Suppressing .bss @ 0x%lx size %ld\n", avma, size);
+	    VG_(dmsg)("Suppressing .bss @ 0x%lx size %lu\n", avma, size);
          tl_assert(VG_(DebugInfo_sect_kind)(NULL, avma) == Vg_SectBSS);
          DRD_(start_suppression)(avma, avma + size, ".bss");
       }
@@ -461,7 +461,7 @@
       tl_assert((avma && size) || (avma == 0 && size == 0));
       if (size > 0) {
 	 if (trace_sectsuppr)
-	    VG_(dmsg)("Suppressing .plt @ 0x%lx size %ld\n", avma, size);
+	    VG_(dmsg)("Suppressing .plt @ 0x%lx size %lu\n", avma, size);
          tl_assert(VG_(DebugInfo_sect_kind)(NULL, avma) == Vg_SectPLT);
          DRD_(start_suppression)(avma, avma + size, ".plt");
       }
@@ -471,7 +471,7 @@
       tl_assert((avma && size) || (avma == 0 && size == 0));
       if (size > 0) {
 	 if (trace_sectsuppr)
-	    VG_(dmsg)("Suppressing .got.plt @ 0x%lx size %ld\n", avma, size);
+	    VG_(dmsg)("Suppressing .got.plt @ 0x%lx size %lu\n", avma, size);
          tl_assert(VG_(DebugInfo_sect_kind)(NULL, avma) == Vg_SectGOTPLT);
          DRD_(start_suppression)(avma, avma + size, ".gotplt");
       }
@@ -481,7 +481,7 @@
       tl_assert((avma && size) || (avma == 0 && size == 0));
       if (size > 0) {
 	 if (trace_sectsuppr)
-	    VG_(dmsg)("Suppressing .got @ 0x%lx size %ld\n", avma, size);
+	    VG_(dmsg)("Suppressing .got @ 0x%lx size %lu\n", avma, size);
          tl_assert(VG_(DebugInfo_sect_kind)(NULL, avma) == Vg_SectGOT);
          DRD_(start_suppression)(avma, avma + size, ".got");
       }
@@ -643,7 +643,7 @@
    }
    if (DRD_(thread_get_trace_fork_join)())
    {
-      DRD_(trace_msg)("drd_pre_thread_create creator = %d, created = %d",
+      DRD_(trace_msg)("drd_pre_thread_create creator = %u, created = %u",
                       drd_creator, created);
    }
 }
@@ -668,7 +668,7 @@
 
    if (DRD_(thread_get_trace_fork_join)())
    {
-      DRD_(trace_msg)("drd_post_thread_create created = %d", drd_created);
+      DRD_(trace_msg)("drd_post_thread_create created = %u", drd_created);
    }
    if (! DRD_(get_check_stack_accesses)())
    {
@@ -695,7 +695,7 @@
    tl_assert(drd_tid != DRD_INVALID_THREADID);
    if (DRD_(thread_get_trace_fork_join)())
    {
-      DRD_(trace_msg)("drd_thread_finished tid = %d%s", drd_tid,
+      DRD_(trace_msg)("drd_thread_finished tid = %u%s", drd_tid,
                       DRD_(thread_get_joinable)(drd_tid)
                       ? "" : " (which is a detached thread)");
    }
@@ -705,8 +705,8 @@
          = (DRD_(thread_get_stack_max)(drd_tid)
             - DRD_(thread_get_stack_min_min)(drd_tid));
       VG_(message)(Vg_UserMsg,
-                   "thread %d%s finished and used %ld bytes out of %ld"
-                   " on its stack. Margin: %ld bytes.\n",
+                   "thread %u%s finished and used %lu bytes out of %lu"
+                   " on its stack. Margin: %lu bytes.\n",
                    drd_tid,
                    DRD_(thread_get_joinable)(drd_tid)
                    ? "" : " (which is a detached thread)",
@@ -774,47 +774,47 @@
       ULong pu_join   = DRD_(thread_get_update_conflict_set_join_count)();
 
       VG_(message)(Vg_UserMsg,
-                   "   thread: %lld context switches.\n",
+                   "   thread: %llu context switches.\n",
                    DRD_(thread_get_context_switch_count)());
       VG_(message)(Vg_UserMsg,
-                   "confl set: %lld full updates and %lld partial updates;\n",
+                   "confl set: %llu full updates and %llu partial updates;\n",
                    DRD_(thread_get_compute_conflict_set_count)(),
                    pu);
       VG_(message)(Vg_UserMsg,
-                   "           %lld partial updates during segment creation,\n",
+                   "           %llu partial updates during segment creation,\n",
                    pu_seg_cr);
       VG_(message)(Vg_UserMsg,
-                   "           %lld because of mutex/sema/cond.var. operations,\n",
+                   "           %llu because of mutex/sema/cond.var. operations,\n",
                    pu_mtx_cv);
       VG_(message)(Vg_UserMsg,
-                   "           %lld because of barrier/rwlock operations and\n",
+                   "           %llu because of barrier/rwlock operations and\n",
 		   pu - pu_seg_cr - pu_mtx_cv - pu_join);
       VG_(message)(Vg_UserMsg,
-                   "           %lld partial updates because of thread join"
+                   "           %llu partial updates because of thread join"
                    " operations.\n",
                    pu_join);
       VG_(message)(Vg_UserMsg,
-                   " segments: created %lld segments, max %lld alive,\n",
+                   " segments: created %llu segments, max %llu alive,\n",
                    DRD_(sg_get_segments_created_count)(),
                    DRD_(sg_get_max_segments_alive_count)());
       VG_(message)(Vg_UserMsg,
-                   "           %lld discard points and %lld merges.\n",
+                   "           %llu discard points and %llu merges.\n",
                    DRD_(thread_get_discard_ordered_segments_count)(),
                    DRD_(sg_get_segment_merge_count)());
       VG_(message)(Vg_UserMsg,
-                   "segmnt cr: %lld mutex, %lld rwlock, %lld semaphore and"
-                   " %lld barrier.\n",
+                   "segmnt cr: %llu mutex, %llu rwlock, %llu semaphore and"
+                   " %llu barrier.\n",
                    DRD_(get_mutex_segment_creation_count)(),
                    DRD_(get_rwlock_segment_creation_count)(),
                    DRD_(get_semaphore_segment_creation_count)(),
                    DRD_(get_barrier_segment_creation_count)());
       VG_(message)(Vg_UserMsg,
-                   "  bitmaps: %lld level one"
-                   " and %lld level two bitmaps were allocated.\n",
+                   "  bitmaps: %llu level one"
+                   " and %llu level two bitmaps were allocated.\n",
                    DRD_(bm_get_bitmap_creation_count)(),
                    DRD_(bm_get_bitmap2_creation_count)());
       VG_(message)(Vg_UserMsg,
-                   "    mutex: %lld non-recursive lock/unlock events.\n",
+                   "    mutex: %llu non-recursive lock/unlock events.\n",
                    DRD_(get_mutex_lock_count)());
       DRD_(print_malloc_stats)();
    }
diff --git a/drd/drd_mutex.c b/drd/drd_mutex.c
index 6500006..c7f5364 100644
--- a/drd/drd_mutex.c
+++ b/drd/drd_mutex.c
@@ -88,7 +88,7 @@
    struct mutex_info* p = DRD_(mutex_get)(mutex);
 
    if (s_trace_mutex)
-      DRD_(trace_msg)("[%d] mutex_ignore_ordering %s 0x%lx",
+      DRD_(trace_msg)("[%u] mutex_ignore_ordering %s 0x%lx",
                       DRD_(thread_get_running_tid)(),
                       p ? DRD_(mutex_type_name)(p->mutex_type) : "(?)",
                       mutex);
@@ -106,7 +106,7 @@
    tl_assert(p);
 
    if (s_trace_mutex)
-      DRD_(trace_msg)("[%d] mutex_destroy   %s 0x%lx rc %d owner %d",
+      DRD_(trace_msg)("[%u] mutex_destroy   %s 0x%lx rc %d owner %u",
                       DRD_(thread_get_running_tid)(),
                       DRD_(mutex_get_typename)(p), p->a1,
                       p ? p->recursion_count : -1,
@@ -197,7 +197,7 @@
    struct mutex_info* p;
 
    if (s_trace_mutex)
-      DRD_(trace_msg)("[%d] mutex_init      %s 0x%lx",
+      DRD_(trace_msg)("[%u] mutex_init      %s 0x%lx",
                       DRD_(thread_get_running_tid)(),
                       DRD_(mutex_type_name)(mutex_type),
                       mutex);
@@ -258,7 +258,7 @@
       mutex_type = p->mutex_type;
 
    if (s_trace_mutex)
-      DRD_(trace_msg)("[%d] %s %s 0x%lx rc %d owner %d",
+      DRD_(trace_msg)("[%u] %s %s 0x%lx rc %d owner %u",
                       DRD_(thread_get_running_tid)(),
                       trylock ? "pre_mutex_lock " : "mutex_trylock  ",
                       p ? DRD_(mutex_get_typename)(p) : "(?)",
@@ -308,7 +308,7 @@
    p = DRD_(mutex_get)(mutex);
 
    if (s_trace_mutex)
-      DRD_(trace_msg)("[%d] %s %s 0x%lx rc %d owner %d%s",
+      DRD_(trace_msg)("[%u] %s %s 0x%lx rc %d owner %u%s",
                       drd_tid,
                       post_cond_wait ? "cond_post_wait " : "post_mutex_lock",
                       p ? DRD_(mutex_get_typename)(p) : "(?)",
@@ -374,7 +374,7 @@
       mutex_type = p->mutex_type;
 
    if (s_trace_mutex) {
-      DRD_(trace_msg)("[%d] mutex_unlock    %s 0x%lx rc %d",
+      DRD_(trace_msg)("[%u] mutex_unlock    %s 0x%lx rc %d",
                       drd_tid, p ? DRD_(mutex_get_typename)(p) : "(?)",
                       mutex, p ? p->recursion_count : 0);
    }
diff --git a/drd/drd_rwlock.c b/drd/drd_rwlock.c
index db589a0..04bae05 100644
--- a/drd/drd_rwlock.c
+++ b/drd/drd_rwlock.c
@@ -244,7 +244,7 @@
    tl_assert(p);
 
    if (DRD_(s_trace_rwlock))
-      DRD_(trace_msg)("[%d] rwlock_destroy     0x%lx",
+      DRD_(trace_msg)("[%u] rwlock_destroy     0x%lx",
                       DRD_(thread_get_running_tid)(), p->a1);
 
    if (DRD_(rwlock_is_locked)(p))
@@ -313,7 +313,7 @@
    struct rwlock_info* p;
 
    if (DRD_(s_trace_rwlock))
-      DRD_(trace_msg)("[%d] rwlock_init        0x%lx",
+      DRD_(trace_msg)("[%u] rwlock_init        0x%lx",
                       DRD_(thread_get_running_tid)(), rwlock);
 
    p = DRD_(rwlock_get)(rwlock);
@@ -374,7 +374,7 @@
    struct rwlock_info* p;
 
    if (DRD_(s_trace_rwlock))
-      DRD_(trace_msg)("[%d] pre_rwlock_rdlock  0x%lx",
+      DRD_(trace_msg)("[%u] pre_rwlock_rdlock  0x%lx",
                       DRD_(thread_get_running_tid)(), rwlock);
 
    p = DRD_(rwlock_get_or_allocate)(rwlock, rwlock_type);
@@ -403,7 +403,7 @@
    struct rwlock_thread_info* q;
 
    if (DRD_(s_trace_rwlock))
-      DRD_(trace_msg)("[%d] post_rwlock_rdlock 0x%lx", drd_tid, rwlock);
+      DRD_(trace_msg)("[%u] post_rwlock_rdlock 0x%lx", drd_tid, rwlock);
 
    p = DRD_(rwlock_get)(rwlock);
 
@@ -437,7 +437,7 @@
    p = DRD_(rwlock_get)(rwlock);
 
    if (DRD_(s_trace_rwlock))
-      DRD_(trace_msg)("[%d] pre_rwlock_wrlock  0x%lx",
+      DRD_(trace_msg)("[%u] pre_rwlock_wrlock  0x%lx",
                       DRD_(thread_get_running_tid)(), rwlock);
 
    if (p == 0)
@@ -471,7 +471,7 @@
    p = DRD_(rwlock_get)(rwlock);
 
    if (DRD_(s_trace_rwlock))
-      DRD_(trace_msg)("[%d] post_rwlock_wrlock 0x%lx", drd_tid, rwlock);
+      DRD_(trace_msg)("[%u] post_rwlock_wrlock 0x%lx", drd_tid, rwlock);
 
    if (! p || ! took_lock)
       return;
@@ -506,7 +506,7 @@
    struct rwlock_thread_info* q;
 
    if (DRD_(s_trace_rwlock))
-      DRD_(trace_msg)("[%d] rwlock_unlock      0x%lx", drd_tid, rwlock);
+      DRD_(trace_msg)("[%u] rwlock_unlock      0x%lx", drd_tid, rwlock);
 
    p = DRD_(rwlock_get)(rwlock);
    if (p == 0)
diff --git a/drd/drd_segment.c b/drd/drd_segment.c
index a625f47..8b4aa4c 100644
--- a/drd/drd_segment.c
+++ b/drd/drd_segment.c
@@ -97,7 +97,7 @@
       HChar* vc;
 
       vc = DRD_(vc_aprint)(&sg->vc);
-      VG_(message)(Vg_DebugMsg, "New segment for thread %d with vc %s\n",
+      VG_(message)(Vg_DebugMsg, "New segment for thread %u with vc %s\n",
                    created, vc);
       VG_(free)(vc);
    }
diff --git a/drd/drd_semaphore.c b/drd/drd_semaphore.c
index 90d4609..ef729cc 100644
--- a/drd/drd_semaphore.c
+++ b/drd/drd_semaphore.c
@@ -174,7 +174,7 @@
    Segment* sg;
 
    if (s_trace_semaphore)
-      DRD_(trace_msg)("[%d] sem_init      0x%lx value %u",
+      DRD_(trace_msg)("[%u] sem_init      0x%lx value %u",
                       DRD_(thread_get_running_tid)(), semaphore, value);
 
    p = semaphore_get(semaphore);
@@ -222,7 +222,7 @@
    p = semaphore_get(semaphore);
 
    if (s_trace_semaphore)
-      DRD_(trace_msg)("[%d] sem_destroy   0x%lx value %u",
+      DRD_(trace_msg)("[%u] sem_destroy   0x%lx value %u",
                       DRD_(thread_get_running_tid)(), semaphore,
                       p ? p->value : 0);
 
@@ -252,10 +252,10 @@
    Segment* sg;
 
    if (s_trace_semaphore)
-      DRD_(trace_msg)("[%d] sem_open      0x%lx name %s"
+      DRD_(trace_msg)("[%u] sem_open      0x%lx name %s"
                       " oflag %#lx mode %#lo value %u",
                       DRD_(thread_get_running_tid)(),
-                      semaphore, name, oflag, mode, value);
+                      semaphore, name, (UWord)oflag, (UWord)mode, value);
 
    /* Return if the sem_open() call failed. */
    if (! semaphore)
@@ -295,7 +295,7 @@
    p = semaphore_get(semaphore);
 
    if (s_trace_semaphore)
-      DRD_(trace_msg)("[%d] sem_close     0x%lx value %u",
+      DRD_(trace_msg)("[%u] sem_close     0x%lx value %u",
                       DRD_(thread_get_running_tid)(), semaphore,
                       p ? p->value : 0);
 
@@ -350,7 +350,7 @@
    tl_assert(waited == 0 || waited == 1);
    p = semaphore_get(semaphore);
    if (s_trace_semaphore)
-      DRD_(trace_msg)("[%d] sem_wait      0x%lx value %u -> %u%s",
+      DRD_(trace_msg)("[%u] sem_wait      0x%lx value %u -> %u%s",
                       DRD_(thread_get_running_tid)(), semaphore,
                       p ? p->value : 0, p ? p->value - waited : 0,
 		      waited ? "" : " (did not wait)");
@@ -409,7 +409,7 @@
    p->value++;
 
    if (s_trace_semaphore)
-      DRD_(trace_msg)("[%d] sem_post      0x%lx value %u -> %u",
+      DRD_(trace_msg)("[%u] sem_post      0x%lx value %u -> %u",
                       DRD_(thread_get_running_tid)(),
                       semaphore, p->value - 1, p->value);
 
diff --git a/drd/drd_suppression.c b/drd/drd_suppression.c
index 6d88434..ef6d186 100644
--- a/drd/drd_suppression.c
+++ b/drd/drd_suppression.c
@@ -63,7 +63,7 @@
                              const HChar* const reason)
 {
    if (s_trace_suppression)
-      VG_(message)(Vg_DebugMsg, "start suppression of 0x%lx sz %ld (%s)\n",
+      VG_(message)(Vg_DebugMsg, "start suppression of 0x%lx sz %lu (%s)\n",
                    a1, a2 - a1, reason);
 
    tl_assert(a1 <= a2);
@@ -73,7 +73,7 @@
 void DRD_(finish_suppression)(const Addr a1, const Addr a2)
 {
    if (s_trace_suppression) {
-      VG_(message)(Vg_DebugMsg, "finish suppression of 0x%lx sz %ld\n",
+      VG_(message)(Vg_DebugMsg, "finish suppression of 0x%lx sz %lu\n",
                    a1, a2 - a1);
       VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(), 12);
    }
@@ -122,7 +122,7 @@
    tl_assert(a1 <= a2);
 
    if (s_trace_suppression)
-      VG_(message)(Vg_DebugMsg, "start_tracing(0x%lx, %ld) %s\n",
+      VG_(message)(Vg_DebugMsg, "start_tracing(0x%lx, %lu) %s\n",
                    a1, a2 - a1, persistent ? "persistent" : "non-persistent");
 
    DRD_(bm_access_range_load)(s_traced, a1, a2);
@@ -140,7 +140,7 @@
    tl_assert(a1 <= a2);
 
    if (s_trace_suppression)
-      VG_(message)(Vg_DebugMsg, "stop_tracing(0x%lx, %ld)\n",
+      VG_(message)(Vg_DebugMsg, "stop_tracing(0x%lx, %lu)\n",
                    a1, a2 - a1);
 
    if (DRD_(g_any_address_traced)) {
@@ -165,7 +165,7 @@
       for (b = a1; b < a2; b++) {
          if (DRD_(bm_has_1)(s_suppressed, b, eStore)) {
             VG_(message)(Vg_DebugMsg,
-                         "stop_using_mem(0x%lx, %ld) finish suppression of"
+                         "stop_using_mem(0x%lx, %lu) finish suppression of"
                          " 0x%lx\n", a1, a2 - a1, b);
          }
       }
diff --git a/drd/drd_thread.c b/drd/drd_thread.c
index f0f39f8..f1e8b27 100644
--- a/drd/drd_thread.c
+++ b/drd/drd_thread.c
@@ -408,7 +408,7 @@
       msg = VG_(malloc)("drd.main.dptj.1", msg_size);
 
       VG_(snprintf)(msg, msg_size,
-                    "drd_post_thread_join joiner = %d, joinee = %d",
+                    "drd_post_thread_join joiner = %u, joinee = %u",
                     drd_joiner, drd_joinee);
       if (joiner)
       {
@@ -595,7 +595,7 @@
    tl_assert(DRD_(g_threadinfo)[tid].pt_threadid != INVALID_POSIX_THREADID);
 
    if (DRD_(thread_get_trace_fork_join)())
-      DRD_(trace_msg)("[%d] drd_thread_pre_cancel %d",
+      DRD_(trace_msg)("[%u] drd_thread_pre_cancel %u",
                       DRD_(g_drd_running_tid), tid);
 }
 
@@ -730,12 +730,12 @@
    if (name == NULL || name[0] == 0)
       VG_(snprintf)(DRD_(g_threadinfo)[tid].name,
                     sizeof(DRD_(g_threadinfo)[tid].name),
-                    "Thread %d",
+                    "Thread %u",
                     tid);
    else
       VG_(snprintf)(DRD_(g_threadinfo)[tid].name,
                     sizeof(DRD_(g_threadinfo)[tid].name),
-                    "Thread %d (%s)",
+                    "Thread %u (%s)",
                     tid, name);
    DRD_(g_threadinfo)[tid].name[sizeof(DRD_(g_threadinfo)[tid].name) - 1] = 0;
 }
@@ -774,7 +774,7 @@
           && DRD_(g_drd_running_tid) != DRD_INVALID_THREADID)
       {
          VG_(message)(Vg_DebugMsg,
-                      "Context switch from thread %d to thread %d;"
+                      "Context switch from thread %u to thread %u;"
                       " segments: %llu\n",
                       DRD_(g_drd_running_tid), drd_tid,
                       DRD_(sg_get_segments_alive_count)());
@@ -1221,7 +1221,7 @@
          HChar *str1, *str2;
          str1 = DRD_(vc_aprint)(&old_vc);
          str2 = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid));
-         VG_(message)(Vg_DebugMsg, "thread %d: vc %s -> %s\n", tid, str1, str2);
+         VG_(message)(Vg_DebugMsg, "thread %u: vc %s -> %s\n", tid, str1, str2);
          VG_(free)(str1);
          VG_(free)(str2);
       }
@@ -1304,7 +1304,7 @@
  */
 void DRD_(thread_print_all)(void)
 {
-   unsigned i;
+   UInt i;
    Segment* p;
 
    for (i = 0; i < DRD_N_THREADS; i++)
@@ -1312,7 +1312,7 @@
       p = DRD_(g_threadinfo)[i].sg_first;
       if (p) {
          VG_(printf)("**************\n"
-                     "* thread %3d (%d/%d/%d/%d/0x%lx/%d) *\n"
+                     "* thread %3u (%d/%u/%u/%u/0x%lx/%d) *\n"
                      "**************\n",
                      i,
                      DRD_(g_threadinfo)[i].valid,
@@ -1381,14 +1381,14 @@
                      VG_(printf_xml)("  <other_segment_start>\n");
                   else
                      VG_(message)(Vg_UserMsg,
-                                  "Other segment start (thread %d)\n", i);
+                                  "Other segment start (thread %u)\n", i);
                   show_call_stack(i, q->stacktrace);
                   if (VG_(clo_xml))
                      VG_(printf_xml)("  </other_segment_start>\n"
                                      "  <other_segment_end>\n");
                   else
                      VG_(message)(Vg_UserMsg,
-                                  "Other segment end (thread %d)\n", i);
+                                  "Other segment end (thread %u)\n", i);
                   q_next = q->thr_next;
                   show_call_stack(i, q_next ? q_next->stacktrace : 0);
                   if (VG_(clo_xml))
@@ -1477,7 +1477,7 @@
 
       str = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid));
       VG_(message)(Vg_DebugMsg,
-                   "computing conflict set for thread %d with vc %s\n",
+                   "computing conflict set for thread %u with vc %s\n",
                    tid, str);
       VG_(free)(str);
    }
@@ -1490,7 +1490,7 @@
          HChar* vc;
 
          vc = DRD_(vc_aprint)(&p->vc);
-         VG_(message)(Vg_DebugMsg, "conflict set: thread [%d] at vc %s\n",
+         VG_(message)(Vg_DebugMsg, "conflict set: thread [%u] at vc %s\n",
                       tid, vc);
          VG_(free)(vc);
       }
@@ -1507,7 +1507,7 @@
 
                      str = DRD_(vc_aprint)(&q->vc);
                      VG_(message)(Vg_DebugMsg,
-                                  "conflict set: [%d] merging segment %s\n",
+                                  "conflict set: [%u] merging segment %s\n",
                                   j, str);
                      VG_(free)(str);
                   }
@@ -1518,7 +1518,7 @@
 
                      str = DRD_(vc_aprint)(&q->vc);
                      VG_(message)(Vg_DebugMsg,
-                                  "conflict set: [%d] ignoring segment %s\n",
+                                  "conflict set: [%u] ignoring segment %s\n",
                                   j, str);
                      VG_(free)(str);
                   }
@@ -1534,9 +1534,9 @@
       += DRD_(bm_get_bitmap2_creation_count)();
 
    if (s_trace_conflict_set_bm) {
-      VG_(message)(Vg_DebugMsg, "[%d] new conflict set:\n", tid);
+      VG_(message)(Vg_DebugMsg, "[%u] new conflict set:\n", tid);
       DRD_(bm_print)(*conflict_set);
-      VG_(message)(Vg_DebugMsg, "[%d] end of new conflict set.\n", tid);
+      VG_(message)(Vg_DebugMsg, "[%u] end of new conflict set.\n", tid);
    }
 }
 
@@ -1563,7 +1563,7 @@
 
       str = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid));
       VG_(message)(Vg_DebugMsg,
-                   "updating conflict set for thread %d with vc %s\n",
+                   "updating conflict set for thread %u with vc %s\n",
                    tid, str);
       VG_(free)(str);
    }
@@ -1593,7 +1593,7 @@
 
             str = DRD_(vc_aprint)(&q->vc);
             VG_(message)(Vg_DebugMsg,
-                         "conflict set: [%d] %s segment %s\n", j,
+                         "conflict set: [%u] %s segment %s\n", j,
                          included_in_old_conflict_set
                          != included_in_new_conflict_set
                          ? "merging" : "ignoring", str);
@@ -1615,7 +1615,7 @@
 
             str = DRD_(vc_aprint)(&q->vc);
             VG_(message)(Vg_DebugMsg,
-                         "conflict set: [%d] %s segment %s\n", j,
+                         "conflict set: [%u] %s segment %s\n", j,
                          included_in_old_conflict_set
                          != included_in_new_conflict_set
                          ? "merging" : "ignoring", str);
@@ -1647,9 +1647,9 @@
 
    if (s_trace_conflict_set_bm)
    {
-      VG_(message)(Vg_DebugMsg, "[%d] updated conflict set:\n", tid);
+      VG_(message)(Vg_DebugMsg, "[%u] updated conflict set:\n", tid);
       DRD_(bm_print)(DRD_(g_conflict_set));
-      VG_(message)(Vg_DebugMsg, "[%d] end of updated conflict set.\n", tid);
+      VG_(message)(Vg_DebugMsg, "[%u] end of updated conflict set.\n", tid);
    }
 
    tl_assert(thread_conflict_set_up_to_date(DRD_(g_drd_running_tid)));
diff --git a/drd/drd_vc.c b/drd/drd_vc.c
index 0da3b4e..edde023 100644
--- a/drd/drd_vc.c
+++ b/drd/drd_vc.c
@@ -277,7 +277,7 @@
             return str;
       }
       size += VG_(snprintf)(str + size, reserved - size,
-                            "%s %d: %d", i > 0 ? "," : "",
+                            "%s %u: %u", i > 0 ? "," : "",
                             vc->vc[i].threadid, vc->vc[i].count);
    }
    size += VG_(snprintf)(str + size, reserved - size, " ]");