-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Platform] Update musl modulemap and improve musl platform support. #71840
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
Conversation
This sits on top of #71839. |
@swift-ci Please smoke test |
32c0ec4
to
8c268d6
Compare
@swift-ci Please smoke test |
export * | ||
} | ||
|
||
// POSIX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how we want to organize the rest of these. One module per header can start to cause performance issues, but having too many headers in a module can also cause performance issues. Is there some kind of logical grouping we might be able to use like filesystem, networking, etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess these are less likely than the C library headers to suffer from the circularity issues created by the builtin modules and the C++ library, so we probably could group them. I just broke them all out for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started looking at the Android module map that's being worked on to see how things were grouped there. I'm wondering if we should try to make things match. Not sure that's a goal right now, but it's an interesting question.
Thank you for doing this one! |
We also need to change the clang importer to not pass |
That is in this changeset as part of #71844. |
We need to declare separate top-level modules for every header in the musl C library. Note that our set-up here does require some tweaks to musl itself (specifically, the `alltypes.h` header needs some fairly serious massaging to make it module compatible; in particular, we need to pull out every type declaration into its own separate modularized header in `bits/types`). Also update `Platform.swift` a little for more musl support. rdar://123503615
Added the _modules workaround to make the compiler pull in the correct module when someone does `import stdc_assert` (for instance). Fix various niggles. rdar://123503615
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really wouldn't do the one module per header thing for the non-libc ones. That's proving to be not very good for performance if more than a small handful get used. But mostly I'd like to rename the libc ones to be consistent with other modules.
// ensures that e.g. `import stdc_float` will result in pulling in the Clang | ||
// or libc++ versions as expected. | ||
|
||
module _stdc_assert [system] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The names we've started using in other places are _assert
and assert_h
. The "_h" pattern is already used in the libc++ modules, and it's also in use in other places. I think it's also a little confusing that stdc_assert
would get you C++ headers, so IMO assert_h
is probably the best name to go with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the names of the C library headers to match.
The Darwin headers have a naming convention for these modules; we should match it. rdar://123503615
@swift-ci Please smoke test |
@swift-ci Please smoke test |
We need to declare separate top-level modules for every header in the musl C library. Note that our set-up here does require some tweaks to musl itself (specifically, the
alltypes.h
header needs some fairly serious massaging to make it module compatible; in particular, we need to pull out every type declaration into its own separate modularized header inbits/types
).Also update
Platform.swift
a little for more musl support.rdar://123503615