Backport of swiftlang/swift-corelibs-libdispatch commit d545f73a3986 ("Fix unused-but-set-global error"), which is not yet in the tpoechtrager/apple-libdispatch fork we build. Clang 23 rejects the Linux build with -Werror,-Wunused-but-set-global because this global is only read under #ifndef __linux__. Fork PR: https://github.com/tpoechtrager/apple-libdispatch/pull/2 diff --git a/src/queue.c b/src/queue.c --- a/src/queue.c +++ b/src/queue.c @@ -6546,7 +6546,9 @@ _dispatch_pthread_root_queue_dispose(dispatch_queue_global_t dq, #pragma mark - #pragma mark dispatch_runloop_queue +#ifndef __linux__ DISPATCH_STATIC_GLOBAL(bool _dispatch_program_is_probably_callback_driven); +#endif #if DISPATCH_COCOA_COMPAT DISPATCH_STATIC_GLOBAL(dispatch_once_t _dispatch_main_q_handle_pred); @@ -6680,7 +6682,9 @@ _dispatch_runloop_queue_handle_init(void *ctxt) #endif _dispatch_runloop_queue_set_handle(dq, handle); +#ifndef __linux__ _dispatch_program_is_probably_callback_driven = true; +#endif } static void @@ -7148,7 +7152,9 @@ dispatch_main(void) if (pthread_main_np()) { #endif _dispatch_object_debug(&_dispatch_main_q, "%s", __func__); +#ifndef __linux__ _dispatch_program_is_probably_callback_driven = true; +#endif _dispatch_ktrace0(ARIADNE_ENTER_DISPATCH_MAIN_CODE); #ifdef __linux__ // On Linux, if the main thread calls pthread_exit, the process becomes a zombie.