C++ Logo

sg15

Advanced search

Re: [Tooling] Round2: Path to modules with old bad build systems

From: Boris Kolpackov <boris_at_[hidden]>
Date: Sun, 3 Mar 2019 16:34:18 +0200
Ben Craig <ben.craig_at_[hidden]> writes:

> The scheme I have in mind would result in no build throughput
> improvements with the old bad build systems, but I think it
> would still provide the isolation benefits of modules and be
> conforming.

I wonder if it could result in worse build throughput compared
to headers, thought?

To be conforming, not only the importing TU will have to be
isolated from any macros defined by the module interface, but
the module intreface will have to be isolated from any macros
definited by the importing TU (whether it should also be
isolated from macros defined on the command line is an
interesting question, BTW). And this isolation will have to
happen recursively, for modules imported by module interfaces.

Now consider a TU that imports a bunch of modules which in
turn each import a bunch more and all of them include some
common header, say <functional>. The above isolation rules
mean that each of those "module interface fragments" (for
the lack of better term) will include their own full copy
of <functional> (because the include guards will not be
defined; how this feature interact with #pragma once is
an intersting question, BTW).

Note also that the same kind of duplication applies to the
module interfaces themselves: if a TU imports a bunch of
modules which in turn each import the same module, its
interface fragment will be duplicated as well.

Received on 2019-03-03 15:34:27