Skip to content

[stdlib] Adopt _pointerBitWidth conditional #65471

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 2 commits into from
Apr 28, 2023

Conversation

lorentey
Copy link
Member

Replace arch(foo) || arch(bar) || arch(fred) incantations with the new _pointerBitWidth conditional.

@lorentey
Copy link
Member Author

@swift-ci test

@stephentyrone
Copy link
Contributor

Thanks for working on this one!

@lorentey
Copy link
Member Author

arm64_32-apple-watchos4.0:

=== /Users/ec2-user/jenkins/workspace/swift-PR-macos/branch-main/swift/stdlib/public/core/StringObject.swift:171 ===
     ┆
 169 │ 
 170 │ #else
 171 │ #error("Unknown platform")
     │        ╰─ error: Unknown platform
 172 │ #endif
 173 │ 

@lorentey
Copy link
Member Author

Oops, typo:

diff --git a/stdlib/public/core/StringObject.swift b/stdlib/public/core/StringObject.swift
index f3a440139b3..cd47c3b5313 100644
--- a/stdlib/public/core/StringObject.swift
+++ b/stdlib/public/core/StringObject.swift
@@ -101,7 +101,7 @@ internal struct _StringObject {
     self._object = Builtin.valueToBridgeObject(UInt64(0)._value)
   }
 
-#elseif _pointerBitWidth(_64)
+#elseif _pointerBitWidth(_32)
 
   @usableFromInline @frozen
   internal enum Variant {

I'll amend the existing commit.

@lorentey lorentey force-pushed the adopt-pointerBitwidth branch from 3f3d3da to b82ce9c Compare April 27, 2023 20:33
@lorentey
Copy link
Member Author

@swift-ci test

@lorentey
Copy link
Member Author

The last commit normalized the ordering of the conditional clauses to 64 bit → 32 bit → error, even outside of StringObject. Putting the (far) more common case first is a nice didactic tool for avoiding confusion. (Thanks @glessard)

@lorentey
Copy link
Member Author

@swift-ci test

@lorentey lorentey merged commit 32811ba into swiftlang:main Apr 28, 2023
@lorentey lorentey deleted the adopt-pointerBitwidth branch April 28, 2023 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants