public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH RFC] c++: add module extensions
@ 2024-05-22 13:59 Jason Merrill
  2024-05-29 13:42 ` [pushed] " Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Merrill @ 2024-05-22 13:59 UTC (permalink / raw)
  To: gcc-patches

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-29 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-22 13:59 [PATCH RFC] c++: add module extensions Jason Merrill
2024-05-29 13:42 ` [pushed] " Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).