[libcxx-commits] [libcxx] [libcxxabi] [libc++] [libc++abi] Initialize exception directly in make_exception_ptr if __cxa_init_primary_exception is available in ABI-library (PR #65534)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 8 17:53:59 PST 2023


================
@@ -1048,6 +1048,10 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
 #    define _LIBCPP_HAS_NO_RTTI
 #  endif
 
+#  if !defined(_LIBCPP_HAS_NO_EXCEPTIONS) && !defined(_LIBCPP_HAS_NO_RTTI) && !defined(__APPLE__) && !defined(_WIN32)
----------------
ldionne wrote:

If you look at how the availability macros in `__availability` work, basically we use the `--target <arch>-<vendor>-<platform><version>` to drive this. The idea is that you tell the compiler what's the oldest version of the platform you are targeting, and based on that we make the function available or not. If you then decide to run your program on an older platform, you effectively lied to the compiler and in practice you'll get a load-time error.

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


More information about the libcxx-commits mailing list