From 37b73bdeb14d8843d3dd71c45159fc16d3713c88 Mon Sep 17 00:00:00 2001 From: Johannes Weiss Date: Wed, 26 Feb 2025 15:13:56 +0000 Subject: [PATCH] always @preconcurrency import Glibc/Musl/Android/Bionic/WASILibc [6.1] --- Sources/Foundation/CGFloat.swift | 2 +- Sources/Foundation/FileHandle.swift | 8 ++++---- Sources/Foundation/FileManager+POSIX.swift | 4 ++-- Sources/Foundation/FileManager.swift | 4 ++-- Sources/Foundation/Host.swift | 2 +- Sources/Foundation/NSData.swift | 2 +- Sources/Foundation/NSError.swift | 4 ++-- Sources/Foundation/NSLock.swift | 4 ++-- Sources/Foundation/NSPathUtilities.swift | 4 ++-- Sources/Foundation/NSPlatform.swift | 2 +- Sources/Foundation/NSSwiftRuntime.swift | 8 ++++---- Sources/Foundation/NSURL.swift | 6 +++--- Sources/Foundation/Port.swift | 8 ++++---- Sources/Foundation/Process.swift | 2 +- Sources/Foundation/Thread.swift | 6 +++--- Sources/FoundationNetworking/HTTPCookie.swift | 2 +- Sources/Testing/Testing.swift | 8 ++++---- Sources/XCTest/Public/XCTestMain.swift | 2 +- Sources/plutil/main.swift | 6 +++--- Sources/xdgTestHelper/main.swift | 2 +- 20 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Sources/Foundation/CGFloat.swift b/Sources/Foundation/CGFloat.swift index c59977f88a..425ab259fe 100644 --- a/Sources/Foundation/CGFloat.swift +++ b/Sources/Foundation/CGFloat.swift @@ -8,7 +8,7 @@ // #if canImport(Android) -import Android +@preconcurrency import Android #endif @frozen diff --git a/Sources/Foundation/FileHandle.swift b/Sources/Foundation/FileHandle.swift index 7a985f2ef8..35c8eda476 100644 --- a/Sources/Foundation/FileHandle.swift +++ b/Sources/Foundation/FileHandle.swift @@ -20,22 +20,22 @@ 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(_:) #elseif canImport(WASILibc) -import WASILibc +@preconcurrency import WASILibc 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(_:) diff --git a/Sources/Foundation/FileManager+POSIX.swift b/Sources/Foundation/FileManager+POSIX.swift index 89bc95b101..cbd3659308 100644 --- a/Sources/Foundation/FileManager+POSIX.swift +++ b/Sources/Foundation/FileManager+POSIX.swift @@ -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 @@ -21,7 +21,7 @@ internal func &(left: UInt32, right: mode_t) -> mode_t { internal import Synchronization #if os(WASI) -import WASILibc +@preconcurrency import WASILibc // wasi-libc defines the following constants in a way that Clang Importer can't // understand, so we need to grab them manually through ForSwiftFoundationOnly.h internal var DT_DIR: UInt8 { _getConst_DT_DIR() } diff --git a/Sources/Foundation/FileManager.swift b/Sources/Foundation/FileManager.swift index c28ee293b7..029e95dcbd 100644 --- a/Sources/Foundation/FileManager.swift +++ b/Sources/Foundation/FileManager.swift @@ -20,9 +20,9 @@ import WinSDK #endif #if os(WASI) -import WASILibc +@preconcurrency import WASILibc #elseif canImport(Bionic) -import Bionic +@preconcurrency import Bionic #endif #if os(Windows) diff --git a/Sources/Foundation/Host.swift b/Sources/Foundation/Host.swift index fb13063121..6e737d0014 100644 --- a/Sources/Foundation/Host.swift +++ b/Sources/Foundation/Host.swift @@ -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 diff --git a/Sources/Foundation/NSData.swift b/Sources/Foundation/NSData.swift index 65eb0d93e2..1a076beff7 100644 --- a/Sources/Foundation/NSData.swift +++ b/Sources/Foundation/NSData.swift @@ -12,7 +12,7 @@ import Dispatch #endif #if canImport(Android) -import Android +@preconcurrency import Android #endif extension NSData { diff --git a/Sources/Foundation/NSError.swift b/Sources/Foundation/NSError.swift index 5d9d78672f..d6a4d1868c 100644 --- a/Sources/Foundation/NSError.swift +++ b/Sources/Foundation/NSError.swift @@ -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 diff --git a/Sources/Foundation/NSLock.swift b/Sources/Foundation/NSLock.swift index 9d0fadc910..a60eff1535 100644 --- a/Sources/Foundation/NSLock.swift +++ b/Sources/Foundation/NSLock.swift @@ -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) diff --git a/Sources/Foundation/NSPathUtilities.swift b/Sources/Foundation/NSPathUtilities.swift index ba8a48fad3..9b74edc5c7 100644 --- a/Sources/Foundation/NSPathUtilities.swift +++ b/Sources/Foundation/NSPathUtilities.swift @@ -11,9 +11,9 @@ #if os(Windows) import WinSDK #elseif canImport(Android) -import Android +@preconcurrency import Android #elseif os(WASI) -import WASILibc +@preconcurrency import WASILibc #endif #if os(Windows) diff --git a/Sources/Foundation/NSPlatform.swift b/Sources/Foundation/NSPlatform.swift index 5424f5bb92..026a410e67 100644 --- a/Sources/Foundation/NSPlatform.swift +++ b/Sources/Foundation/NSPlatform.swift @@ -11,7 +11,7 @@ fileprivate let _NSPageSize = Int(vm_page_size) #elseif os(Linux) || os(Android) || os(OpenBSD) #if canImport(Android) -import Android +@preconcurrency import Android #endif fileprivate let _NSPageSize = Int(getpagesize()) #elseif os(Windows) diff --git a/Sources/Foundation/NSSwiftRuntime.swift b/Sources/Foundation/NSSwiftRuntime.swift index 1509c31d71..727d343f28 100644 --- a/Sources/Foundation/NSSwiftRuntime.swift +++ b/Sources/Foundation/NSSwiftRuntime.swift @@ -16,13 +16,13 @@ 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 +@_exported @preconcurrency import WASILibc #elseif os(Windows) @_exported import CRT #endif diff --git a/Sources/Foundation/NSURL.swift b/Sources/Foundation/NSURL.swift index a9972c1ac2..88f6cd1108 100644 --- a/Sources/Foundation/NSURL.swift +++ b/Sources/Foundation/NSURL.swift @@ -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 diff --git a/Sources/Foundation/Port.swift b/Sources/Foundation/Port.swift index 2185836818..588d6b6577 100644 --- a/Sources/Foundation/Port.swift +++ b/Sources/Foundation/Port.swift @@ -108,19 +108,19 @@ fileprivate let FOUNDATION_IPPROTO_TCP = IPPROTO_TCP #endif #if canImport(Glibc) && !os(OpenBSD) -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) -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 @@ -128,7 +128,7 @@ 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 diff --git a/Sources/Foundation/Process.swift b/Sources/Foundation/Process.swift index 1ed8a50b52..07b9be12fd 100644 --- a/Sources/Foundation/Process.swift +++ b/Sources/Foundation/Process.swift @@ -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 diff --git a/Sources/Foundation/Thread.swift b/Sources/Foundation/Thread.swift index 0985a4826d..a62dfa28d6 100644 --- a/Sources/Foundation/Thread.swift +++ b/Sources/Foundation/Thread.swift @@ -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 diff --git a/Sources/FoundationNetworking/HTTPCookie.swift b/Sources/FoundationNetworking/HTTPCookie.swift index 237c1daf55..18a62776bb 100644 --- a/Sources/FoundationNetworking/HTTPCookie.swift +++ b/Sources/FoundationNetworking/HTTPCookie.swift @@ -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 { diff --git a/Sources/Testing/Testing.swift b/Sources/Testing/Testing.swift index 2483c14ed6..a8a40f1d58 100644 --- a/Sources/Testing/Testing.swift +++ b/Sources/Testing/Testing.swift @@ -8,13 +8,13 @@ // #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 +@preconcurrency import WASILibc #elseif canImport(CRT) import CRT #endif diff --git a/Sources/XCTest/Public/XCTestMain.swift b/Sources/XCTest/Public/XCTestMain.swift index e19184e69f..2cfefbdbb5 100644 --- a/Sources/XCTest/Public/XCTestMain.swift +++ b/Sources/XCTest/Public/XCTestMain.swift @@ -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. diff --git a/Sources/plutil/main.swift b/Sources/plutil/main.swift index 29584596d3..34b1d5e332 100644 --- a/Sources/plutil/main.swift +++ b/Sources/plutil/main.swift @@ -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 diff --git a/Sources/xdgTestHelper/main.swift b/Sources/xdgTestHelper/main.swift index fb037e2435..769ac33882 100644 --- a/Sources/xdgTestHelper/main.swift +++ b/Sources/xdgTestHelper/main.swift @@ -20,7 +20,7 @@ import FoundationNetworking #if os(Windows) import WinSDK #elseif canImport(Android) -import Android +@preconcurrency import Android #endif enum HelperCheckStatus : Int32 {