2929#include "protocolServer.h"
3030#endif
3131
32+ #ifdef __linux__
33+ // The clang compiler in Ubuntu 18.04 has a bug that causes it to crash
34+ // when compiling _dispatch_bug_kevent_vanished(). As a workaround, use a
35+ // less capable version of this function on Linux until a fixed version
36+ // of the compiler is available.
37+ #define RDAR_49023449 1
38+ #endif // __linux__
39+
3240#pragma mark -
3341#pragma mark dispatch_init
3442
@@ -955,6 +963,7 @@ _dispatch_continuation_get_function_symbol(dispatch_continuation_t dc)
955963 return dc -> dc_func ;
956964}
957965
966+ #if HAVE_MACH
958967void
959968_dispatch_bug_kevent_client (const char * msg , const char * filter ,
960969 const char * operation , int err , uint64_t ident , uint64_t udata ,
@@ -998,6 +1007,23 @@ _dispatch_bug_kevent_client(const char *msg, const char *filter,
9981007 msg , strerror (err ), err , udata , filter , ident , ident , func );
9991008 }
10001009}
1010+ #endif // HAVE_MACH
1011+
1012+ #if RDAR_49023449
1013+
1014+ // The clang compiler on Ubuntu18.04 crashes when compiling the full version of
1015+ // this function. This reduced version avoids the crash but logs less useful
1016+ // information.
1017+ void
1018+ _dispatch_bug_kevent_vanished (dispatch_unote_t du )
1019+ {
1020+ _dispatch_log_fault ("LIBDISPATCH_STRICT: _dispatch_bug_kevent_vanished" ,
1021+ "BUG in libdispatch client: %s, monitored resource vanished before "
1022+ "the source cancel handler was invoked" ,
1023+ dux_type (du ._du )-> dst_kind );
1024+ }
1025+
1026+ #else // RDAR_49023449
10011027
10021028void
10031029_dispatch_bug_kevent_vanished (dispatch_unote_t du )
@@ -1012,7 +1038,7 @@ _dispatch_bug_kevent_vanished(dispatch_unote_t du)
10121038 dc = du ._dr -> ds_handler [DS_EVENT_HANDLER ];
10131039 if (dc ) func = _dispatch_continuation_get_function_symbol (dc );
10141040 break ;
1015- #if HAVE_MACH
1041+ #if HAVE_MACH
10161042 case DISPATCH_MACH_CHANNEL_TYPE :
10171043 func = du ._dmrr -> dmrr_handler_func ;
10181044 break ;
@@ -1027,6 +1053,8 @@ _dispatch_bug_kevent_vanished(dispatch_unote_t du)
10271053 du ._du -> du_ident , du ._du -> du_ident , func );
10281054}
10291055
1056+ #endif // RDAR_49023449
1057+
10301058DISPATCH_NOINLINE DISPATCH_WEAK
10311059void
10321060_dispatch_bug_deprecated (const char * msg )
0 commit comments