Skip to content

Commit de97ea7

Browse files
authored
Merge pull request swiftlang#215 from apple/das-darwin-libdispatch-806-merge-master
Merge darwin/libdispatch-806 to master and apply Linux build fixes
2 parents cd12dcb + ff05109 commit de97ea7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+13751
-11292
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "libpwq"]
22
path = libpwq
33
url = https://github.com/mheily/libpwq.git
4-
[submodule "libkqueue"]
5-
path = libkqueue
6-
url = https://github.com/mheily/libkqueue.git

INSTALL.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ that includes libdispatch on Linux:
7070
```
7171
./swift/utils/build-toolchain local.swift
7272
```
73-
73+
7474
Note that adding libdispatch in build-presets.ini is for Linux only as Swift on macOS platforms uses the system installed libdispatch, so its not required.
75-
75+
7676
### Building and installing on OS X
7777
7878
The following configure options may be of general interest:
@@ -151,9 +151,9 @@ Note that libdispatch development and testing is done only
151151
on Ubuntu; currently supported versions are 14.04, 15.10 and 16.04.
152152
153153
1. The first thing to do is install required packages:
154-
154+
155155
`sudo apt-get install autoconf libtool pkg-config clang systemtap-sdt-dev libbsd-dev`
156-
156+
157157
Note: compiling libdispatch requires clang 3.8 or better and
158158
the gold linker. If the default clang on your Ubuntu version is
159159
too old, see http://apt.llvm.org/ to install a newer version.
@@ -168,7 +168,7 @@ to get the gold linker.
168168
git submodule init
169169
git submodule update
170170
```
171-
171+
172172
3. Build (as in the general instructions above)
173173
174174
```

Makefile.am

-5
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,13 @@ if BUILD_OWN_PTHREAD_WORKQUEUES
88
MAYBE_PTHREAD_WORKQUEUES = libpwq
99
endif
1010

11-
if BUILD_OWN_KQUEUES
12-
MAYBE_KQUEUES = libkqueue
13-
endif
14-
1511
if BUILD_TESTS
1612
MAYBE_TESTS = tests
1713
endif
1814

1915
SUBDIRS= \
2016
dispatch \
2117
$(MAYBE_PTHREAD_WORKQUEUES) \
22-
$(MAYBE_KQUEUES) \
2318
man \
2419
os \
2520
private \

PATCHES

+45
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,48 @@ github commits starting with 29bdc2f from
267267
[4d58038] APPLIED rdar://27600964
268268
[98d0a05] APPLIED rdar://27600964
269269
[8976101] APPLIED rdar://27600964
270+
[0d9ea5f] APPLIED rdar://28486911
271+
[e7e9a32] APPLIED rdar://28486911
272+
[44174d9] APPLIED rdar://28486911
273+
[6402cb7] APPLIED rdar://28486911
274+
[e2d5eb5] APPLIED rdar://28486911
275+
[758bb7f] APPLIED rdar://28486911
276+
[4c588e9] APPLIED rdar://28486911
277+
[1300d06] APPLIED rdar://28486911
278+
[ae1f7e8] APPLIED rdar://28486911
279+
[40a9bfb] APPLIED rdar://28486911
280+
[6366081] APPLIED rdar://28486911
281+
[81d1d0c] APPLIED rdar://28486911
282+
[5526122] APPLIED rdar://28486911
283+
[1a7ff3f] APPLIED rdar://28486911
284+
[e905735] APPLIED rdar://28486911
285+
[7fe8323] APPLIED rdar://28486911
286+
[6249878] APPLIED rdar://28486911
287+
[20792fe] APPLIED rdar://28486911
288+
[3639fbe] APPLIED rdar://28486911
289+
[bda3baf] APPLIED rdar://28486911
290+
[8803d07] APPLIED rdar://28486911
291+
[d04a0df] APPLIED rdar://28486911
292+
[69d2a6a] APPLIED rdar://28486911
293+
[367bd95] APPLIED rdar://28486911
294+
[152985f] APPLIED rdar://28486911
295+
[ba7802e] APPLIED rdar://28486911
296+
[92773e0] APPLIED rdar://30568673
297+
[548a1b9] APPLIED rdar://30568673
298+
[b628e5c] APPLIED rdar://30568673
299+
[a055ddb] APPLIED rdar://30568673
300+
[012f48b] APPLIED rdar://30568673
301+
[353adba] APPLIED rdar://30568673
302+
[eb730eb] APPLIED rdar://30568673
303+
[ac16fbb] APPLIED rdar://30568673
304+
[967876e] APPLIED rdar://30568673
305+
[44c2291] APPLIED rdar://30568673
306+
[ceb1fac] APPLIED rdar://30568673
307+
[c95febb] APPLIED rdar://30568673
308+
[b6e9cf4] APPLIED rdar://30568673
309+
[e199473] APPLIED rdar://30568673
310+
[3767ac7] APPLIED rdar://30568673
311+
[10eb0e4] APPLIED rdar://30568673
312+
[787dd92] APPLIED rdar://30568673
313+
[ba4cac5] APPLIED rdar://30568673
314+
[7974138] APPLIED rdar://30568673

