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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=101126
                 CC|                            |nshead at gcc dot gnu.org

--- Comment #11 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
(In reply to Rainer Deyke from comment #8)
> Consensus at [email protected] seems to be that the set of
> "importable headers" is meant to be a finite closed set of
> implementation-provided headers that does not include user-provided headers.
> a.hpp in my example is not supposed to be an "importable header".  Importing
> it should not turn it into an importable header.  Precompiling it should not
> turn it into turn it into an "importable header".  An #include of this
> header be turned into an import.

The actual issue here is PR101126; we don't support precompiled headers with
modules currently.  When you compile a header with modules support enabled, you
are promising the compiler that this is an importable header and are building a
CMI for it.

The default module mapper (for simple command-line usage, not really intended
for proper build systems) then assumes that any header it can see that's been
built is a valid importable header.  If you choose to instead use a custom
module mapper you can indicate which headers are intended to be importable (and
thus should undergo include translation) and which are not.  See also
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Preprocessing.html:

> Include translation converts #include, #include_next and #import directives
> to internal import declarations. Whether a particular directive is translated
> is controlled by the module mapper.

The mapper protocol itself is described in
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html and
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1184r2.pdf; see
section 4.9 of the latter to determine whether given headers are meant to be
part of the importable header list or not.

Reply via email to