diff --git a/Sources/Atomics/Primitives/Primitives.native.swift.gyb b/Sources/Atomics/Primitives/Primitives.native.swift.gyb index 3036514..bfa9657 100644 --- a/Sources/Atomics/Primitives/Primitives.native.swift.gyb +++ b/Sources/Atomics/Primitives/Primitives.native.swift.gyb @@ -15,7 +15,13 @@ }% ${autogenerated_warning()} -#if ATOMICS_NATIVE_BUILTINS +// FIXME: The conditionals below have been carefully constructed to +// avoid confusing Swift 5.7; they can be sanitized once we drop support +// for that version. +#if compiler(>=5.9) +#if !ATOMICS_NATIVE_BUILTINS +#error("swift-atomics requires native builtins on Swift 5.9") +#endif import Builtin @_alwaysEmitIntoClient @@ -39,7 +45,7 @@ internal func _atomicMemoryFence( % for (swiftType, builtinType, alignment) in nativePrimitives: % if builtinType == "Int128": -#if compiler(>=5.9) && _pointerBitWidth(_64) +#if _pointerBitWidth(_64) % end @usableFromInline @frozen @@ -267,14 +273,18 @@ extension UnsafeMutablePointer where Pointee == ${swiftType} { % end % end -#if compiler(>=5.9) && _pointerBitWidth(_64) +#if _pointerBitWidth(_64) @usableFromInline internal typealias _AtomicIntStorage = _AtomicInt64Storage @usableFromInline internal typealias _AtomicDoubleWordStorage = _AtomicInt128Storage -#elseif compiler(>=5.9) && _pointerBitWidth(_32) +#elseif _pointerBitWidth(_32) @usableFromInline internal typealias _AtomicIntStorage = _AtomicInt32Storage @usableFromInline internal typealias _AtomicDoubleWordStorage = _AtomicInt64Storage #else #error("Unexpected pointer bit width") #endif -#endif // ATOMICS_NATIVE_BUILTINS +#else // compiler(>=5.9) +#if ATOMICS_NATIVE_BUILTINS +#error("swift-atomics requires C shims on Swift versions below 5.9") +#endif +#endif // compiler(>=5.9) diff --git a/Sources/Atomics/Primitives/autogenerated/Primitives.native.swift b/Sources/Atomics/Primitives/autogenerated/Primitives.native.swift index 7596a24..99b728c 100644 --- a/Sources/Atomics/Primitives/autogenerated/Primitives.native.swift +++ b/Sources/Atomics/Primitives/autogenerated/Primitives.native.swift @@ -18,7 +18,13 @@ // ############################################################################# -#if ATOMICS_NATIVE_BUILTINS +// FIXME: The conditionals below have been carefully constructed to +// avoid confusing Swift 5.7; they can be sanitized once we drop support +// for that version. +#if compiler(>=5.9) +#if !ATOMICS_NATIVE_BUILTINS +#error("swift-atomics requires native builtins on Swift 5.9") +#endif import Builtin @_alwaysEmitIntoClient @@ -2110,7 +2116,7 @@ extension UnsafeMutablePointer where Pointee == _AtomicInt64Storage { } } -#if compiler(>=5.9) && _pointerBitWidth(_64) +#if _pointerBitWidth(_64) @usableFromInline @frozen @_alignment(16) @@ -2438,14 +2444,18 @@ extension UnsafeMutablePointer where Pointee == _AtomicInt128Storage { } #endif -#if compiler(>=5.9) && _pointerBitWidth(_64) +#if _pointerBitWidth(_64) @usableFromInline internal typealias _AtomicIntStorage = _AtomicInt64Storage @usableFromInline internal typealias _AtomicDoubleWordStorage = _AtomicInt128Storage -#elseif compiler(>=5.9) && _pointerBitWidth(_32) +#elseif _pointerBitWidth(_32) @usableFromInline internal typealias _AtomicIntStorage = _AtomicInt32Storage @usableFromInline internal typealias _AtomicDoubleWordStorage = _AtomicInt64Storage #else #error("Unexpected pointer bit width") #endif -#endif // ATOMICS_NATIVE_BUILTINS +#else // compiler(>=5.9) +#if ATOMICS_NATIVE_BUILTINS +#error("swift-atomics requires C shims on Swift versions below 5.9") +#endif +#endif // compiler(>=5.9) diff --git a/Sources/Atomics/Types/DoubleWord.swift b/Sources/Atomics/Types/DoubleWord.swift index 4e4b419..5f51af7 100644 --- a/Sources/Atomics/Types/DoubleWord.swift +++ b/Sources/Atomics/Types/DoubleWord.swift @@ -10,10 +10,17 @@ // //===----------------------------------------------------------------------===// -#if ATOMICS_NATIVE_BUILTINS +// FIXME: The conditionals below have been carefully constructed to +// avoid confusing Swift 5.7; they can be sanitized once we drop support +// for that version. +#if compiler(>=5.9) +#if !ATOMICS_NATIVE_BUILTINS +#error("swift-atomics requires native builtins on Swift 5.9") +#endif + import Builtin -#if compiler(>=5.9) && _pointerBitWidth(_32) +#if _pointerBitWidth(_32) @frozen @_alignment(8) public struct DoubleWord { @@ -29,7 +36,7 @@ public struct DoubleWord { self.second = second } } -#elseif compiler(>=5.9) && _pointerBitWidth(_64) +#elseif _pointerBitWidth(_64) @frozen @_alignment(16) public struct DoubleWord { @@ -63,10 +70,14 @@ extension DoubleWord { } } -#else // !ATOMICS_NATIVE_BUILTINS +#else // compiler(>=5.9) + +#if ATOMICS_NATIVE_BUILTINS +#error("swift-atomics requires C shims on Swift versions below 5.9") +#endif import _AtomicsShims public typealias DoubleWord = _AtomicsShims.DoubleWord -#endif +#endif // compiler(>=5.9) extension DoubleWord { /// Initialize a new `DoubleWord` value given its high- and