C++20 Modules Compiler Code Under Review, Could Still Land For GCC 11

Written by Michael Larabel in GNU on 4 November 2020 at 09:07 AM EST. 10 Comments
GNU
With C++20 one of the major features added is that of modules as a modern alternative to that of conventional C++ header files for packages. The C++20 modules code for the GNU Compiler Collection that has been in the works for several years is now under review and could potentially still land for the GCC 11 release next year.

C++20 modules should allow for better isolation, avoiding the abundance of header files on systems, better structure code, and also possible better compilation performance. Of course, modules don't come for free and developers need to explicitly make use of the new language functionality. On the compiler side LLVM Clang 11 and newer has support for some elements of C++20 modules albeit incomplete. The GNU Compiler Collection has also been working on modules support for a while and it's looking like the initial support could make it into the GCC 11 release due out in March~April.

GCC 11 feature development is ending this month but Nathan Sidwell sent out the initial implementation on the patches mailing list on Tuesday. The current C++20 modules implementation is 32 patches and adds some 25k lines of new code to the compiler.

Some features of C++20 modules are not yet implemented around private module fragments, complete type (in)visibility, and more, but he is hoping to address the most significant shortcomings still in time for stage one (the current GCC 11 feature development). The code so far has been tested in Linux x86_64 / AArch64 / POWER, among other targets.

This C++20 modules code under review for GCC can be found on the gcc-patches mailing list. Hopefully the preliminary implementation will indeed make it for GCC 11.

GCC has already implemented much of C++20 over the past few years while some remaining bits are included already for GCC 11. The main component missing is this modules support along with using enum support, atomic compare-and-exchange with padding bits, and other minor bits missing. The current standards support for this GNU compiler is outlined via the cxx-status documentation.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week