C++ Logo


Advanced search

Re: [isocpp-ext] Can we expect that all C++ source files can have the same suffix?

From: Boris Kolpackov <boris_at_[hidden]>
Date: Thu, 12 May 2022 05:44:09 +0200
[Switched to the new SG15 mailing list.]

Michael Spencer <bigcheesegs_at_[hidden]> writes:

> On Fri, Apr 15, 2022 at 5:42 AM Boris Kolpackov via Ext <
> > Sure, module mapper approach is not without its complications (I
> > even wrote a paper on this). But so far the only proposed alternative
> > is to pre-scan the world, which doesn't feel scalable (and, as you
> > know, I have doubts it can be implemented correctly for header units).
> >
> We have already deployed this for Clang modules. I don't see anything about
> header units that would make our approach invalid.

Do you provide the macro isolation semantics for header units during
the scan (not sure if it applies to Clang modules)? Here is a C++20
modules example that illustrates the problem:

// file: header-unit.hpp
#ifdef BAR
#define FOO

// file: importer.cpp
#define BAR
import "header-unit.hpp"; // Should not "see" BAR.
//#include "header-unit.hpp" // Should "see" BAR.

#ifdef FOO
import "header-unit2.hpp";

Received on 2022-05-12 03:44:14