Date: Fri, 10 Jun 2022 10:35:42 +0200
Daniel Ruoso via SG15 <sg15_at_[hidden]> writes:
> 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?
The current "state of the art" is to scan the headers themselves,
as if they were #include'ed.
But just treating them as real #include's won't be conforming,
consider:
```
#ifndef INCLUDED_FOO_H
#define INCLUDED_FOO_H
#ifdef FOO
# define SOMETHING 1
#endif
#endif
```
```
#define FOO
import <foo.h>; // Should not "see" FOO.
#include <foo.h> // Should "see" FOO.
```
So the plan is to scan the headers themselves but recreating
the importation semantics with regards to macro isolation.
But this has potential scalability issues. The most recent
thread on this top starts here:
https://lists.isocpp.org/ext/2022/04/19015.php
(It's also available in the public sg15 archives except for
the first email: https://lists.isocpp.org/sg15/2022/05/1531.php).
> 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?
The current "state of the art" is to scan the headers themselves,
as if they were #include'ed.
But just treating them as real #include's won't be conforming,
consider:
```
#ifndef INCLUDED_FOO_H
#define INCLUDED_FOO_H
#ifdef FOO
# define SOMETHING 1
#endif
#endif
```
```
#define FOO
import <foo.h>; // Should not "see" FOO.
#include <foo.h> // Should "see" FOO.
```
So the plan is to scan the headers themselves but recreating
the importation semantics with regards to macro isolation.
But this has potential scalability issues. The most recent
thread on this top starts here:
https://lists.isocpp.org/ext/2022/04/19015.php
(It's also available in the public sg15 archives except for
the first email: https://lists.isocpp.org/sg15/2022/05/1531.php).
Received on 2022-06-10 08:35:49