Skip to content

Commit d9a4b9b

Browse files
committed
simplify preprocessor checks
Linux, FreeBSD already define DISPATCH_COCOA_COMPAT, and Windows was defining that in a couple of places in an unstructured haphazard manner. Define it similarly and clean up the other sites.
1 parent b9b338c commit d9a4b9b

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

private/private.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,13 @@ void _dispatch_prohibit_transition_to_multithreaded(bool prohibit);
176176

177177
#if TARGET_OS_MAC
178178
#define DISPATCH_COCOA_COMPAT 1
179-
#elif defined(__linux__) || defined(__FreeBSD__)
179+
#elif defined(__linux__) || defined(__FreeBSD__) || defined(_WIN32)
180180
#define DISPATCH_COCOA_COMPAT 1
181181
#else
182182
#define DISPATCH_COCOA_COMPAT 0
183183
#endif
184184

185-
#if DISPATCH_COCOA_COMPAT || defined(_WIN32)
185+
#if DISPATCH_COCOA_COMPAT
186186

187187
#define DISPATCH_CF_SPI_VERSION 20160712
188188

@@ -263,7 +263,7 @@ API_AVAILABLE(macos(10.6), ios(4.0))
263263
DISPATCH_EXPORT
264264
void (*_Nullable _dispatch_end_NSAutoReleasePool)(void *);
265265

266-
#endif /* DISPATCH_COCOA_COMPAT || defined(_WIN32) */
266+
#endif /* DISPATCH_COCOA_COMPAT */
267267

268268
API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0))
269269
DISPATCH_EXPORT DISPATCH_NOTHROW

src/queue.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,10 @@ _dispatch_worker_thread_thunk(LPVOID lpParameter);
9393
#endif
9494
#endif
9595

96-
#if DISPATCH_COCOA_COMPAT || defined(_WIN32)
97-
static dispatch_once_t _dispatch_main_q_handle_pred;
98-
#endif
9996
#if DISPATCH_COCOA_COMPAT
97+
static dispatch_once_t _dispatch_main_q_handle_pred;
10098
static void _dispatch_runloop_queue_poke(dispatch_queue_t dq,
10199
dispatch_qos_t qos, dispatch_wakeup_flags_t flags);
102-
#endif
103-
#if DISPATCH_COCOA_COMPAT || defined(_WIN32)
104100
static void _dispatch_runloop_queue_handle_init(void *ctxt);
105101
static void _dispatch_runloop_queue_handle_dispose(dispatch_queue_t dq);
106102
#endif
@@ -4480,7 +4476,7 @@ _dispatch_queue_wakeup(dispatch_queue_t dq, dispatch_qos_t qos,
44804476
return _dispatch_queue_class_wakeup(dq, qos, flags, target);
44814477
}
44824478

4483-
#if DISPATCH_COCOA_COMPAT || defined(_WIN32)
4479+
#if DISPATCH_COCOA_COMPAT
44844480
DISPATCH_ALWAYS_INLINE
44854481
static inline bool
44864482
_dispatch_runloop_handle_is_valid(dispatch_runloop_handle_t handle)
@@ -5122,7 +5118,7 @@ _dispatch_queue_serial_drain(dispatch_queue_t dq, dispatch_invoke_context_t dic,
51225118
return _dispatch_queue_drain(dq, dic, flags, owned, true);
51235119
}
51245120

5125-
#if DISPATCH_COCOA_COMPAT || defined(_WIN32)
5121+
#if DISPATCH_COCOA_COMPAT
51265122
DISPATCH_NOINLINE
51275123
static void
51285124
_dispatch_main_queue_update_priority_from_thread(void)
@@ -6188,7 +6184,7 @@ _dispatch_network_root_queue_create_4NW(const char *label,
61886184

61896185
static bool _dispatch_program_is_probably_callback_driven;
61906186

6191-
#if DISPATCH_COCOA_COMPAT || defined(_WIN32)
6187+
#if DISPATCH_COCOA_COMPAT
61926188

61936189
dispatch_queue_t
61946190
_dispatch_runloop_root_queue_create_4CF(const char *label, unsigned long flags)

0 commit comments

Comments
 (0)