C++ Logo

sg15

Advanced search

Re: Header units and dependency scanning

From: Michael Spencer <bigcheesegs_at_[hidden]>
Date: Tue, 14 Jun 2022 14:41:05 -0700
On Thu, Jun 9, 2022 at 10:31 AM Daniel Ruoso via SG15 <sg15_at_[hidden]>
wrote:

> I'm continuing my effort to create a coherent mental model of how
> header units need to work, and I just realized something that looks
> problematic.
>
> Let's suppose you have the header foo.h:
>
> ```
> #ifndef INCLUDED_FOO_H
> #define INCLUDED_FOO_H
> #define SOMETHING 1
> #endif
> ```
>
> Now, let's suppose you have another header, let's say bar.h, with:
>
> ```
> import <foo.h>
> #ifdef SOMETHING
> import <something.h>
> #else
> import <somethingelse.h>
> #endif
> ```
>
> Let's suppose both `foo.h` and `bar.h` are importable headers.
>
> In the dependency scanning phase, we're not expected to have a bmi for
> all units yet, since we don't know the order in which we're meant to
> process them.
>
> How is the dependency scanning supposed to work in that case?
>
> Or am I fundamentally misunderstanding how this works?
>
> daniel
>

clang-scan-deps currently reports dependencies on <foo.h> and <something.h>
(using include translation, as `import` isn't supported yet).

- Michael Spencer

Received on 2022-06-14 21:41:19