I was curious about the state of gcc modules since I am eager to use them and took a look at the current status.
I did it via (after a couple checks on the best way to figure out):
git log --author=nathan@acm.org --since=2022-01-01 --reverse
It seems there are a few fixes and some refactorings and improvements/optimizations:
It seems gcc modules are implementing the strong ownership model (not the weak one as planned in principle), in line with what Microsoft is doing, finally:
``` c++: New module mangling ABIThis implements a new module mangling ABI as the original one has a few issues:
a) it was not demangleable (oops)
b) implemented a weak ownership model.
This implements a strong ownership model, so that exported entities from named modules are mangled to include their module attachment. This gives more informative linker diagnostics and better module isolation. Weak ownership was hoped to allow backwards compatibility with non-modular code, but in practice was very brittle, and C++20 added new semantics for linkage declarations that cover the needed functionality.
FAOD Clang is also moving to this ABI and documentation will be added to the Itanium ABI specification.
```
support for module language-decl semantics:
``` In modules purview, one can attach a declaration to the global module (i.e. not the named module in whence the declaration appears), using a language declaration: export module Foo;
extern "C++" void *operator new (std::size_t);
``` support for C++ modules in the demangler (I understand that strong ownership model).
local symbols do not get module mangling (no need for it since they are private anyway)
c++: Better module initializer code
Every module interface needs to emit a global initializer, but it might have nothing to init. In those cases, there's no need for any idempotency boolean to be emitted. c++: Prune unneeded macro locations
``` This implements garbage collection on locations within macro expansions, when streaming out a CMI. When doing the reachability walks, we now note which macro locations we need and then only write those locations. The complication here is that every macro expansion location has an independently calculated offset. This complicates writing, but reading remains the same -- the macro locations of a CMI continue to form a contiguous block.For std headers this reduced the number of macro maps by 40% and the number of locations by 16%. For a GMF including iostream, it reduced it by 80% and 60% respectively.
```
There are also some improvements to mangling: the modules ABI was not demangeable, that was corrected together with the inclusion of the strong ownership model.
There are also std manglings that are not applied if not in the global module, a fix I guess.
Great thanks to Nathan Sdwell for all the hard work!
Really eager to see modules in a usable state in the next Gcc release!