apple / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.23k stars 1.12k forks source link

🍒[Swift 5.10] Stop assuming `CFSTR` is a constant-time expression with Clang 15 #4953

Closed etcwilde closed 1 month ago

etcwilde commented 1 month ago

From Clang 15, nested static initializer inside statement-expression is no longer a constant-time expression (See https://reviews.llvm.org/D127201). OSS Foundation defines CFSTR as a macro rather than __builtin___CFStringMakeConstantString and it uses nested static initializer inside statement-expression, so we can't assume CFSTR itself is always a constant-time expression. This patch removes some static qualifiers associated with CFSTR to make them acceptable with Clang 15 and later.

etcwilde commented 1 month ago

@swift-ci please test

etcwilde commented 1 month ago

We seem to be building and linking against a newer Swift stdlib than what we're trying to run the tests against.

$ "/Users/ec2-user/jenkins/workspace/swift-corelibs-foundation-PR-macOS/branch-release/5.10/swift-corelibs-xctest/Tests/Functional/Asynchronous/Predicates/Handler/Output/Asynchronous-Predicates-Handler"
# command stderr:
dyld[81473]: Symbol not found: _swift_getTypeByMangledNameInContext2
  Referenced from: <9A3B36F4-AC33-3A8B-8557-5CFCFCB64DF3> /Users/ec2-user/jenkins/workspace/swift-corelibs-foundation-PR-macOS/branch-release/5.10/swift-corelibs-xctest/Tests/Functional/Asynchronous/Predicates/Handler/Output/Asynchronous-Predicates-Handler (built for macOS 14.2 which is newer than running OS)
  Expected in:     <087DADAD-D590-35EA-AC4D-7B0E966804EB> /usr/lib/swift/libswiftCore.dylib

error: command failed with exit status: -6