Skip to content

fixes for swiftc compiler warnings #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/swift/Block.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class DispatchWorkItem {

// Used by DispatchQueue.synchronously<T> to provide a @noescape path through
// dispatch_block_t, as we know the lifetime of the block in question.
internal init(flags: DispatchWorkItemFlags = [], noescapeBlock: @noescape () -> ()) {
internal init(flags: DispatchWorkItemFlags = [], noescapeBlock: () -> ()) {
_block = _swift_dispatch_block_create_noescape(dispatch_block_flags_t(flags.rawValue), noescapeBlock)
}

Expand Down Expand Up @@ -108,4 +108,4 @@ internal typealias _DispatchBlock = @convention(block) () -> Void
internal typealias dispatch_block_t = @convention(block) () -> Void

@_silgen_name("_swift_dispatch_block_create_noescape")
internal func _swift_dispatch_block_create_noescape(_ flags: dispatch_block_flags_t, _ block: @noescape () -> ()) -> _DispatchBlock
internal func _swift_dispatch_block_create_noescape(_ flags: dispatch_block_flags_t, _ block: () -> ()) -> _DispatchBlock
4 changes: 2 additions & 2 deletions src/swift/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public struct DispatchData : RandomAccessCollection {
}

public func withUnsafeBytes<Result, ContentType>(
body: @noescape (UnsafePointer<ContentType>) throws -> Result) rethrows -> Result
body: (UnsafePointer<ContentType>) throws -> Result) rethrows -> Result
{
var ptr: UnsafeRawPointer? = nil
var size = 0
Expand All @@ -86,7 +86,7 @@ public struct DispatchData : RandomAccessCollection {
}

public func enumerateBytes(
block: @noescape (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Int, _ stop: inout Bool) -> Void)
block: (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Int, _ stop: inout Bool) -> Void)
{
_swift_dispatch_data_apply(__wrapped.__wrapped) { (data: dispatch_data_t, offset: Int, ptr: UnsafeRawPointer, size: Int) in
let bytePtr = ptr.bindMemory(to: UInt8.self, capacity: size)
Expand Down
1 change: 0 additions & 1 deletion src/swift/Dispatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public struct DispatchQoS : Equatable {
case .QOS_CLASS_USER_INITIATED: self = .userInitiated
case .QOS_CLASS_USER_INTERACTIVE: self = .userInteractive
case .QOS_CLASS_UNSPECIFIED: self = .unspecified
default: return nil
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/swift/Private.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public func dispatch_io_set_interval(_ channel: DispatchIO, _ interval: UInt64,
}

@available(*, unavailable, renamed:"DispatchQueue.apply(attributes:iterations:execute:)")
public func dispatch_apply(_ iterations: Int, _ queue: DispatchQueue, _ block: @noescape (Int) -> Void)
public func dispatch_apply(_ iterations: Int, _ queue: DispatchQueue, _ block: (Int) -> Void)
{
fatalError()
}
Expand Down Expand Up @@ -207,7 +207,7 @@ public func dispatch_barrier_async(_ queue: DispatchQueue, _ block: () -> Void)
}

@available(*, unavailable, renamed:"DispatchQueue.synchronously(self:flags:execute:)")
public func dispatch_barrier_sync(_ queue: DispatchQueue, _ block: @noescape () -> Void)
public func dispatch_barrier_sync(_ queue: DispatchQueue, _ block: () -> Void)
{
fatalError()
}
Expand Down
16 changes: 8 additions & 8 deletions src/swift/Queue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public extension DispatchQueue {
}
}

public class func concurrentPerform(iterations: Int, execute work: @noescape (Int) -> Void) {
public class func concurrentPerform(iterations: Int, execute work: (Int) -> Void) {
_swift_dispatch_apply_current(iterations, work)
}

Expand Down Expand Up @@ -242,13 +242,13 @@ public extension DispatchQueue {
}
}

private func _syncBarrier(block: @noescape () -> ()) {
private func _syncBarrier(block: () -> ()) {
CDispatch.dispatch_barrier_sync(self.__wrapped, block)
}

private func _syncHelper<T>(
fn: (@noescape () -> ()) -> (),
execute work: @noescape () throws -> T,
fn: (() -> ()) -> (),
execute work: () throws -> T,
rescue: ((Swift.Error) throws -> (T))) rethrows -> T
{
var result: T?
Expand All @@ -271,7 +271,7 @@ public extension DispatchQueue {
private func _syncHelper<T>(
fn: (DispatchWorkItem) -> (),
flags: DispatchWorkItemFlags,
execute work: @noescape () throws -> T,
execute work: () throws -> T,
rescue: ((Swift.Error) throws -> (T))) rethrows -> T
{
var result: T?
Expand All @@ -291,11 +291,11 @@ public extension DispatchQueue {
}
}

public func sync<T>(execute work: @noescape () throws -> T) rethrows -> T {
public func sync<T>(execute work: () throws -> T) rethrows -> T {
return try self._syncHelper(fn: sync, execute: work, rescue: { throw $0 })
}

public func sync<T>(flags: DispatchWorkItemFlags, execute work: @noescape () throws -> T) rethrows -> T {
public func sync<T>(flags: DispatchWorkItemFlags, execute work: () throws -> T) rethrows -> T {
if flags == .barrier {
return try self._syncHelper(fn: _syncBarrier, execute: work, rescue: { throw $0 })
} else if #available(OSX 10.10, iOS 8.0, *), !flags.isEmpty {
Expand Down Expand Up @@ -385,4 +385,4 @@ internal func _swift_dispatch_get_main_queue() -> dispatch_queue_t
internal func _swift_dispatch_apply_current_root_queue() -> dispatch_queue_t

@_silgen_name("_swift_dispatch_apply_current")
internal func _swift_dispatch_apply_current(_ iterations: Int, _ block: @convention(block) @noescape (Int) -> Void)
internal func _swift_dispatch_apply_current(_ iterations: Int, _ block: @convention(block) (Int) -> Void)
2 changes: 1 addition & 1 deletion src/swift/Wrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public class DispatchQueue : DispatchObject {
_swift_dispatch_release(wrapped())
}

public func sync(execute workItem: @noescape ()->()) {
public func sync(execute workItem: ()->()) {
dispatch_sync(self.__wrapped, workItem)
}
}
Expand Down