Skip to content

[5.6][stdlib] Switch to new single-header modulemap for Android and OpenBSD too #41510

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

Closed
wants to merge 2 commits into from

Conversation

finagolfin
Copy link
Member

Cherrypick of #35707 and #40557

Explanation: #32404 switched linux glibc over to a single-header modulemap last year, so Android and OpenBSD are following suit. Just like on linux, this fixes issues with C++ interoperability.

Scope: Only affects these external platforms, with the exception of the three header changes in SwiftGlibc.h.gyb.

SR Issue: None

Risk: Very low

Testing: I've been applying the Android pull on my daily Android CI when cross-compiling the trunk and 5.6 stdlib for a couple months now.

Reviewer: @CodaFi

finagolfin and others added 2 commits February 22, 2022 14:22
This migrates OpenBSD to use the single-header Glibc modulemap proposed
and implemented in swiftlang#32404, and necessitates introducing some missing
headers for building Foundation added in swiftlang#38341.

Additionally, incorporate nullability annotations in SwiftShims per
@finagolfin finagolfin requested a review from a team as a code owner February 22, 2022 09:17
'utmp.h',
'utmpx.h',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicated on line 97 below, so removed this one.

@finagolfin
Copy link
Member Author

@CodaFi, if you approve and run the CI, I think we can get this in.

@CodaFi
Copy link
Contributor

CodaFi commented Mar 2, 2022

Nominated as rdar://89699689

@swift-ci test

@finagolfin
Copy link
Member Author

@CodaFi, been a week, tough to get the 5.6 branch approval?

@finagolfin
Copy link
Member Author

@CodaFi, I was waiting for a merge window to be announced for 5.6.1, but it never was and that just shipped. Can we get this in now?

@finagolfin
Copy link
Member Author

@airspeedswift, I think this qualifies as a bugfix for these alternate platforms, as this fixes several C++ Interop tests from the compiler validation suite. Let me know if we can get it into 5.6, or if I should close the pull.

@finagolfin
Copy link
Member Author

@airspeedswift, this only affects Android and OpenBSD, with the exception of the headers added to stdlib/public/Platform/SwiftGlibc.h.gyb. Please let me know what you think.

@airspeedswift
Copy link
Member

Is there motivation for this beyond C++ interop? That alone isn't very compelling as a reason to cherry pick something into the 5.6 branch, given it is a highly experimental feature and so presumably not something that needs to be done in the point release versus 5.7.

@finagolfin
Copy link
Member Author

The main reason is to bring these two alternative platforms in line with linux and other "SwiftGlibc" platforms, by also making this change that was done primarily for C++ interoperability with the Swift 5.5 release last year. There are some subtle issues with libc module scoping that this change also makes- see apple/swift-nio#2026 for an example- and this move will make sure cross-platform code doesn't hit such irregularities.

It's more a matter of aligning all platforms to a single-header modulemap, with this pull that is almost entirely scoped to these two less-used platforms.

@finagolfin
Copy link
Member Author

@shahmishal, let me know what you think of this one too.

@airspeedswift
Copy link
Member

I’m still not seeing the reason why it’s key to get this into the release toolchain, instead of letting it happen in 5.7 naturally. C++ interop is not yet an official feature so nothing done in support of it should need to be back ported to the release. The 5.6.3 release is aimed at fixing bugs people are hitting when using the production toolchain, rather than helping facilitate WIP. Additionally, the linked PR to NIO implies that this change will cause source breaks – which is fine if it’s the right thing to do, but probably not in a patch release.

@finagolfin
Copy link
Member Author

finagolfin commented Jul 27, 2022

The 5.6.3 release is aimed at fixing bugs people are hitting when using the production toolchain, rather than helping facilitate WIP.

Right, so even ignoring C++ interop this pull removes that libc incompatibility between Linux and Android/OpenBSD, which has now been there since Swift 5.5.

Additionally, the linked PR to NIO implies that this change will cause source breaks – which is fine if it’s the right thing to do, but probably not in a patch release.

To be fair, I submitted this five months ago now, a month before the 5.6 release. I never said it was a "key" change, merely an attempt to regularize these niche Swift platforms of Android and OpenBSD.

If it "breaks" anything, it will be on those niche platforms, not on any of the major Swift platforms, unless you're worried about the two mentioned header additions for OpenBSD that are now also included on linux.

I realize it's a judgement call whether to merge this: my judgement is that since it primarily only affects Android and OpenBSD, we might as well get it in. If your judgement is otherwise, feel free to close.

@finagolfin
Copy link
Member Author

Ping, @airspeedswift, just need a decision on this before 5.6.3 is tagged. I think this is very low-risk and worth getting in, but if you don't think it's worth it, feel free to close.

@finagolfin
Copy link
Member Author

@shahmishal, no word from Ben in the last three weeks, can this still make the patch release?

@finagolfin
Copy link
Member Author

5.7 is out, so closing.

@finagolfin finagolfin closed this Sep 12, 2022
@finagolfin finagolfin deleted the map branch September 21, 2022 19:18
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.

4 participants