[PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

Ben Craig via cfe-commits cfe-commits at lists.llvm.org
Thu May 26 09:17:44 PDT 2016


bcraig added inline comments.

================
Comment at: src/cxa_aux_runtime.cpp:19-24
@@ -18,4 +18,8 @@
 extern "C" {
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_cast();
+#else
+  std::terminate();
+#endif
 }
----------------
bcraig wrote:
> So you're turning off exceptions, but leaving RTTI?  You might want to keep some of the RTTI tests around too if that's the case.
_cxa_bad_cast should be inserted by the compiler.  It is called when a dynamic_cast to a reference type fails.
_cxa_bad_typeid should be inserted by the compiler.  It is called when typeid is used on a null pointer.

_cxa_throw_bad_array_new_length should probably stay put.  The most common reason for that to get hit is if sizeof(obj) * number_of_elts > SIZE_T_MAX.


http://reviews.llvm.org/D20677





More information about the cfe-commits mailing list