On Fri, Feb 27, 2026 at 10:01:22PM +0200, Jean-Christian CÎRSTEA wrote:
> > I think I'd also like to see a simple testcase using a module mapper file; 
> > see
> > e.g.  g++.dg/modules/map-1* for an example.
> 
> I don't fully understand how module mapper file tests work. If you think it is
> crucial to add this to this patch, could you point me the appropriate
> documentation?

https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html

Here's an example of what I was thinking:

diff --git a/gcc/testsuite/g++.dg/modules/pr120458-2.map 
b/gcc/testsuite/g++.dg/modules/pr120458-2.map
new file mode 100644
index 00000000000..8ab5d846578
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr120458-2.map
@@ -0,0 +1,3 @@
+$root .
+汉字 pr120458-2_a.gcm
+étrange pr120458-2_b.gcm
diff --git a/gcc/testsuite/g++.dg/modules/pr120458-2_a.C 
b/gcc/testsuite/g++.dg/modules/pr120458-2_a.C
new file mode 100644
index 00000000000..da5c0c1ee16
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr120458-2_a.C
@@ -0,0 +1,9 @@
+// { dg-additional-options "-fmodules -fmodule-mapper=[srcdir]/pr120458-2.map 
-finput-charset=UTF-8" }
+// { dg-additional-files pr120458-2.map }
+
+export module 汉字;
+// { dg-module-cmi "=pr120458-2_a.gcm" }
+
+export unsigned f(unsigned x) {
+        return x + 3;
...skipping...
+export module 汉字;
+// { dg-module-cmi "=pr120458-2_a.gcm" }
+
+export unsigned f(unsigned x) {
+        return x + 3;
+}
diff --git a/gcc/testsuite/g++.dg/modules/pr120458-2_b.C 
b/gcc/testsuite/g++.dg/modules/pr120458-2_b.C
new file mode 100644
index 00000000000..60897d9e138
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr120458-2_b.C
@@ -0,0 +1,11 @@
+// { dg-additional-options "-fmodules -fmodule-mapper=[srcdir]/pr120458-2.map 
-finput-charset=UTF-8" }
+// { dg-additional-files pr120458-2.map }
+
+export module étrange;
+// { dg-module-cmi "=pr120458-2_b.gcm" }
+
+import 汉字;
+
+export unsigned g(unsigned x) {
+        return f(x) * 7;
+}

Reply via email to