C++ Logo

sg15

Advanced search

Re: "logical name" of importable headers

From: Gabriel Dos Reis <gdr_at_[hidden]>
Date: Mon, 6 Jun 2022 22:36:30 +0000
[Daniel]

  * I'd advocate for giving the compiler the tuple with the token, the header file and the BMI. That way it would always use the same header, even if not replacing the include by an import.

Yes, we do want the formalized mechanism to provide a minimum of coherence as you’re pointing out.

-- Gaby

From: Daniel Ruoso <daniel_at_[hidden]>
Sent: Monday, June 6, 2022 3:26 PM
To: Gabriel Dos Reis <gdr_at_[hidden]>
Cc: sg15_at_[hidden]ocpp.org; Boris Kolpackov <boris_at_[hidden]>
Subject: Re: [SG15] "logical name" of importable headers

Actually, on a second thought, there is one thing that I think is still problematic.

When the compiler is not replacing includes by imports, it would still result in different headers, which I think is going to generate a lot of confusion.

I'd advocate for giving the compiler the tuple with the token, the header file and the BMI. That way it would always use the same header, even if not replacing the include by an import.

Daniel

On Mon, Jun 6, 2022, 17:21 Daniel Ruoso <daniel_at_[hidden]<mailto:daniel_at_[hidden]>> wrote:
Great. So that matches exactly what I was advocating for.

I'll try to write a paper summarizing all this, and advocating for that approach on all implementations.

On Mon, Jun 6, 2022, 17:19 Gabriel Dos Reis <gdr_at_[hidden]<mailto:gdr_at_[hidden]>> wrote:
[Daniel]
> I may have misunderstood. When the following argument is given:
>
> /headerUnit:angle foo.h=/some/foo.h.ifc
>
> Does that mean MSVC will not perform a lookup in the include
> directories and will just apply that for both `#include <foo.h>` and
> `import <foo.h>`? Even if no there was no foo.h in any of the include
> directories?

No, MSVC does not look up via include directories before applying the mapping of
      import <foo.h>;

to the corresponding IFC. Additionally, if you have /translateInclude and

     #include <foo.h>;

it will not look up in the include directory.

However, if you specify

   /headerUnit /some/absolute/path/to/foo.h=/some/foo.h.ifc

and you have

   #include <foo.h>

it would first look up <foo.h> via the include directories. If the selected source file happens to match the mapping specified then it will the IFC.

-- Gaby

-----Original Message-----
From: Daniel Ruoso <daniel_at_ruoso.com<mailto:daniel_at_[hidden]>>
Sent: Monday, June 6, 2022 1:15 PM
To: Gabriel Dos Reis <gdr_at_[hidden]<mailto:gdr_at_[hidden]>>
Cc: sg15_at_[hidden]<mailto:sg15_at_[hidden]>; Boris Kolpackov <boris_at_[hidden]<mailto:boris_at_[hidden]>>
Subject: Re: [SG15] "logical name" of importable headers

Em seg., 6 de jun. de 2022 às 15:21, Gabriel Dos Reis
<gdr_at_microsoft.com<mailto:gdr_at_[hidden]>> escreveu:
> > Specifically, the input to the compiler would be a map from the token
> > used after include or import to the header file and the bmi for that
> > header unit.
> I think is what MSVC does... no?

I may have misunderstood. When the following argument is given:

  /headerUnit:angle foo.h=/some/foo.h.ifc

Does that mean MSVC will not perform a lookup in the include
directories and will just apply that for both `#include <foo.h>` and
`import <foo.h>`? Even if no there was no foo.h in any of the include
directories?

Is there ever a situation where the compiler would need the path to
the original header?

daniel

Received on 2022-06-06 22:36:34