Skip to content

Commit ef11a41

Browse files
committed
[NFC][TSan] Tidy up DPrintf warnings in TSan runtime
Currently there are many `warning: format specifies type 'void *'` warnings when compiling TSan with debug output. This patch adds the `void *` casts where necessary to eliminate the warnings.
1 parent 3c98be4 commit ef11a41

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

compiler-rt/lib/tsan/rtl/tsan_fd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void FdAcquire(ThreadState *thr, uptr pc, int fd) {
180180
return;
181181
FdDesc *d = fddesc(thr, pc, fd);
182182
FdSync *s = d->sync;
183-
DPrintf("#%d: FdAcquire(%d) -> %p\n", thr->tid, fd, s);
183+
DPrintf("#%d: FdAcquire(%d) -> %p\n", thr->tid, fd, (void*)s);
184184
MemoryAccess(thr, pc, (uptr)d, 8, kAccessRead);
185185
if (s)
186186
Acquire(thr, pc, (uptr)s);
@@ -191,7 +191,7 @@ void FdRelease(ThreadState *thr, uptr pc, int fd) {
191191
return;
192192
FdDesc *d = fddesc(thr, pc, fd);
193193
FdSync *s = d->sync;
194-
DPrintf("#%d: FdRelease(%d) -> %p\n", thr->tid, fd, s);
194+
DPrintf("#%d: FdRelease(%d) -> %p\n", thr->tid, fd, (void*)s);
195195
MemoryAccess(thr, pc, (uptr)d, 8, kAccessRead);
196196
if (s)
197197
Release(thr, pc, (uptr)s);

compiler-rt/lib/tsan/rtl/tsan_rtl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static TracePart* TracePartAlloc(ThreadState* thr) {
8686
if (trace->parts_allocated == max_parts ||
8787
ctx->trace_part_finished_excess) {
8888
part = ctx->trace_part_recycle.PopFront();
89-
DPrintf("#%d: TracePartAlloc: part=%p\n", thr->tid, part);
89+
DPrintf("#%d: TracePartAlloc: part=%p\n", thr->tid, (void*)part);
9090
if (part && part->trace) {
9191
Trace* trace1 = part->trace;
9292
Lock trace_lock(&trace1->mtx);
@@ -938,7 +938,7 @@ static bool TraceSkipGap(ThreadState* thr) {
938938
DCHECK_EQ(reinterpret_cast<uptr>(pos + 1) & TracePart::kAlignment, 0);
939939
auto *part = trace->parts.Back();
940940
DPrintf("#%d: TraceSwitchPart enter trace=%p parts=%p-%p pos=%p\n", thr->tid,
941-
trace, trace->parts.Front(), part, pos);
941+
(void*)trace, (void*)trace->parts.Front(), (void*)part, (void*)pos);
942942
if (!part)
943943
return false;
944944
// We can get here when we still have space in the current trace part.
@@ -1052,7 +1052,7 @@ void TraceSwitchPartImpl(ThreadState* thr) {
10521052
ctx->trace_part_recycle.PushBack(recycle);
10531053
}
10541054
DPrintf("#%d: TraceSwitchPart exit parts=%p-%p pos=0x%zx\n", thr->tid,
1055-
trace->parts.Front(), trace->parts.Back(),
1055+
(void*)trace->parts.Front(), (void*)trace->parts.Back(),
10561056
atomic_load_relaxed(&thr->trace_pos));
10571057
}
10581058

compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ bool RestoreStack(EventType type, Sid sid, Epoch epoch, uptr addr, uptr size,
511511
Lock lock(&trace->mtx);
512512
first_part = trace->parts.Front();
513513
if (!first_part) {
514-
DPrintf2("RestoreStack: tid=%d trace=%p no trace parts\n", tid, trace);
514+
DPrintf2("RestoreStack: tid=%d trace=%p no trace parts\n", tid,
515+
(void*)trace);
515516
return false;
516517
}
517518
last_part = trace->parts.Back();
@@ -527,7 +528,7 @@ bool RestoreStack(EventType type, Sid sid, Epoch epoch, uptr addr, uptr size,
527528
bool is_atomic = typ & kAccessAtomic;
528529
bool is_free = typ & kAccessFree;
529530
DPrintf2("RestoreStack: tid=%d parts=[%p-%p] last_pos=%p\n", tid,
530-
trace->parts.Front(), last_part, last_pos);
531+
(void*)trace->parts.Front(), (void*)last_part, (void*)last_pos);
531532
TraceReplay(
532533
trace, last_part, last_pos, sid, epoch,
533534
[&](Sid ev_sid, Epoch ev_epoch, Event *evp) {

0 commit comments

Comments
 (0)