config/config.h

+19
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55
you don't. */
66
#define HAVE_DECL_CLOCK_MONOTONIC 0
77

8+
/* Define to 1 if you have the declaration of `CLOCK_REALTIME', and to 0 if
9+
you don't. */
10+
#define CLOCK_REALTIME 0
11+
812
/* Define to 1 if you have the declaration of `CLOCK_UPTIME', and to 0 if you
913
don't. */
1014
#define HAVE_DECL_CLOCK_UPTIME 0
1115

16+
/* Define to 1 if you have the declaration of `HAVE_DECL_CLOCK_UPTIME_FAST',
17+
and to 0 if you don't. */
18+
#define HAVE_DECL_CLOCK_UPTIME_FAST 0
19+
1220
/* Define to 1 if you have the declaration of `FD_COPY', and to 0 if you
1321
don't. */
1422
#define HAVE_DECL_FD_COPY 1
@@ -57,6 +65,14 @@
5765
you don't. */
5866
#define HAVE_DECL_VQ_QUOTA 1
5967

68+
/* Define to 1 if you have the declaration of `VQ_NEARLOWDISK', and to 0 if
69+
you don't. */
70+
#define HAVE_DECL_VQ_NEARLOWDISK 1
71+
72+
/* Define to 1 if you have the declaration of `VQ_DESIRED_DISK', and to 0 if
73+
you don't. */
74+
#define HAVE_DECL_VQ_DESIRED_DISK 1
75+
6076
/* Define to 1 if you have the <dlfcn.h> header file. */
6177
#define HAVE_DLFCN_H 1
6278

@@ -87,6 +103,9 @@
87103
/* Define to 1 if you have the `mach_absolute_time' function. */
88104
#define HAVE_MACH_ABSOLUTE_TIME 1
89105

106+
/* Define to 1 if you have the `mach_approximate_time' function. */
107+
#define HAVE_MACH_APPROXIMATE_TIME 1
108+
90109
/* Define to 1 if you have the `mach_port_construct' function. */
91110
#define HAVE_MACH_PORT_CONSTRUCT 1
92111

configure.ac

+3-16
Original file line numberDiff line numberDiff line change
@@ -295,19 +295,6 @@ esac
295295
AC_SEARCH_LIBS(clock_gettime, rt)
296296
AC_SEARCH_LIBS(pthread_create, pthread)
297297

