Skip to content

Commit 2a07a65

Browse files
committed
libdispatch: clean up some Win64 warnings
This cleans up the few warnings that remain when building libdispatch. It now builds clean of warnings with clang 8.
1 parent 619775e commit 2a07a65

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

src/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ _dispatch_logv_init(void *context DISPATCH_UNUSED)
709709
char path[MAX_PATH + 1] = {0};
710710
DWORD dwLength = GetTempPathA(MAX_PATH, path);
711711
dispatch_assert(dwLength <= MAX_PATH + 1);
712-
snprintf(&path[dwLength], MAX_PATH - dwLength, "libdispatch.%d.log",
712+
snprintf(&path[dwLength], MAX_PATH - dwLength, "libdispatch.%lu.log",
713713
GetCurrentProcessId());
714714
dispatch_logfile = _open(path, O_WRONLY | O_APPEND | O_CREAT, 0666);
715715
#else

src/io.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121
#include "internal.h"
22+
#include <inttypes.h>
2223

2324
#ifndef DISPATCH_IO_DEBUG
2425
#define DISPATCH_IO_DEBUG DISPATCH_DEBUG
@@ -2568,11 +2569,11 @@ static size_t
25682569
_dispatch_io_debug_attr(dispatch_io_t channel, char* buf, size_t bufsiz)
25692570
{
25702571
dispatch_queue_t target = channel->do_targetq;
2571-
return dsnprintf(buf, bufsiz, "type = %s, fd = 0x%x, %sfd_entry = %p, "
2572+
return dsnprintf(buf, bufsiz, "type = %s, fd = 0x%" PRIxPTR ", %sfd_entry = %p, "
25722573
"queue = %p, target = %s[%p], barrier_queue = %p, barrier_group = "
25732574
"%p, err = 0x%x, low = 0x%zx, high = 0x%zx, interval%s = %llu ",
25742575
channel->params.type == DISPATCH_IO_STREAM ? "stream" : "random",
2575-
channel->fd_actual, channel->atomic_flags & DIO_STOPPED ?
2576+
(intptr_t)channel->fd_actual, channel->atomic_flags & DIO_STOPPED ?
25762577
"stopped, " : channel->atomic_flags & DIO_CLOSED ? "closed, " : "",
25772578
channel->fd_entry, channel->queue, target && target->dq_label ?
25782579
target->dq_label : "", target, channel->barrier_queue,
@@ -2601,13 +2602,13 @@ _dispatch_operation_debug_attr(dispatch_operation_t op, char* buf,
26012602
{
26022603
dispatch_queue_t target = op->do_targetq;
26032604
dispatch_queue_t oqtarget = op->op_q ? op->op_q->do_targetq : NULL;
2604-
return dsnprintf(buf, bufsiz, "type = %s %s, fd = 0x%x, fd_entry = %p, "
2605+
return dsnprintf(buf, bufsiz, "type = %s %s, fd = 0x%" PRIxPTR ", fd_entry = %p, "
26052606
"channel = %p, queue = %p -> %s[%p], target = %s[%p], "
26062607
"offset = %lld, length = %zu, done = %zu, undelivered = %zu, "
26072608
"flags = %u, err = 0x%x, low = 0x%zx, high = 0x%zx, "
26082609
"interval%s = %llu ", op->params.type == DISPATCH_IO_STREAM ?
26092610
"stream" : "random", op->direction == DOP_DIR_READ ? "read" :
2610-
"write", op->fd_entry ? op->fd_entry->fd : -1, op->fd_entry,
2611+
"write", (intptr_t)(op->fd_entry ? op->fd_entry->fd : -1), op->fd_entry,
26112612
op->channel, op->op_q, oqtarget && oqtarget->dq_label ?
26122613
oqtarget->dq_label : "", oqtarget, target && target->dq_label ?
26132614
target->dq_label : "", target, (long long)op->offset, op->length,

src/queue.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6435,7 +6435,9 @@ _dispatch_sig_thread(void *ctxt DISPATCH_UNUSED)
64356435
{
64366436
// never returns, so burn bridges behind us
64376437
_dispatch_clear_stack(0);
6438-
#if !defined(_WIN32)
6438+
#if defined(_WIN32)
6439+
for (;;) SuspendThread(GetCurrentThread());
6440+
#else
64396441
_dispatch_sigsuspend();
64406442
#endif
64416443
}

src/semaphore.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121
#include "internal.h"
22+
#include <inttypes.h>
2223

2324
DISPATCH_WEAK // rdar://problem/8503746
2425
intptr_t _dispatch_semaphore_signal_slow(dispatch_semaphore_t dsema);
@@ -87,7 +88,7 @@ _dispatch_semaphore_debug(dispatch_object_t dou, char *buf, size_t bufsiz)
8788
dsema->dsema_sema);
8889
#endif
8990
offset += dsnprintf(&buf[offset], bufsiz - offset,
90-
"value = %ld, orig = %ld }", dsema->dsema_value, dsema->dsema_orig);
91+
"value = %" PRId64 ", orig = %" PRId64 " }", dsema->dsema_value, dsema->dsema_orig);
9192
return offset;
9293
}
9394

@@ -272,7 +273,7 @@ _dispatch_group_debug(dispatch_object_t dou, char *buf, size_t bufsiz)
272273
dg->dg_sema);
273274
#endif
274275
offset += dsnprintf(&buf[offset], bufsiz - offset,
275-
"count = %ld, waiters = %d }", dg->dg_value, dg->dg_waiters);
276+
"count = %" PRId64 ", waiters = %d }", dg->dg_value, dg->dg_waiters);
276277
return offset;
277278
}
278279

0 commit comments

Comments
 (0)