Tested x86_64-pc-linux-gnu.  Any thoughts about the mkdeps output?

-- 8< --

There is a trend in the broader C++ community to use a different extension
for module interface units, even though they are compiled in the same way as
other source files.  Let's also support these extensions.

.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++ will use .ccm for parallel consistency?

One issue with .c++m is that libcpp/mkdeps.cc uses it for the phony
dependencies to express module dependencies, so I'm disabling that one for
now.  We probably want to change the extension that mkdeps uses to something
less likely to be an actual file, say .module? .c++-module?

gcc/cp/ChangeLog:

        * lang-specs.h: Add module interface extensions.
---
 gcc/cp/lang-specs.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index 7a7f5ff0ab5..74b450fd66e 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -39,6 +39,14 @@ along with GCC; see the file COPYING3.  If not see
   {".HPP", "@c++-header", 0, 0, 0},
   {".tcc", "@c++-header", 0, 0, 0},
   {".hh",  "@c++-header", 0, 0, 0},
+  /* Module interface unit.  Do we also want a .C counterpart?
+     Skipping .c++m for now at least to avoid conflicts with .PHONY .c++m
+     files in mkdeps.cc output.  */
+  {".ixx", "@c++", 0, 0, 0}, /* MSVC */
+  {".cppm", "@c++", 0, 0, 0}, /* Clang/libc++ */
+  {".cxxm", "@c++", 0, 0, 0},
+  /* {".c++m", "@c++", 0, 0, 0}, */
+  {".ccm", "@c++", 0, 0, 0},
   {"@c++-header",
       "%{E|M|MM:cc1plus -E %{fmodules-ts:-fdirectives-only -fmodule-header}"
       "  %(cpp_options) %2 %(cpp_debug_options)}"

base-commit: 1a5e4dd83788ea4c049d354d83ad58a6a3d747e6
prerequisite-patch-id: 3c000c95725bc74cff0b0e33fac97055caa64e7e
-- 
2.44.0

Reply via email to