Skip to content

Commit 8263124

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 8263124

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-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/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void);
295295
#include <io.h>
296296
#include <crtdbg.h>
297297
#endif
298+
#include <inttypes.h>
298299

299300
#if defined(__GNUC__) || defined(__clang__)
300301
#define DISPATCH_NOINLINE __attribute__((__noinline__))

src/io.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,11 +2568,11 @@ static size_t
25682568
_dispatch_io_debug_attr(dispatch_io_t channel, char* buf, size_t bufsiz)
25692569
{
25702570
dispatch_queue_t target = channel->do_targetq;
2571-
return dsnprintf(buf, bufsiz, "type = %s, fd = 0x%x, %sfd_entry = %p, "
2571+
return dsnprintf(buf, bufsiz, "type = %s, fd = 0x%" PRIxPTR ", %sfd_entry = %p, "
25722572
"queue = %p, target = %s[%p], barrier_queue = %p, barrier_group = "
25732573
"%p, err = 0x%x, low = 0x%zx, high = 0x%zx, interval%s = %llu ",
25742574
channel->params.type == DISPATCH_IO_STREAM ? "stream" : "random",
2575-
channel->fd_actual, channel->atomic_flags & DIO_STOPPED ?
2575+
(intptr_t)channel->fd_actual, channel->atomic_flags & DIO_STOPPED ?
25762576
"stopped, " : channel->atomic_flags & DIO_CLOSED ? "closed, " : "",
25772577
channel->fd_entry, channel->queue, target && target->dq_label ?
25782578
target->dq_label : "", target, channel->barrier_queue,
@@ -2601,13 +2601,13 @@ _dispatch_operation_debug_attr(dispatch_operation_t op, char* buf,
26012601
{
26022602
dispatch_queue_t target = op->do_targetq;
26032603
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, "
2604+
return dsnprintf(buf, bufsiz, "type = %s %s, fd = 0x%" PRIxPTR ", fd_entry = %p, "
26052605
"channel = %p, queue = %p -> %s[%p], target = %s[%p], "
26062606
"offset = %lld, length = %zu, done = %zu, undelivered = %zu, "
26072607
"flags = %u, err = 0x%x, low = 0x%zx, high = 0x%zx, "
26082608
"interval%s = %llu ", op->params.type == DISPATCH_IO_STREAM ?
26092609
"stream" : "random", op->direction == DOP_DIR_READ ? "read" :
2610-
"write", op->fd_entry ? op->fd_entry->fd : -1, op->fd_entry,
2610+
"write", (intptr_t)(op->fd_entry ? op->fd_entry->fd : -1), op->fd_entry,
26112611
op->channel, op->op_q, oqtarget && oqtarget->dq_label ?
26122612
oqtarget->dq_label : "", oqtarget, target && target->dq_label ?
26132613
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ _dispatch_semaphore_debug(dispatch_object_t dou, char *buf, size_t bufsiz)
8787
dsema->dsema_sema);
8888
#endif
8989
offset += dsnprintf(&buf[offset], bufsiz - offset,
90-
"value = %ld, orig = %ld }", dsema->dsema_value, dsema->dsema_orig);
90+
"value = %" PRId64 ", orig = %" PRId64 " }", dsema->dsema_value, dsema->dsema_orig);
9191
return offset;
9292
}
9393

@@ -272,7 +272,7 @@ _dispatch_group_debug(dispatch_object_t dou, char *buf, size_t bufsiz)
272272
dg->dg_sema);
273273
#endif
274274
offset += dsnprintf(&buf[offset], bufsiz - offset,
275-
"count = %ld, waiters = %d }", dg->dg_value, dg->dg_waiters);
275+
"count = %" PRId64 ", waiters = %d }", dg->dg_value, dg->dg_waiters);
276276
return offset;
277277
}
278278

0 commit comments

Comments
 (0)