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

cxx20 module support for gcc #4248

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft

Conversation

loonycyborg
Copy link

@loonycyborg loonycyborg commented Oct 21, 2022

C++ module support

This PR is aimed is aimed at adding support for C++20 modules for gcc, perhaps also adding infrastructure that could be reused by clang/msvc. Intended interface is to enable module support only if CXXMODULEPATH is set to non-empty path and store module files there.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt (and read the README.rst)
  • I have updated the appropriate documentation

@bdbaddog bdbaddog added the c++20 Features new in the 2020 C++ Standard label Oct 21, 2022
@loonycyborg
Copy link
Author

GCC general documentation on modules:
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Modules.html
Module mapper documentation:
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html

@mwichmann
Copy link
Collaborator

mwichmann commented Nov 11, 2022

Since there are some other links in the long-running discussion, plus notes on how clang does things, thought I'd mention the Bazel project's issue bazelbuild/bazel#4005

@BorisChenCZY
Copy link

Hey how's this commit going? Any one still following up?
If not, I'm kind of interested in this and could be able to pick it up.

@mwichmann
Copy link
Collaborator

Any contributions here welcome. We perhaps should have a better place for "discussion" about the right design for this (the one in the PR may in fact be that). In the meantime, this link can be a partial starting point, since it describes a problem and has more links:

https://github.com/urnathan/libcody

There's a newer version of 1184:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1184r2.pdf

Not sure if the mapper/build communication stuff is overkill for a first cut at supporting modules. As I said - maybe a separate location for discussion?

@BorisChenCZY
Copy link

Good to know. But sorry I'm kind of confused by now. Cuz I saw this commit in bazel's issues. But it seems that this is another repo. I'm wondering what's the relationship between these two?

@mwichmann
Copy link
Collaborator

relationship? just a problem that all the build systems have to solve, in the face of a not really unified compiler approach to tackling it.

@loonycyborg
Copy link
Author

We have a channel for this on Discord.
I'll likely prioritize working on this if some other people actually review/try it.

@loonycyborg
Copy link
Author

Full blown compiler/buildsystem communication is only used because it's the only way to see actual paths for system headers to support header imports of form import <iostream>;. So mostly I used it because I desire this feature for my own use. However I prefer import std; and thus wouldn't have particular need for system header imports anymore once this is implemented:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106852
Maybe could redo this to use plain file lists instead of mapper then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++20 Features new in the 2020 C++ Standard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants