C++ Logo

sg15

Advanced search

Re: [Tooling] [isocpp-modules] Dependency format with module details implementation

From: Boris Kolpackov <boris_at_[hidden]>
Date: Fri, 12 Apr 2019 18:36:53 +0200
Ben Boeckel via Modules <modules_at_[hidden]> writes:

> Ah, true. However, the preprocessor can still figure this out. Still no
> BMI necessary.

Yes, this is what I listed as 2.a:

Boris Kolpackov <boris_at_[hidden]> writes:

> 2. Assume the compiler takes care of it somehow. As to how,
> there were several ideas:
>
> a) The compiler still preprocesses the header emulating
> the import semantics (macro isolation, etc).

And, IMO, it feels too much like brittle compiler magic. For
the record, here are a few more potential issues, after thinking
about it a bit:

1. Nested header imports: their macros should only be visible
   to the immediate importers.

2. Partial preprocessing (-fdirectives-only/-frewrite-include)
   will most likely require extra work.

3. Macro isolation would also mean that the include guards will
   be ignored as well. Which means things will have to be re-
   included over and over again. Consider:

   #include <functional> // Uses include guard.

   import <hello/core.hpp>; // Also includes <functional>.

   In fact, there was already a discussion about the potential
   performance problem of this approach.

Received on 2019-04-12 18:37:02