Skip to content

[Windows] @available unknown platform warnings #2908

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
8 changes: 4 additions & 4 deletions Sources/Foundation/Bundle.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import CoreFoundation
Expand Down Expand Up @@ -108,7 +108,7 @@ open class Bundle: NSObject {
}

#if os(Windows)
@available(Windows, deprecated, message: "Not yet implemented.")
@available(*, deprecated, message: "Not yet implemented")
public init(for aClass: AnyClass) {
NSUnimplemented()
}
Expand Down
12 changes: 7 additions & 5 deletions Sources/Foundation/FileHandle.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016, 2018 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -55,7 +55,7 @@ open class FileHandle : NSObject {
return _handle
}

@available(Windows, unavailable, message: "Cannot perform non-owning handle to fd conversion")
@available(*, unavailable, message: "Cannot perform non-owning handle to fd conversion")
open var fileDescriptor: Int32 {
NSUnsupported()
}
Expand Down Expand Up @@ -943,11 +943,13 @@ extension FileHandle {
acceptConnectionInBackgroundAndNotify(forModes: [.default])
}

@available(Windows, unavailable, message: "A SOCKET cannot be treated as a fd")
open func acceptConnectionInBackgroundAndNotify(forModes modes: [RunLoop.Mode]?) {
#if os(Windows)
@available(*, unavailable, message: "A SOCKET cannot be treated as a fd")
open func acceptConnectionInBackgroundAndNotify(forModes modes: [RunLoop.Mode]?) {
NSUnsupported()
}
#else
open func acceptConnectionInBackgroundAndNotify(forModes modes: [RunLoop.Mode]?) {
let owner = monitor(forReading: true, resumed: false) { (handle, source) in
var notification = Notification(name: .NSFileHandleConnectionAccepted, object: handle, userInfo: [:])
let userInfo: [AnyHashable : Any]
Expand Down Expand Up @@ -975,8 +977,8 @@ extension FileHandle {
privateAsyncVariablesLock.unlock()

owner.resume()
#endif
}
#endif

open func waitForDataInBackgroundAndNotify() {
waitForDataInBackgroundAndNotify(forModes: [.default])
Expand Down
6 changes: 3 additions & 3 deletions Sources/Foundation/FileManager.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -1102,12 +1102,12 @@ open class FileManager : NSObject {
/// - Experiment: This is a draft API currently under consideration for official import into Foundation as a suitable alternative
/// - Note: Since this API is under consideration it may be either removed or revised in the near future
#if os(Windows)
@available(Windows, deprecated, message: "Not yet implemented")
@available(*, deprecated, message: "Not yet implemented")
open func replaceItem(at originalItemURL: URL, withItemAt newItemURL: URL, backupItemName: String?, options: ItemReplacementOptions = []) throws -> URL? {
NSUnimplemented()
}

@available(Windows, deprecated, message: "Not yet implemented")
@available(*, deprecated, message: "Not yet implemented")
public func replaceItemAt(_ originalItemURL: URL, withItemAt newItemURL: URL, backupItemName: String? = nil, options: ItemReplacementOptions = []) throws -> URL? {
NSUnimplemented()
}
Expand Down