Apple and the Swift community has settled on this style:
https://devforums.apple.com/message/1133616#1133616
> FWIW, we've recently decided to standardize on () -> Void
> (generally, () for parameters and Void for return types) across all of our
> documentation.
We still have a bunch of redeclarations of Dispatch functions to avoid
the automatic bridging of dispatch_data_t and dispatch_block_t, but
mostly this is a vast reduction in complexity (and increase in safety).
From the Swift documentation:
"If you define an optional variable without providing a default value,
the variable is automatically set to nil for you."
This ensures that blocks that come from `DispatchWorkItem`s will
function correctly.
The only exception is __dispatch_barrier_sync() as the block passed to
that call is not `@convention(block)` so it doesn't matter.
Fixes SR-2246.
Adds an explicit @escaping throughout the standard library, validation
test suite, and tests. This will be necessary as soon as noescape is
the default for closure parameters.
* _swift_dispatch_data_create should have been marked as returning a
retained object, otherwise the object is never fully released and
the destructor is never executed.
Fixes: <rdar://problem/27577958>
Several libdispatch APIs in Queue.swift are annotated as:
public enum GlobalQueuePriority {
@available(OSX, deprecated: 10.10, message: "Use qos attributes instead")
@available(*, deprecated: 8.0, message: "Use qos attributes instead")
case high
This annotation means ".high is deprecated on all OSes in version 8.0 and
above", so the compiler had false positive deprecation warnings on macOS
when the minimum deployment target is 10.9 and false negatives on watchOS
when the deployment target is 2.0.
The fix is to explicitly enumerate the platforms the API is deprecated on. This
is not ideal (see SR-2155) but avoids the false positives and negatives.
This fixes https://bugs.swift.org/browse/SR-2153
* Migrate from `UnsafePointer<Void>` to `UnsafeRawPointer`.
As proposed in SE-0107: UnsafeRawPointer.
`void*` imports as `UnsafeMutableRawPointer`.
`const void*` imports as `UnsafeRawPointer`.
Occurrences of `UnsafePointer<Void>` are replaced with UnsafeRawPointer.
* Migrate overlays from UnsafePointer<Void> to UnsafeRawPointer.
This requires explicit memory binding in several places,
particularly in NSData and CoreAudio.
* Fix a bunch of test cases for Void->Raw migration.
* qsort takes IUO values
* Bridge `Unsafe[Mutable]RawPointer as `void [const] *`.
* Parse #dsohandle as UnsafeMutableRawPointer
* Update a bunch of test cases for Void->Raw migration.
* Trivial fix for the SceneKit test case.
* Add an UnsafeRawPointer self initializer.
This is unfortunately necessary for assignment between types imported from C.
* Tiny simplification of the initializer.
* Migrate from `UnsafePointer<Void>` to `UnsafeRawPointer`.
As proposed in SE-0107: UnsafeRawPointer.
`void*` imports as `UnsafeMutableRawPointer`.
`const void*` imports as `UnsafeRawPointer`.
Occurrences of `UnsafePointer<Void>` are replaced with UnsafeRawPointer.
* Migrate overlays from UnsafePointer<Void> to UnsafeRawPointer.
This requires explicit memory binding in several places,
particularly in NSData and CoreAudio.
* Fix a bunch of test cases for Void->Raw migration.
* qsort takes IUO values
* Bridge `Unsafe[Mutable]RawPointer as `void [const] *`.
* Parse #dsohandle as UnsafeMutableRawPointer
* Update a bunch of test cases for Void->Raw migration.
* Trivial fix for the SceneKit test case.
* Add an UnsafeRawPointer self initializer.
This is unfortunately necessary for assignment between types imported from C.
* Tiny simplification of the initializer.
* Fix DispatchSourceSignal initialisation such that it no longer
registers for the wrong source type.
* Remove (group:) option from DispatchWorkItem, introduce group
options to `.async` methods that accept DispatchWorkItem.
* Rename `DispatchSourceType` to `DispatchSourceProtocol`
* Rework DispatchQueue attributes and flags into a less confusing
approach.
* Fixes:
SR-1817, SR-1771, SR-1770, SR-1769
<rdar://problem/26725156> <rdar://problem/26873917>
<rdar://problem/26918843> <rdar://problem/26810149>
<rdar://problem/27117023> <rdar://problem/27121422>
<rdar://problem/27236887> <rdar://problem/27337555>