[libcxx-commits] [PATCH] D119964: [libc++] Generated headers should first include <__config>

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 16 12:18:18 PST 2022


philnik added a comment.

In D119964#3327177 <https://reviews.llvm.org/D119964#3327177>, @Quuxplusone wrote:

> No, that definitely shouldn't be the case. There's no need to `#include <__config>` before `#include <algorithm>`, because `<algorithm>` itself includes `<__config>`.
> (And there's no need for `<algorithm>` to include `<__config>` before including `<__algorithm/adjacent_find.h>`, because `<__algorithm/adjacent_find.h>` itself includes `<__config>`! And so on.)

The problem is that we use macros from `<__config>`. This means that we might include a header that shouldn't be included. Just as an example, //maybe// we want to remove `<experimental/algorithm>`. That means that the first include in the list is conditionally included, but the header where the condition is set isn't included before the condition is checked. That means `<experimental/coroutine>` is always included, but might not be available in a configuration.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119964/new/

https://reviews.llvm.org/D119964



More information about the libcxx-commits mailing list