[libcxx-commits] [libcxx] [libc++] Split up ABI and platform configuration to their own headers (PR #90863)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri May 3 13:06:43 PDT 2024
ldionne wrote:
> I would really really really like to keep config as a single file.
>
> I find tracing context across multiple split files to be harder than doing it across a single file.
I believe this is subjective, because I find the exact opposite. I find it a lot easier to understand the organization of things when they are grouped logically and separated into headers as makes sense. I'm not arguing for a hundred small configuration headers here, just a few broad categories as makes sense. `__config` has 1200 lines, it's very difficult to navigate as-is.
>
> It's certainly true that `__config` is a monolith, and it is a bit hairy. I think this new approach adds more complexity than it addresses. In particular I'm concerned about how this may affect modules.
These headers are all textual, so I don't think this split would cause any issues. Do you have specific concerns in mind w.r.t. modules?
> Additionally, `__config` has restrictions on what it can do (it can't include other headers*, it can't depend on other internals, etc). I'm concerned it'll be harder to treat a group of headers with the same care and concern that `__config` currently gets.
>
> Most of the current issues could be addressed by using `#else` and `#endif` comments, and adding comment banners to separate logical sections.
This comment makes me think that we both agree that grouping the configuration settings logically makes sense. It then becomes a matter of whether they should live in separate headers or not. I will argue that seeing different headers in the navigation bar (for example) makes it easier to jump to the group that you want, instead of having to scroll to all the lines in `__config` to find the commented block you're looking for.
>
> I think the issues with `_LIBCPP_ABI_ALTERNATIVE_LAYOUT` was that it was defined in the wrong part of the file entirely, as we have normally configured the ABI. It should have also been tested better?
This kind of issue is less likely to happen when things are split in a logical manner instead of crammed in a file with 1200 lines.
This change is motivated by the desire to expand our ABI configuration facilities and formalize them better in a way similar to what we have for `__availability`. I am reluctant to do that in the current state of things due to `__config` being basically a huge monolithic mess, and expanding the ABI configuration would just make that even bigger. Note that `__availability` is a configuration header exactly like `__configuration/abi.h` would become, and in fact I'd move `__availability` to `__configuration/availability.h` in the future. I don't know if you'd agree that `__config` would not be made simpler by the concatenation of `__availability` to it, but if so this change basically operates under the same principle.
https://github.com/llvm/llvm-project/pull/90863
More information about the libcxx-commits
mailing list