https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120108

            Bug ID: 120108
           Summary: Feature request: Command-line option to rename module
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marcel at laverdet dot com
  Target Milestone: ---

GCC 15 implements P3034R1 [https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114461]
which disallows preprocessor macros in module names. The paper specifically
calls out that preprocessor #include directives may be a severe problem for
build systems, but this wouldn't be an issue with immediately-known
command-line defines.

root[20:13:27] [/workspace] $ echo 'export module a;' | gcc-14 -xc++ -c
-fmodules-ts -D a=b -
root[20:13:36] [/workspace] $ echo 'export module a;' | gcc-15 -xc++ -c
-fmodules-ts -D a=b -
<stdin>:1:15: error: module name ‘a’ cannot be an object-like macro

I'm sure this seems like an "XY Problem" so I will add more context. I am using
modules in a project which must link against two versions Google's v8 runtime.
There is a great deal of source-compatible code, but a different ABI. This code
lives in a particular module and I use a preprocessor macro to rename modules
from one source file into two modules. As a workaround I am physically copying
the source files and preprocessing them before compilation:
https://github.com/laverdet/isolated-vm/blob/d94ccd964c09c90dbfc5ab38ae3b269eb9243f55/CMakeLists.txt#L142-L177

Reply via email to