C++ Logo

sg15

Advanced search

Re: P2898R0: Importable Headers are Not Universally Implementable

From: Ben Boeckel <ben.boeckel_at_[hidden]>
Date: Fri, 26 May 2023 08:53:30 -0400
On Fri, May 26, 2023 at 13:55:43 +0200, Mathias Stearn via SG15 wrote:
> Given the note in http://eel.is/c++draft/cpp.import#5 applying to the
> definition of the term "macro definition", we should probably change the
> CWG2732 note to say something like "macro definitions and predefined
> macros". While -D predefined macros are somewhat outside the scope of the
> standard, and the standard has no concept of a build using different values
> for the standardized predefined macros for different TUs (which is
> unfortunately common practice), I think we should be clear (in a note)
> that the predefined macros used for a header unit are those used when
> compiling *its* TU, not the importer's.

What about other flags that affect preprocessor state? This includes
things like `-m` flags and `-f` flags that can affect things like
`__x86_64__` definitions and `__has_builtin` queries.

If we can get into the standard that a TU's flags that get used for a
BMI are "trusted" (in some sense) it would seem to me that we'd be a lot
closer to being able to build fewer BMIs for a given header unit. I
suspect that such a thing is signing up implementations for a lot more
work though.

--Ben

Received on 2023-05-26 12:53:32