C++ Logo

sg15

Advanced search

Re: [isocpp-core] Named modules, macros, and re-exporting header units

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Wed, 21 Dec 2022 21:02:17 +0100
On 21/12/2022 19.47, Gabriel Dos Reis via Core wrote:
> [Richard]
>
> * We already have explicit normative text that says the right thing, but given that an implementer has read it and misunderstood, it seems like it's not clear enough and that rules describing phase 7 of translation are being incorrectly applied in phase 4 as well.
>
>
>
> It looks to me as if the text in section 10.3 <https://eel.is/c++draft/module.import> itself is actively inviting that kind of confusion. For example, the note 4 <https://eel.is/c++draft/module.import#note-4> says
>
>
>
> [/Note 4 <https://eel.is/c++draft/module.import#note-4>/: A /module-import-declaration/ <https://eel.is/c++draft/module.import#nt:module-import-declaration> nominating a /header-name/ <https://eel.is/c++draft/lex.header#nt:header-name> is also recognized by the preprocessor, and results in macros defined at the end of phase 4 of translation of the header unit being made visible as described in [cpp.import] <https://eel.is/c++draft/cpp.import>. <https://eel.is/c++draft/module.import#5.sentence-6> Any other /module-import-declaration/ <https://eel.is/c++draft/module.import#nt:module-import-declaration> does not make macros visible. <https://eel.is/c++draft/module.import#5.sentence-7> — /end note/]
>
>
>
> How can a /module-import-declaration/ be recognized by the preprocessor? Which production makes that possible?

Would something like

"The pp-tokens comprising a /module-import-declaration/ that nominates
a /header-name/ are also recognized by the preprocessor as a pp-import
directive, and result in macros defined at the end of phase 4 of
translation of the header unit being made visible as described
in [cpp.import]."

be better, in your view?

Jens

Received on 2022-12-21 20:02:24