Skip to content

Commit ed2329c

Browse files
compnerdrokhinip
authored andcommitted
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. Signed-off-by: Kim Topley <ktopley@apple.com>
1 parent bac98b0 commit ed2329c

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
@@ -1087,7 +1087,7 @@ _dispatch_logv_init(void *context DISPATCH_UNUSED)
10871087
char path[MAX_PATH + 1] = {0};
10881088
DWORD dwLength = GetTempPathA(MAX_PATH, path);
10891089
dispatch_assert(dwLength <= MAX_PATH + 1);
1090-
snprintf(&path[dwLength], MAX_PATH - dwLength, "libdispatch.%d.log",
1090+
snprintf(&path[dwLength], MAX_PATH - dwLength, "libdispatch.%lu.log",
10911091
GetCurrentProcessId());
10921092
dispatch_logfile = _open(path, O_WRONLY | O_APPEND | O_CREAT, 0666);
10931093
#else

src/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ upcast(dispatch_object_t dou)
289289
#include <sys/mman.h>
290290
#include <netinet/in.h>
291291
#endif
292+
#include <inttypes.h>
292293

293294
#ifdef __BLOCKS__
294295
#if __has_include(<Block_private.h>)

src/io.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2561,11 +2561,11 @@ static size_t
25612561
_dispatch_io_debug_attr(dispatch_io_t channel, char* buf, size_t bufsiz)
25622562
{
25632563
dispatch_queue_t target = channel->do_targetq;
2564-
return dsnprintf(buf, bufsiz, "type = %s, fd = 0x%x, %sfd_entry = %p, "
2564+
return dsnprintf(buf, bufsiz, "type = %s, fd = 0x%" PRIxPTR ", %sfd_entry = %p, "
25652565
"queue = %p, target = %s[%p], barrier_queue = %p, barrier_group = "
25662566
"%p, err = 0x%x, low = 0x%zx, high = 0x%zx, interval%s = %llu ",
25672567
channel->params.type == DISPATCH_IO_STREAM ? "stream" : "random",
2568-
channel->fd_actual, channel->atomic_flags & DIO_STOPPED ?
2568+
(intptr_t)channel->fd_actual, channel->atomic_flags & DIO_STOPPED ?
25692569
"stopped, " : channel->atomic_flags & DIO_CLOSED ? "closed, " : "",
25702570
channel->fd_entry, channel->queue, target && target->dq_label ?
25712571
target->dq_label : "", target, channel->barrier_queue,
@@ -2595,13 +2595,13 @@ _dispatch_operation_debug_attr(dispatch_operation_t op, char* buf,
25952595
{
25962596
dispatch_queue_t target = op->do_targetq;
25972597
dispatch_queue_t oqtarget = op->op_q ? op->op_q->do_targetq : NULL;
2598-
return dsnprintf(buf, bufsiz, "type = %s %s, fd = 0x%x, fd_entry = %p, "
2598+
return dsnprintf(buf, bufsiz, "type = %s %s, fd = 0x%" PRIxPTR ", fd_entry = %p, "
25992599
"channel = %p, queue = %p -> %s[%p], target = %s[%p], "
26002600
"offset = %lld, length = %zu, done = %zu, undelivered = %zu, "
26012601
"flags = %u, err = 0x%x, low = 0x%zx, high = 0x%zx, "
26022602
"interval%s = %llu ", op->params.type == DISPATCH_IO_STREAM ?
26032603
"stream" : "random", op->direction == DOP_DIR_READ ? "read" :
2604-
"write", op->fd_entry ? op->fd_entry->fd : -1, op->fd_entry,
2604+
"write", (intptr_t)(op->fd_entry ? op->fd_entry->fd : -1), op->fd_entry,
26052605
op->channel, op->op_q, oqtarget && oqtarget->dq_label ?
26062606
oqtarget->dq_label : "", oqtarget, target && target->dq_label ?
26072607
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
@@ -7452,7 +7452,9 @@ _dispatch_sig_thread(void *ctxt DISPATCH_UNUSED)
74527452
{
74537453
// never returns, so burn bridges behind us
74547454
_dispatch_clear_stack(0);
7455-
#if !defined(_WIN32)
7455+
#if defined(_WIN32)
7456+
for (;;) SuspendThread(GetCurrentThread());
7457+
#else
74567458
_dispatch_sigsuspend();
74577459
#endif
74587460
}

src/semaphore.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ _dispatch_semaphore_debug(dispatch_object_t dou, char *buf, size_t bufsiz)
7676
dsema->dsema_sema);
7777
#endif
7878
offset += dsnprintf(&buf[offset], bufsiz - offset,
79-
"value = %ld, orig = %ld }", dsema->dsema_value, dsema->dsema_orig);
79+
"value = %" PRId64 ", orig = %" PRId64 " }", dsema->dsema_value, dsema->dsema_orig);
8080
return offset;
8181
}
8282

@@ -198,7 +198,7 @@ _dispatch_group_debug(dispatch_object_t dou, char *buf, size_t bufsiz)
198198
_dispatch_object_class_name(dg), dg);
199199
offset += _dispatch_object_debug_attr(dg, &buf[offset], bufsiz - offset);
200200
offset += dsnprintf(&buf[offset], bufsiz - offset,
201-
"count = %d, gen = %d, waiters = %d, notifs = %d }",
201+
"count = %"PRIu32", gen = %"PRIu32", waiters = %d, notifs = %d }",
202202
_dg_state_value(dg_state), _dg_state_gen(dg_state),
203203
(bool)(dg_state & DISPATCH_GROUP_HAS_WAITERS),
204204
(bool)(dg_state & DISPATCH_GROUP_HAS_NOTIFS));

0 commit comments

Comments
 (0)