The pathname underneath gcm.cache/ is determined from the effective name
used for the main input file of a particular module. When modules are
built, no canonicalization occurs for the main input file. Hence the
module file wouldn't be found if a different (the canonicalized) file
name was used when importing that same module. (This is an effect of
importing happening in the preprocessor, just like #include handling.)
Since it doesn't look easy to make module generation use libcpp's
maybe_shorter_path() (in fact I'd consider this a layering violation,
while cloning the logic would - at least in principle - be prone to both
going out of sync), simply suppress system header path canonicalization
for the respective tests.
gcc/testsuite/
* g++.dg/modules/alias-1_b.C: Add -fno-canonical-system-headers.
* g++.dg/modules/alias-1_d.C: Likewise.
* g++.dg/modules/alias-1_e.C: Likewise.
* g++.dg/modules/alias-1_f.C: Likewise.
* g++.dg/modules/cpp-6_c.C: Likewise.
* g++.dg/modules/dir-only-2_b.C: Likewise.
-// { dg-additional-options "-fmodules-ts -fdump-lang-module -isystem [srcdir]" }
+// { dg-additional-options "-fmodules-ts -fdump-lang-module -isystem [srcdir] -fno-canonical-system-headers" }
// Alias at the header file. We have one CMI file
import "alias-1_a.H";
-// { dg-additional-options "-fmodules-ts -isystem [srcdir]" }
+// { dg-additional-options "-fmodules-ts -isystem [srcdir] -fno-canonical-system-headers" }
// { dg-module-cmi kevin }
export module kevin;
-// { dg-additional-options "-fmodules-ts -isystem [srcdir]" }
+// { dg-additional-options "-fmodules-ts -isystem [srcdir] -fno-canonical-system-headers" }
import bob;
import kevin;
-// { dg-additional-options "-fmodules-ts -fdump-lang-module -isystem [srcdir]" }
+// { dg-additional-options "-fmodules-ts -fdump-lang-module -isystem [srcdir] -fno-canonical-system-headers" }
import kevin;
import bob;
// { dg-do preprocess }
-// { dg-additional-options "-fmodules-ts -isystem [srcdir]" }
+// { dg-additional-options "-fmodules-ts -isystem [srcdir] -fno-canonical-system-headers" }
#define empty
#define nop(X) X
// { dg-do preprocess }
-// { dg-additional-options "-fmodules-ts -fdirectives-only -isystem [srcdir]" }
+// { dg-additional-options "-fmodules-ts -fdirectives-only -isystem [srcdir] -fno-canonical-system-headers" }
// a comment
module; // line
frob