[libcxx-commits] [libcxx] [libc++][NFC] Refactor _LIBCPP_AVAILABILITY_HAS_* macros to always be defined (PR #71002)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 28 13:40:13 PDT 2024


ldionne wrote:

> What I was trying to say is, gating `_LIBCPP_ASSERTION_HANDLER` on debug/release mode is not sufficient to prevent code size increase in the relase mode. There are dozens of places in libc++ that directly call `_LIBCPP_VERBOSE_ABORT`, like these:
> 
> [...]
>
> or this:
> [...]
> 
> 
> which has nothing to do with `_LIBCPP_ASSERTION_HANDLER`.
> What Apple did was copy-pasting the whole set of section into their `#elif defined(__APPLE__)` and modified the ones they wanted to. If we have many settings we want to modify that would be fine, but having to copy-paste dozens of settings to modify a single setting seems excessive, if that's the only way to do it.

Basically, this mechanism is intended to be used for back-deployment purposes, not to optimize code size or enable/disable individual features based on preferences. That's why that mechanism is not optimized for setting just one or two of these macros. That's a mismatch between the way the header intends to be used and the way you are trying to use it.

Could you please provide more detail (in a separate issue) about the problematic code size you're seeing? I am kinda skeptical that calling an extern function in a few `__throw_foo` functions is really something that moves the needle, but I am happy to investigate in case it is.

https://github.com/llvm/llvm-project/pull/71002


More information about the libcxx-commits mailing list