Skip to content

[Clang] Prioritise built-in headers, even on musl. #8862

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 2 commits into from
Jun 7, 2024

Conversation

al45tair
Copy link

@al45tair al45tair commented Jun 6, 2024

Clang was putting its built-in headers at the end of the search path if running on musl; this was a mistake, because it breaks libc++, as the latter tries to include the built-in header and then the #include_next in the built-in header fails.

The right solution here is to have the built-in headers remain in their usual location in the search path, and then if it's desirable to override them for musl, have them explicitly include the musl header with #include_next. This is the solution that is already in use for other platforms.

rdar://118881637

al45tair added 2 commits June 6, 2024 14:57
Clang was putting its built-in headers at the end of the search path
if running on musl; this was a mistake, because it breaks libc++, as
the latter tries to include the built-in header and then the
`#include_next` in the built-in header fails.

The right solution here is to have the built-in headers remain in
their usual location in the search path, and then if it's desirable
to override them for musl, have them explicitly include the musl
header with `#include_next`.  This is the solution that is already
in use for other platforms.

rdar://118881637
There was a test for the broken header search order that I hadn't
spotted.  Remove it; we should be using the same search order
everywhere.

rdar://118881637
@al45tair
Copy link
Author

al45tair commented Jun 6, 2024

This is a cherry pick of #8253, with an additional fix from #8397.

@al45tair al45tair merged commit d945d25 into swiftlang:next Jun 7, 2024
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.

1 participant