Skip to content

[ClangImporter][ModuleWrap] Turn off libc warnings. #76545

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
Oct 1, 2024

Conversation

al45tair
Copy link
Contributor

swift-modulewrap uses the ClangImporter to obtain a module loader, but it doesn't take an SDK argument (nor does anything bother to pass one), which means that when cross-compiling you get warnings about not being able to find the C library.

Suppress the warning by telling the ClangImporter that we don't care about the C library here.

rdar://115918181

`swift-modulewrap` uses the `ClangImporter` to obtain a module loader,
but it doesn't take an SDK argument (nor does anything bother to pass
one), which means that when cross-compiling you get warnings about not
being able to find the C library.

Suppress the warning by telling the `ClangImporter` that we don't care
about the C library here.

rdar://115918181
@al45tair
Copy link
Contributor Author

@swift-ci Please test

Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

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

Does modulewrap need to access Swift symbols that are imported from C/C++? e.g. if the Swift module exposes a C struct in its public interface.

If not, this LGTM.

@al45tair
Copy link
Contributor Author

Hmmm. Maybe I should make it try to set up the file mapping and just not fail the same way, rather than turning it off completely. (I'm not sure whether it might need C/C++ symbols; it plainly doesn't for the things I've tried with the Static SDK, and I think this problem happens for other cross-compilation situations too, but I'm not confident enough that I'm entirely comfortable.)

We should still try adding the overlays, even if we're asked not to
generate a diagnostic while doing so.  That's slightly safer because
it means that we're less likely to find ourselves in a situation
where `swift-modulewrap` wants to use types from the C/C++ library
and can't.

rdar://115918181
@al45tair al45tair requested a review from Xazax-hun as a code owner September 30, 2024 16:04
@al45tair
Copy link
Contributor Author

@swift-ci Please test

Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me, thanks!

@al45tair
Copy link
Contributor Author

al45tair commented Oct 1, 2024

@swift-ci Please smoke test macOS platform

@al45tair
Copy link
Contributor Author

al45tair commented Oct 1, 2024

macOS test failure isn't related to this PR, as far as I can tell.

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.

2 participants