Skip to content
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

Discussion: C++ modules support #9938

Open
geekosaur opened this issue Apr 25, 2024 · 1 comment
Open

Discussion: C++ modules support #9938

geekosaur opened this issue Apr 25, 2024 · 1 comment

Comments

@geekosaur
Copy link
Collaborator

geekosaur commented Apr 25, 2024

This came up in the context of building C and C++ sources in parallel. I don't see either an issue or a PR for it currently.

Describe the feature request
If C / C++ sources are to be built in parallel, an exception would need to be made for C++20 modules, which need to be at minimum compiled to CMIs (roughly the equivalent of .hi files) before C++ sources that import them are compiled.

At present, only clang++ supports separate compilation of CMIs, so we can't separate that phase out; moreover, g++ doesn't use a distinct suffix for importable modules (clang++ recommends .cppm), so source inspection would be necessary to distinguish modules.

There is also a question of whether we should attempt a topological sort of C++ module dependencies to ensure that modules are built in the correct order, or to push that onto the user by making them list them in the desired order in c++-sources. (That said, I seem to recall something in flight which changes our storage of those into sets, which would mean we lose that ordering.)

References
Clang: https://clang.llvm.org/docs/StandardCPlusPlusModules.html
G++: https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Modules.html

@geekosaur
Copy link
Collaborator Author

geekosaur commented Apr 25, 2024

Note: this ticket is mostly to make it more discoverable than the discussion in the past two cabal calls. Also, I am unlikely to be involved in implementation, as while I contribute to a C++ project, I am in no sense a C++ developer.

@geekosaur geekosaur removed their assignment Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant