Skip to content

[5.9][ASTGen] Avoid including C standard libary headers in bridging headers #65128

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
Apr 13, 2023

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Apr 13, 2023

cherry-pick #65120 into release/5.9

Explanation: C stdlib headers are part of Darwin/Glibc clang module. If a Swift file imports a bridging header and that has #include C stdlib headers, Swift compiler implicitly imports Darwin/Glibc overlay modules. That violates dependency layering. I.e. Compiler depends on Darwin overlay, Darwin overlay is created by the compiler. Instead, use builtin types. e.g. size_t -> unsigned long
Scope: Macro expansion related components including swift-plugin-server
Risk: Low.
Testing: Current regression test suite
Issue: rdar://107957117
Reviewers: Ben Barham (@bnbarham)

C stdlib headers are part of "Darwin"/"Glibc" clang module.
If a Swift file imports a bridging headers and that has '#include'
C stdlib headers, Swift compiler implicitly imports "Darwin"/"Glibc"
overlay modules. That violates dependency layering. I.e. Compiler
depends on Darwin overlay, Darwin overlay is created by the compiler.

rdar://107957117
(cherry picked from commit fe1eb46)
@rintaro rintaro requested a review from a team as a code owner April 13, 2023 02:11
@rintaro
Copy link
Member Author

rintaro commented Apr 13, 2023

@swift-ci Please test

@rintaro rintaro merged commit b28bc8f into swiftlang:release/5.9 Apr 13, 2023
@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.

3 participants