298-
AS_IF([test -f $srcdir/libkqueue/configure.ac],
299-
[AC_DEFINE(BUILD_OWN_KQUEUES, 1, [Define if building libkqueue from source])
300-
ac_configure_args="--disable-libkqueue-install $ac_configure_args"
301-
AC_CONFIG_SUBDIRS([libkqueue])
302-
build_own_kqueues=true],
303-
[build_own_kqueues=false
304-
AC_CHECK_HEADER(sys/event.h, [],
305-
[PKG_CHECK_MODULES(KQUEUE, libkqueue)]
306-
)
307-
]
308-
)
309-
AM_CONDITIONAL(BUILD_OWN_KQUEUES, $build_own_kqueues)
310-
311298
AC_CHECK_FUNCS([strlcpy getprogname], [],
312299
[PKG_CHECK_MODULES(BSD_OVERLAY, libbsd-overlay,[
313300
AC_DEFINE(HAVE_STRLCPY, 1, [])
@@ -423,15 +410,15 @@ AC_CHECK_FUNCS([mach_port_construct])
423410
#
424411
# Find functions and declarations we care about.
425412
#
426-
AC_CHECK_DECLS([CLOCK_UPTIME, CLOCK_MONOTONIC], [], [],
413+
AC_CHECK_DECLS([CLOCK_UPTIME, CLOCK_MONOTONIC, CLOCK_REALTIME, CLOCK_UPTIME_FAST], [], [],
427414
[[#include <time.h>]])
428415
AC_CHECK_DECLS([NOTE_NONE, NOTE_REAP, NOTE_REVOKE, NOTE_SIGNAL, NOTE_LOWAT], [], [],
429416
[[#include <sys/event.h>]])
430417
AC_CHECK_DECLS([FD_COPY], [], [], [[#include <sys/select.h>]])
431418
AC_CHECK_DECLS([SIGEMT], [], [], [[#include <signal.h>]])
432-
AC_CHECK_DECLS([VQ_UPDATE, VQ_VERYLOWDISK, VQ_QUOTA], [], [], [[#include <sys/mount.h>]])
419+
AC_CHECK_DECLS([VQ_UPDATE, VQ_VERYLOWDISK, VQ_QUOTA, VQ_NEARLOWDISK, VQ_DESIRED_DISK], [], [], [[#include <sys/mount.h>]])
433420
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
434-
AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf])
421+
AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time mach_approximate_time malloc_create_zone sysconf])
435422

436423
AC_CHECK_DECLS([POSIX_SPAWN_START_SUSPENDED],
437424
[have_posix_spawn_start_suspended=true], [have_posix_spawn_start_suspended=false],

dispatch/base.h

+13-4
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,14 @@
204204
#endif
205205

206206
#if __has_feature(enumerator_attributes)
207-
#define DISPATCH_ENUM_AVAILABLE_STARTING __OSX_AVAILABLE_STARTING
208-
#define DISPATCH_ENUM_AVAILABLE(os, version) __##os##_AVAILABLE(version)
207+
#define DISPATCH_ENUM_API_AVAILABLE(...) API_AVAILABLE(__VA_ARGS__)
208+
#define DISPATCH_ENUM_API_DEPRECATED(...) API_DEPRECATED(__VA_ARGS__)
209+
#define DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT(...) \
210+
API_DEPRECATED_WITH_REPLACEMENT(__VA_ARGS__)
209211
#else
210-
#define DISPATCH_ENUM_AVAILABLE_STARTING(...)
211-
#define DISPATCH_ENUM_AVAILABLE(...)
212+
#define DISPATCH_ENUM_API_AVAILABLE(...)
213+
#define DISPATCH_ENUM_API_DEPRECATED(...)
214+
#define DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT(...)
212215
#endif
213216

214217
#if defined(SWIFT_SDK_OVERLAY_DISPATCH_EPOCH) && \
@@ -243,6 +246,12 @@
243246
#define DISPATCH_SWIFT_NAME(_name)
244247
#endif
245248

249+
#ifndef __cplusplus
250+
#define DISPATCH_TRANSPARENT_UNION __attribute__((__transparent_union__))
251+
#else
252+
#define DISPATCH_TRANSPARENT_UNION
253+
#endif
254+
246255
typedef void (*dispatch_function_t)(void *_Nullable);
247256

248257
#endif

dispatch/block.h

+13-13
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ __BEGIN_DECLS
101101
*/
102102
DISPATCH_ENUM(dispatch_block_flags, unsigned long,
103103
DISPATCH_BLOCK_BARRIER
104-
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x1,
104+
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x1,
105105
DISPATCH_BLOCK_DETACHED
106-
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x2,
106+
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x2,
107107
DISPATCH_BLOCK_ASSIGN_CURRENT
108-
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x4,
108+
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x4,
109109
DISPATCH_BLOCK_NO_QOS_CLASS
110-
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x8,
110+
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x8,
111111
DISPATCH_BLOCK_INHERIT_QOS_CLASS
112-
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x10,
112+
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x10,
113113
DISPATCH_BLOCK_ENFORCE_QOS_CLASS
114-
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x20,
114+
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x20,
115115
);
116116

117117
/*!
@@ -164,7 +164,7 @@ DISPATCH_ENUM(dispatch_block_flags, unsigned long,
164164
* When not building with Objective-C ARC, must be released with a -[release]
165165
* message or the Block_release() function.
166166
*/
167-
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
167+
API_AVAILABLE(macos(10.10), ios(8.0))
168168
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_RETURNS_RETAINED_BLOCK
169169
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
170170
dispatch_block_t
@@ -236,7 +236,7 @@ dispatch_block_create(dispatch_block_flags_t flags, dispatch_block_t block);
236236
* When not building with Objective-C ARC, must be released with a -[release]
237237
* message or the Block_release() function.
238238
*/
239-
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
239+
API_AVAILABLE(macos(10.10), ios(8.0))
240240
DISPATCH_EXPORT DISPATCH_NONNULL4 DISPATCH_RETURNS_RETAINED_BLOCK
241241
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
242242
dispatch_block_t
@@ -269,7 +269,7 @@ dispatch_block_create_with_qos_class(dispatch_block_flags_t flags,
269269
* @param block
270270
* The block to create the temporary block object from.
271271
*/
272-
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
272+
API_AVAILABLE(macos(10.10), ios(8.0))
273273
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW
274274
void
275275
dispatch_block_perform(dispatch_block_flags_t flags,
@@ -320,7 +320,7 @@ dispatch_block_perform(dispatch_block_flags_t flags,
320320
* Returns zero on success (the dispatch block object completed within the
321321
* specified timeout) or non-zero on error (i.e. timed out).
322322
*/
323-
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
323+
API_AVAILABLE(macos(10.10), ios(8.0))
324324
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
325325
long
326326
dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout);
@@ -361,7 +361,7 @@ dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout);
361361
* @param notification_block
362362
* The notification block to submit when the observed block object completes.
363363
*/
364-
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
364+
API_AVAILABLE(macos(10.10), ios(8.0))
365365
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
366366
void
367367
dispatch_block_notify(dispatch_block_t block, dispatch_queue_t queue,
@@ -393,7 +393,7 @@ dispatch_block_notify(dispatch_block_t block, dispatch_queue_t queue,
393393
* The result of passing NULL or a block object not returned by one of the
394394
* dispatch_block_create* functions is undefined.
395395
*/
396-
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
396+
API_AVAILABLE(macos(10.10), ios(8.0))
397397
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
398398
void
399399
dispatch_block_cancel(dispatch_block_t block);
@@ -412,7 +412,7 @@ dispatch_block_cancel(dispatch_block_t block);
412412
* @result
413413
* Non-zero if canceled and zero if not canceled.
414414
*/
415-
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
415+
API_AVAILABLE(macos(10.10), ios(8.0))
416416
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
417417
DISPATCH_NOTHROW
418418
long

0 commit comments

Comments
 (0)