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

Asiri Rathnayake via cfe-commits cfe-commits at lists.llvm.org
Thu May 26 09:36:29 PDT 2016


rmaprath marked an inline comment as done.

================
Comment at: src/cxa_aux_runtime.cpp:19-25
@@ -18,5 +18,9 @@
 extern "C" {
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_cast();
+#else
+  std::terminate();
+#endif
 }
 
----------------
rmaprath wrote:
> I'm not very familiar with how RTTI works, I was simply getting rid of the `throw` statements which get in the way of compiling with `-fno-exceptions`.
> 
> So, I presume these `__cxa_bad_xxx` calls are inserted by the compiler?
> 
> The tests `dynamic_cast_xxx` all seem to pass, which I found a bit weird because I would've expected some of those to fail because of the `std::terminate()`. Or are they not related to RTTI?
Thanks. I will try to get clang to generate these (btw, do you have a reference for those RTTI functions? I couldn't find much on the interwebs.

I suppose leaving these functions (which call `std::terminate()`) in the -fno-exceptions variant is not a problem?


http://reviews.llvm.org/D20677





More information about the cfe-commits mailing list