[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 08:53:38 PDT 2016


rmaprath marked 2 inline comments as done.

================
Comment at: src/cxa_aux_runtime.cpp:19-20
@@ -18,3 +18,4 @@
 extern "C" {
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_cast();
----------------
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?

================
Comment at: src/cxa_new_delete.cpp:85-86
@@ -79,2 +84,4 @@
+#endif
         p = ::operator new(size);
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
     }
----------------
I agree. I've update it to be inline with `new.cpp` from libcxx.

At least the users will have some method of recovery if we return null, calling `std::terminate()` would be a bit rude.


http://reviews.llvm.org/D20677





More information about the cfe-commits mailing list