Skip to content

always @preconcurrency import Glibc/Musl/Bionic/Android/WASILibc #5170

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

Merged
merged 1 commit into from
Feb 26, 2025
Merged
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
2 changes: 1 addition & 1 deletion Sources/Foundation/CGFloat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//

#if canImport(Android)
import Android
@preconcurrency import Android
#endif

@frozen
Expand Down
6 changes: 3 additions & 3 deletions Sources/Foundation/FileHandle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ fileprivate let _read = Darwin.read(_:_:_:)
fileprivate let _write = Darwin.write(_:_:_:)
fileprivate let _close = Darwin.close(_:)
#elseif canImport(Glibc)
import Glibc
@preconcurrency import Glibc
fileprivate let _read = Glibc.read(_:_:_:)
fileprivate let _write = Glibc.write(_:_:_:)
fileprivate let _close = Glibc.close(_:)
#elseif canImport(Musl)
import Musl
@preconcurrency import Musl
fileprivate let _read = Musl.read(_:_:_:)
fileprivate let _write = Musl.write(_:_:_:)
fileprivate let _close = Musl.close(_:)
Expand All @@ -35,7 +35,7 @@ fileprivate let _read = WASILibc.read(_:_:_:)
fileprivate let _write = WASILibc.write(_:_:_:)
fileprivate let _close = WASILibc.close(_:)
#elseif canImport(Android)
import Android
@preconcurrency import Android
fileprivate let _read = Android.read(_:_:_:)
fileprivate let _write = Android.write(_:_:_:)
fileprivate let _close = Android.close(_:)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/FileManager+POSIX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#if !os(Windows)

#if canImport(Android)
import Android
@preconcurrency import Android
#endif

#if os(Android) && (arch(i386) || arch(arm)) // struct stat.st_mode is UInt32
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/FileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import WinSDK
#if os(WASI)
import WASILibc
#elseif canImport(Bionic)
import Bionic
@preconcurrency import Bionic
#endif

#if os(Windows)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/Host.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import WinSDK
#endif

#if canImport(Android)
import Android
@preconcurrency import Android
// Android Bionic differs a little with respect to the Linux Glibc.

// IFF_LOOPBACK is part of the enumeration net_device_flags, which needs to
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import Dispatch
#endif
#if canImport(Android)
import Android
@preconcurrency import Android
#endif

