Skip to content

Commit cc9c82e

Browse files
committed
Incorporate feedback from Rokhini
1 parent e9d4041 commit cc9c82e

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

src/event/workqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ _dispatch_workq_count_runnable_workers(dispatch_workq_monitor_t mon)
226226
// and Socket IO, but it is unclear if that includes normal IO.
227227
HANDLE hThread = OpenThread(THREAD_QUERY_INFORMATION, FALSE, tid);
228228
if (hThread == NULL) {
229-
_dispatch_debug("workq: unable to open thread %u: %lu", tid, GetLastError());
229+
_dispatch_debug("workq: unable to open thread %lu: %lu", tid, GetLastError());
230230
continue;
231231
}
232232

src/init.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -931,15 +931,14 @@ _dispatch_fault(const char *reason, const char *fmt, ...)
931931
})
932932

933933
void
934-
_dispatch_bug(size_t line, intptr_t val)
934+
_dispatch_bug(size_t line, uintptr_t val)
935935
{
936936
dispatch_once_f(&_dispatch_build_pred, NULL, _dispatch_build_init);
937937

938938
if (_dispatch_bug_log_is_repeated()) return;
939939

940940
_dispatch_log("BUG in libdispatch: %s - %lu - 0x%llx",
941-
_dispatch_build, (unsigned long)line,
942-
(unsigned long long)(uintptr_t)val);
941+
_dispatch_build, (unsigned long)line, (unsigned long long)val);
943942
}
944943

945944
#if HAVE_MACH
@@ -1067,7 +1066,7 @@ _dispatch_bug_deprecated(const char *msg)
10671066
}
10681067

10691068
void
1070-
_dispatch_abort(size_t line, intptr_t val)
1069+
_dispatch_abort(size_t line, uintptr_t val)
10711070
{
10721071
_dispatch_bug(line, val);
10731072
abort();

src/internal.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void);
466466
extern uint8_t _dispatch_mode;
467467

468468
DISPATCH_EXPORT DISPATCH_NOINLINE DISPATCH_COLD
469-
void _dispatch_bug(size_t line, intptr_t val);
469+
void _dispatch_bug(size_t line, uintptr_t val);
470470

471471
#if HAVE_MACH
472472
DISPATCH_NOINLINE DISPATCH_COLD
@@ -489,7 +489,7 @@ DISPATCH_NOINLINE DISPATCH_COLD
489489
void _dispatch_bug_deprecated(const char *msg);
490490

491491
DISPATCH_NOINLINE DISPATCH_NORETURN DISPATCH_COLD
492-
void _dispatch_abort(size_t line, intptr_t val);
492+
void _dispatch_abort(size_t line, uintptr_t val);
493493

494494
#if !defined(DISPATCH_USE_OS_DEBUG_LOG) && DISPATCH_DEBUG
495495
#if __has_include(<os/debug_private.h>)
@@ -549,23 +549,23 @@ void _dispatch_log(const char *msg, ...);
549549
*/
550550
DISPATCH_ALWAYS_INLINE
551551
static inline void
552-
_dispatch_assert(intptr_t e, size_t line) DISPATCH_STATIC_ASSERT_IF(!e)
552+
_dispatch_assert(uintptr_t e, size_t line) DISPATCH_STATIC_ASSERT_IF(!e)
553553
{
554554
if (unlikely(DISPATCH_DEBUG && !e)) _dispatch_abort(line, e);
555555
}
556-
#define dispatch_assert(e) _dispatch_assert((intptr_t)(e), __LINE__)
556+
#define dispatch_assert(e) _dispatch_assert((uintptr_t)(e), __LINE__)
557557

558558
/*
559559
* A lot of API return zero upon success and not-zero on fail. Let's capture
560560
* and log the non-zero value
561561
*/
562562
DISPATCH_ALWAYS_INLINE
563563
static inline void
564-
_dispatch_assert_zero(intptr_t e, size_t line) DISPATCH_STATIC_ASSERT_IF(e)
564+
_dispatch_assert_zero(uintptr_t e, size_t line) DISPATCH_STATIC_ASSERT_IF(e)
565565
{
566566
if (unlikely(DISPATCH_DEBUG && e)) _dispatch_abort(line, e);
567567
}
568-
#define dispatch_assert_zero(e) _dispatch_assert_zero((intptr_t)(e), __LINE__)
568+
#define dispatch_assert_zero(e) _dispatch_assert_zero((uintptr_t)(e), __LINE__)
569569

570570
/*
571571
* For reporting bugs or impedance mismatches between libdispatch and external
@@ -575,25 +575,25 @@ _dispatch_assert_zero(intptr_t e, size_t line) DISPATCH_STATIC_ASSERT_IF(e)
575575
*/
576576
DISPATCH_ALWAYS_INLINE
577577
static inline void
578-
_dispatch_assume(intptr_t e, size_t line) DISPATCH_STATIC_ASSERT_IF(!e)
578+
_dispatch_assume(uintptr_t e, size_t line) DISPATCH_STATIC_ASSERT_IF(!e)
579579
{
580580
if (unlikely(!e)) _dispatch_bug(line, e);
581581
}
582582
#define dispatch_assume(e) \
583-
({ __typeof__(e) _e = (e); _dispatch_assume((intptr_t)_e, __LINE__); _e; })
583+
({ __typeof__(e) _e = (e); _dispatch_assume((uintptr_t)_e, __LINE__); _e; })
584584

585585
/*
586586
* A lot of API return zero upon success and not-zero on fail. Let's capture
587587
* and log the non-zero value
588588
*/
589589
DISPATCH_ALWAYS_INLINE
590590
static inline void
591-
_dispatch_assume_zero(intptr_t e, size_t line) DISPATCH_STATIC_ASSERT_IF(e)
591+
_dispatch_assume_zero(uintptr_t e, size_t line) DISPATCH_STATIC_ASSERT_IF(e)
592592
{
593593
if (unlikely(e)) _dispatch_bug(line, e);
594594
}
595595
#define dispatch_assume_zero(e) \
596-
({ __typeof__(e) _e = (e); _dispatch_assume_zero((intptr_t)_e, __LINE__); _e; })
596+
({ __typeof__(e) _e = (e); _dispatch_assume_zero((uintptr_t)_e, __LINE__); _e; })
597597

598598
/* Make sure the debug statments don't get too stale */
599599
#define _dispatch_debug(x, args...) do { \

src/shims/time.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ _dispatch_time_to_clock_and_value(dispatch_time_t time,
263263
if (time & DISPATCH_WALLTIME_MASK) {
264264
// Wall time (value 11 in bits 63, 62)
265265
*clock = DISPATCH_CLOCK_WALL;
266-
actual_value = time == (uint64_t)DISPATCH_WALLTIME_NOW ?
266+
actual_value = time == (dispatch_time_t)DISPATCH_WALLTIME_NOW ?
267267
_dispatch_get_nanoseconds() : (uint64_t)-time;
268268
} else {
269269
// Continuous time (value 10 in bits 63, 62).

0 commit comments

Comments
 (0)