aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2024-05-16 16:09:12 -0400
committerJason Merrill <jason@redhat.com>2024-05-29 09:48:05 -0400
commitff41abdca0ab9993b6170b9b1f46b3a40921f1b0 (patch)
tree24a581f44760ca6565531b62091634ed064381a7 /gcc/doc
parent18f477980c8597fe3dca2c2e8bd533c0c2b17aa6 (diff)
downloadgcc-ff41abdca0ab9993b6170b9b1f46b3a40921f1b0.zip
gcc-ff41abdca0ab9993b6170b9b1f46b3a40921f1b0.tar.gz
gcc-ff41abdca0ab9993b6170b9b1f46b3a40921f1b0.tar.bz2
c++: add module extensions
There is a trend in the broader C++ community to use a different extension for module interface units, even though (in GCC) they are compiled in the same way as other source files. Let's recognize these extensions as C++. .ixx is the MSVC standard, while the .c*m are supported by Clang. libc++ standard headers use .cppm, as their other source files use .cpp. Perhaps libstdc++ might use .ccm for parallel consistency? One issue with .c++m is that libcpp/mkdeps.cc has been using it for the phony dependencies to express module dependencies, so I'm changing mkdeps to something less likely to be an actual file, ".c++-module". gcc/cp/ChangeLog: * lang-specs.h: Add module interface extensions. gcc/ChangeLog: * doc/invoke.texi: Update module extension docs. libcpp/ChangeLog: * mkdeps.cc (make_write): Change .c++m to .c++-module. gcc/testsuite/ChangeLog: * g++.dg/modules/dep-1_a.C * g++.dg/modules/dep-1_b.C * g++.dg/modules/dep-2.C: Change .c++m to .c++-module.
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/invoke.texi20
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 2cba380..517a782 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -2317,9 +2317,12 @@ other language.
C++ source files conventionally use one of the suffixes @samp{.C},
@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
-@samp{.H}, or (for shared template code) @samp{.tcc}; and
-preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
-files with these names and compiles them as C++ programs even if you
+@samp{.H}, or (for shared template code) @samp{.tcc};
+preprocessed C++ files use the suffix @samp{.ii}; and C++20 module interface
+units sometimes use @samp{.ixx}, @samp{.cppm}, @samp{.cxxm}, @samp{.c++m},
+or @samp{.ccm}.
+
+GCC recognizes files with these names and compiles them as C++ programs even if you
call the compiler the same way as for compiling C programs (usually
with the name @command{gcc}).
@@ -37705,13 +37708,10 @@ Modular compilation is @emph{not} enabled with just the
version selected, although in pre-C++20 versions, it is of course an
extension.
-No new source file suffixes are required or supported. If you wish to
-use a non-standard suffix (@pxref{Overall Options}), you also need
-to provide a @option{-x c++} option too.@footnote{Some users like to
-distinguish module interface files with a new suffix, such as naming
-the source @code{module.cppm}, which involves
-teaching all tools about the new suffix. A different scheme, such as
-naming @code{module-m.cpp} would be less invasive.}
+No new source file suffixes are required. A few suffixes preferred
+for module interface units by other compilers (e.g. @samp{.ixx},
+@samp{.cppm}) are supported, but files with these suffixes are treated
+the same as any other C++ source file.
Compiling a module interface unit produces an additional output (to
the assembly or object file), called a Compiled Module Interface