Skip to content

Backport compatibility macro fixes to 5.8 #63995

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 4 commits into from
Mar 6, 2023

Conversation

QuietMisdreavus
Copy link
Contributor

@QuietMisdreavus QuietMisdreavus commented Mar 1, 2023

This PR backports the following changes onto release/5.8:

Explanation: #59072 introduced an implementation change to the Objective-C compatibility header, but it also created a regression for projects that link against headers generated by different Swift versions, where their projects would encounter "macro redefined" errors.

Scope: Regression affecting projects with prebuilt dependencies built by older versions of Swift

Issue: rdar://106086816

Risk: Low. Projects that build all their code with the same compiler are unaffected. The change is isolated to the Objective-C compatibility header generation, and does not affect normal compilation.

Testing: Locally building a project that included a generated header from Swift 5.7 against a header generated with Swift 5.8. A future PR will implement an automated test to ensure that these "macro redefinition" errors are all handled.

Reviewer: @airspeedswift @beccadax

beccadax and others added 4 commits March 1, 2023 08:48
#59072 accidentally changed the SWIFT_CLASS_NAMED macro to use `__attribute` when it previously used `__attribute__` (note the trailing underscores). While both keywords have the same semantics in clang, they are technically different tokens, so clang refuses to merge macro definitions that use one instead of the other; instead it would diagnose an ambiguity when a generated header from a new compiler imported a generated header from an old compiler. Change back to the old token to avoid this problem.

Fixes rdar://104252758.
@QuietMisdreavus QuietMisdreavus requested a review from a team as a code owner March 1, 2023 16:04
@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please build toolchain macOS Platform

@franklinsch franklinsch merged commit 79f282e into release/5.8 Mar 6, 2023
@franklinsch franklinsch deleted the QuietMisdreavus/5.8/compat-fixes branch March 6, 2023 17:21
@AnthonyLatsis AnthonyLatsis added the 🍒 release cherry pick Flag: Release branch cherry picks label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants