This PR fixes a number of warnings when building on Windows.
A common one involves the use of dispatch_assert() and related macros. Passing a pointer to these macros produces a narrowing conversion on Windows because long is 32 bits. This change uses intptr_t instead.
The following warnings are also resolved:
S:\SourceCache\swift-corelibs-libdispatch\src/shims/time.h(266,24): warning: comparison of integers of different signs: 'dispatch_time_t' (aka 'unsigned long long') and 'int' [-Wsign-compare]
actual_value = time == DISPATCH_WALLTIME_NOW ?
~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~
S:\SourceCache\swift-corelibs-libdispatch\src\init.c(1153,11): warning: comparison of integers of different signs: 'int' and 'unsigned long long' [-Wsign-compare]
len = MIN(len, sizeof(szMessage) - 1);
^ ~~~ ~~~~~~~~~~~~~~~~~~~~~
S:\SourceCache\swift-corelibs-libdispatch\src\source.c(1405,4): warning: format specifies type 'unsigned int' but the argument has type 'dispatch_unote_ident_t' (aka 'unsigned long long') [-Wformat]
dr->du_ident, dr->du_fflags, (unsigned long long)dr->ds_pending_data,
^~~~~~~~~~~~
S:\SourceCache\swift-corelibs-libdispatch\src\queue.c(776,39): warning: cast to smaller integer type 'dispatch_invoke_flags_t' from 'void *' [-Wvoid-pointer-to-enum-cast]
dispatch_invoke_flags_t ctxt_flags = (dispatch_invoke_flags_t)dc->dc_ctxt;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
S:\SourceCache\swift-corelibs-libdispatch\src\queue.c(7019,1): warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
^
^~~~~~~~~
S:\SourceCache\swift-corelibs-libdispatch\src\event\event.c(801,2): warning: format specifies type 'unsigned int' but the argument has type 'dispatch_unote_ident_t' (aka 'unsigned long long') [-Wformat]
_dispatch_timer_du_debug("disarmed", dt);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
S:\SourceCache\swift-corelibs-libdispatch\src\event\workqueue.c(229,59): warning: format specifies type 'unsigned int' but the argument has type 'dispatch_tid' (aka 'unsigned long') [-Wformat]
_dispatch_debug("workq: unable to open thread %u: %u", tid, GetLastError());
~~ ^~~
%lu
This PR fixes a number of warnings when building on Windows.
A common one involves the use of
dispatch_assert()
and related macros. Passing a pointer to these macros produces a narrowing conversion on Windows becauselong
is 32 bits. This change usesintptr_t
instead.The following warnings are also resolved: