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

Boris Kolpackov boris at codesynthesis.com
Fri Apr 12 18:36:53 CEST 2019


Ben Boeckel via Modules <modules at lists.isocpp.org> 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 codesynthesis.com> 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.


More information about the Tooling mailing list