extension NSData {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Foundation/NSError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
#if canImport(Darwin)
import Darwin
#elseif canImport(Glibc)
import Glibc
@preconcurrency import Glibc
#elseif canImport(CRT)
import CRT
#elseif canImport(Android)
import Android
@preconcurrency import Android
#endif

@_implementationOnly import CoreFoundation
Expand Down
4 changes: 2 additions & 2 deletions Sources/Foundation/NSLock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
@_implementationOnly import CoreFoundation

#if canImport(Glibc)
import Glibc
@preconcurrency import Glibc
#elseif canImport(Bionic)
import Bionic
@preconcurrency import Bionic
#endif

#if os(Windows)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSPathUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#if os(Windows)
import WinSDK
#elseif canImport(Android)
import Android
@preconcurrency import Android
#elseif os(WASI)
import WASILibc
#endif
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSPlatform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
fileprivate let _NSPageSize = Int(vm_page_size)
#elseif os(Linux) || os(Android) || os(OpenBSD) || os(FreeBSD)
#if canImport(Android)
import Android
@preconcurrency import Android
#endif

fileprivate let _NSPageSize = Int(getpagesize())
Expand Down
6 changes: 3 additions & 3 deletions Sources/Foundation/NSSwiftRuntime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ internal import Synchronization
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
@_exported import Darwin
#elseif canImport(Glibc)
@_exported import Glibc
@_exported @preconcurrency import Glibc
#elseif canImport(Musl)
@_exported import Musl
@_exported @preconcurrency import Musl
#elseif canImport(Bionic)
@_exported import Bionic
@_exported @preconcurrency import Bionic
#elseif os(WASI)
@_exported import WASILibc
#elseif os(Windows)
Expand Down
6 changes: 3 additions & 3 deletions Sources/Foundation/NSURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ internal let kCFURLWindowsPathStyle = CFURLPathStyle.cfurlWindowsPathStyle
#if canImport(Darwin)
import Darwin
#elseif canImport(Glibc)
import Glibc
@preconcurrency import Glibc
#elseif canImport(Musl)
import Musl
@preconcurrency import Musl
#elseif canImport(Bionic)
import Bionic
@preconcurrency import Bionic
#endif

// NOTE: this represents PLATFORM_PATH_STYLE
Expand Down
8 changes: 4 additions & 4 deletions Sources/Foundation/Port.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,27 +108,27 @@ fileprivate let FOUNDATION_IPPROTO_TCP = IPPROTO_TCP
#endif

#if canImport(Glibc) && !os(OpenBSD) && !os(FreeBSD)
import Glibc
@preconcurrency import Glibc
fileprivate let FOUNDATION_SOCK_STREAM = Int32(SOCK_STREAM.rawValue)
fileprivate let FOUNDATION_IPPROTO_TCP = Int32(IPPROTO_TCP)
#endif

#if canImport(Musl)
import Musl
@preconcurrency import Musl
fileprivate let FOUNDATION_SOCK_STREAM = Int32(SOCK_STREAM)
fileprivate let FOUNDATION_IPPROTO_TCP = Int32(IPPROTO_TCP)
#endif

#if canImport(Glibc) && (os(OpenBSD) || os(FreeBSD))
import Glibc
@preconcurrency import Glibc
fileprivate let FOUNDATION_SOCK_STREAM = Int32(SOCK_STREAM)
fileprivate let FOUNDATION_IPPROTO_TCP = Int32(IPPROTO_TCP)
fileprivate let INADDR_ANY: in_addr_t = 0
fileprivate let INADDR_LOOPBACK = 0x7f000001
#endif

#if canImport(Android)
import Android
@preconcurrency import Android
fileprivate let FOUNDATION_SOCK_STREAM = Int32(Android.SOCK_STREAM)
fileprivate let FOUNDATION_IPPROTO_TCP = Int32(Android.IPPROTO_TCP)
fileprivate let INADDR_ANY: in_addr_t = 0
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/Process.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import struct WinSDK.HANDLE
#if canImport(Darwin)
import Darwin
#elseif canImport(Android)
import Android
@preconcurrency import Android
#endif

internal import Synchronization
Expand Down
6 changes: 3 additions & 3 deletions Sources/Foundation/Thread.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import WinSDK
#endif

#if canImport(Glibc)
import Glibc
@preconcurrency import Glibc
#elseif canImport(Musl)
import Musl
@preconcurrency import Musl
#elseif canImport(Bionic)
import Bionic
@preconcurrency import Bionic
#endif

// WORKAROUND_SR9811
Expand Down
2 changes: 1 addition & 1 deletion Sources/FoundationNetworking/HTTPCookie.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Foundation
#if os(Windows)
import WinSDK
#elseif canImport(Android)
import Android
@preconcurrency import Android
#endif

public struct HTTPCookiePropertyKey : RawRepresentable, Equatable, Hashable, Sendable {
Expand Down
6 changes: 3 additions & 3 deletions Sources/Testing/Testing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
//

#if canImport(Glibc)
import Glibc
@preconcurrency import Glibc
#elseif canImport(Musl)
import Musl
@preconcurrency import Musl
#elseif canImport(Bionic)
import Bionic
@preconcurrency import Bionic
#elseif os(WASI)
import WASILibc
#elseif canImport(CRT)
Expand Down
2 changes: 1 addition & 1 deletion Sources/XCTest/Public/XCTestMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#if canImport(Darwin)
import Darwin
#elseif canImport(Glibc)
import Glibc
@preconcurrency import Glibc
#endif

/// Starts a test run for the specified test cases.
Expand Down
6 changes: 3 additions & 3 deletions Sources/plutil/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import Darwin
import SwiftFoundation
#elseif canImport(Glibc)
import Foundation
import Glibc
@preconcurrency import Glibc
#elseif canImport(Musl)
import Foundation
import Musl
@preconcurrency import Musl
#elseif canImport(Bionic)
import Foundation
import Bionic
@preconcurrency import Bionic
#elseif canImport(CRT)
import Foundation
import CRT
Expand Down
2 changes: 1 addition & 1 deletion Sources/xdgTestHelper/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import FoundationNetworking
#if os(Windows)
import WinSDK
#elseif canImport(Android)
import Android
@preconcurrency import Android
#endif

enum HelperCheckStatus : Int32 {
Expand Down
4 changes: 2 additions & 2 deletions Tests/Foundation/FTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import Dispatch

#if canImport(Glibc)
import Glibc
@preconcurrency import Glibc
#elseif canImport(Darwin)
import Darwin
#elseif canImport(Android)
import Android
@preconcurrency import Android
#endif

final class ServerSemaphore : Sendable {
Expand Down
4 changes: 2 additions & 2 deletions Tests/Foundation/HTTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import Dispatch
#elseif canImport(Darwin)
import Darwin
#elseif canImport(Glibc)
import Glibc
@preconcurrency import Glibc
#elseif canImport(Android)
import Android
@preconcurrency import Android
#endif

#if !os(Windows)
Expand Down
2 changes: 1 addition & 1 deletion Tests/Foundation/TestFileHandle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Dispatch
#if os(Windows)
import WinSDK
#elseif canImport(Android)
import Android
@preconcurrency import Android
#endif

class TestFileHandle : XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Foundation/TestNSData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import XCTest
@testable import Foundation

#if canImport(Android)
import Android
@preconcurrency import Android
#endif

class TestNSData: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Foundation/TestProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import Synchronization
#if canImport(Android)
import Android
@preconcurrency import Android
#endif

class TestProcess : XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Foundation/TestSocketPort.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#if os(Windows)
import WinSDK
#elseif canImport(Android)
import Android
@preconcurrency import Android
#endif

class TestPortDelegateWithBlock: NSObject, PortDelegate {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Foundation/TestURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//

#if canImport(Android)
import Android
@preconcurrency import Android
#endif

let kURLTestParsingTestsKey = "ParsingTests"
Expand Down