Skip to content

Explicitly import Glibc in files that rely on it #2921

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 1 commit into from
Nov 18, 2020

Conversation

scentini
Copy link
Contributor

@scentini scentini commented Nov 10, 2020

These files rely on Glibc declarations in their public interface, even though they don’t import Glibc. Currently, these declarations are discovered through CoreFoundation, but due to implementation details, Swift canonicalizes the declarations and at the end uses declarations from Glibc (which is imported by other files in the module). This confuses @_implementationOnly checker to recognize these declarations as visible even though they shouldn't be.

This is fragile as Foundation now relies on implementation details of Glibc, which in fact we are trying to change in swiftlang/swift#32404.

This PR fixes the issue by explicitly importing Glibc in affected files.

@scentini
Copy link
Contributor Author

cc/ @CodaFi @gribozavr

@spevans
Copy link
Contributor

spevans commented Nov 10, 2020

@swift-ci test

@hlopko
Copy link

hlopko commented Nov 11, 2020

CC @hlopko

@hlopko
Copy link

hlopko commented Nov 13, 2020

Friendly ping :)

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

I'm still not convinced by canImport, but that is the convention in the repository ... and, when in Rome ..

@compnerd compnerd merged commit 5b9797f into swiftlang:main Nov 18, 2020
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