Skip to content

Commit cfd2fc6

Browse files
committed
dispatch: make assertions LLP64 friendly (NFCI)
Use `long long` rather than `long` for the value being asserted. This is important as there are many places where we use the assertions on pointer values, which would be truncated on a LLP64 environment. This helps clean up the warning spew on Windows.
1 parent d49bcfa commit cfd2fc6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/internal.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -587,23 +587,23 @@ void _dispatch_log(const char *msg, ...);
587587
*/
588588
DISPATCH_ALWAYS_INLINE
589589
static inline void
590-
_dispatch_assert(long e, size_t line) DISPATCH_STATIC_ASSERT_IF(!e)
590+
_dispatch_assert(long long e, size_t line) DISPATCH_STATIC_ASSERT_IF(!e)
591591
{
592592
if (unlikely(DISPATCH_DEBUG && !e)) _dispatch_abort(line, e);
593593
}
594-
#define dispatch_assert(e) _dispatch_assert((long)(e), __LINE__)
594+
#define dispatch_assert(e) _dispatch_assert((long long)(e), __LINE__)
595595

596596
/*
597597
* A lot of API return zero upon success and not-zero on fail. Let's capture
598598
* and log the non-zero value
599599
*/
600600
DISPATCH_ALWAYS_INLINE
601601
static inline void
602-
_dispatch_assert_zero(long e, size_t line) DISPATCH_STATIC_ASSERT_IF(e)
602+
_dispatch_assert_zero(long long e, size_t line) DISPATCH_STATIC_ASSERT_IF(e)
603603
{
604604
if (unlikely(DISPATCH_DEBUG && e)) _dispatch_abort(line, e);
605605
}
606-
#define dispatch_assert_zero(e) _dispatch_assert_zero((long)(e), __LINE__)
606+
#define dispatch_assert_zero(e) _dispatch_assert_zero((long long)(e), __LINE__)
607607

608608
/*
609609
* For reporting bugs or impedance mismatches between libdispatch and external
@@ -613,12 +613,12 @@ _dispatch_assert_zero(long e, size_t line) DISPATCH_STATIC_ASSERT_IF(e)
613613
*/
614614
DISPATCH_ALWAYS_INLINE
615615
static inline void
616-
_dispatch_assume(long e, size_t line) DISPATCH_STATIC_ASSERT_IF(!e)
616+
_dispatch_assume(long long e, size_t line) DISPATCH_STATIC_ASSERT_IF(!e)
617617
{
618618
if (unlikely(!e)) _dispatch_bug(line, e);
619619
}
620620
#define dispatch_assume(e) \
621-
({ __typeof__(e) _e = (e); _dispatch_assume((long)_e, __LINE__); _e; })
621+
({ __typeof__(e) _e = (e); _dispatch_assume((long long)_e, __LINE__); _e; })
622622

623623
/*
624624
* A lot of API return zero upon success and not-zero on fail. Let's capture

0 commit comments

Comments
 (0)