[libcxx-commits] [libcxx] [libc++][hardening][NFC] Introduce `_LIBCPP_VERBOSE_TRAP` macro. (PR #148262)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 11 11:24:23 PDT 2025


================
@@ -15,6 +15,7 @@
 #  include <__cxx03/__verbose_abort>
----------------
ldionne wrote:

This is a good question, and actually it's not easy to answer IMO. CCing @philnik777 .

I see a few options:
1. Introduce `<__cxx03/__verbose_trap>`. This seems to go against the notion of having "frozen headers".
2. Define `_LIBCPP_VERBOSE_TRAP` inline inside `default_assertion_handler.in` inside this `#if` block. This is equivalent to (1) except we don't introduce a new header under `__cxx03`.
3. Always use the non-C++03 headers from `default_assertion_handler.in`. So this means get rid of the `#if` and always include `<__config>` and `<__verbose_abort>`, never their `<__cxx03/...>` counterparts. This would be doable since `<__verbose_abort>` doesn't actually need C++11, but it goes against the principle of the split and may cause other conflicts if we somehow end up including both `<__config>` and `<__cxx03/__config>`.
4. Have two copies of `default_assertion_handler.in`, one normal and one for the frozen headers. This is a bit tricky since `default_assertion_handler.in` is something we set up from CMake and expect vendors to be able to override.

I think (1) is the best outcome here. We'll have to support these hardening improvements in frozen-C++03 anyways otherwise this'll be a regression in functionality.

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


More information about the libcxx-commits mailing list