[libcxx-commits] [PATCH] D151900: [libc++][NFC] Create a new folder for config-related headers.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 7 13:32:42 PDT 2023


ldionne added inline comments.


================
Comment at: libcxx/include/__config_dir/base.h:12
+#define _LIBCPP___CONFIG_DIR_BASE_H
 
 #include <__config_site>
----------------
Mordante wrote:
> I actually would rather like to see how you envision the final split, this is the normal way how we granularize headers.
> 
> I also think we should never include one of the granularized headers from headers outside of `__config/`, except from `config`. Here I feel that including the granularized headers could easily result in bugs. A define not set might be on purpose or a bug due to forgetting an include.
> So I think we need generated tests verify tests that give an error when I write code like
> 
> ```
> #include <__config/constexpr.h>
> ```
> From a header like `<format>`.
> 
+1, this makes sense to me. Here's a few categories we spotted easily during live review:

```
environment.h or versions.h // detects compiler and language version
abi.h // all the ABI flags
visibility.h // all the macros related to visibility annotations, DLL_VIS, etc.
compiler_shims.h // maybe for things like `#define __has_attribute(x) 0` depending on what's the use of those
random.h // we have stuff related to random device
endian.h // endianness detection
????.h // detection of stuff like _LIBCPP_HAS_OBJC_ARC
deprecation.h // we have a bunch of deprecation macros
```

I still suggest we keep the uncategorized rest into `base.h` or we might end up with really small headers, but I'd be fine with that too.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151900



More information about the libcxx-commits mailing list