scons icon indicating copy to clipboard operation
scons copied to clipboard

cxx20 module support for gcc

Open loonycyborg opened this issue 3 years ago • 8 comments

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:

  • [x] 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

loonycyborg avatar Oct 21 '22 18:10 loonycyborg

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

loonycyborg avatar Oct 21 '22 19:10 loonycyborg

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

mwichmann avatar Nov 11 '22 18:11 mwichmann

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.

ZhenyuChen-Boris avatar Sep 02 '23 02:09 ZhenyuChen-Boris

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?

mwichmann avatar Sep 02 '23 14:09 mwichmann

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?

ZhenyuChen-Boris avatar Sep 04 '23 07:09 ZhenyuChen-Boris

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.

mwichmann avatar Sep 04 '23 13:09 mwichmann

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

loonycyborg avatar Sep 06 '23 09:09 loonycyborg

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.

loonycyborg avatar Sep 17 '24 15:09 loonycyborg