[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 07:06:27 PDT 2016


bcraig added inline comments.

================
Comment at: CMakeLists.txt:359
@@ -350,2 +358,3 @@
 else()
-  add_subdirectory(test)
+  # libc++abi tests are mostly exceptions related. The only reason we want to
+  # build libc++abi without exceptions is to support the -fno-exceptions libc++
----------------
There's one area / test that I would still like to see when exceptions are off.  "magic" / thread safe static initialization has a test (test_guard.pass.cpp).  I think it would be pretty easy to #if out the one sub-test that uses exceptions there.

There's also some demangling and backtracing tests, but I'm much less concerned with those.  If you go through the trouble to get any tests working with exceptions turned off, you might as well get those too.

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

================
Comment at: src/cxa_new_delete.cpp:85
@@ -79,1 +84,3 @@
+#endif
         p = ::operator new(size);
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
----------------
Question:  Should "throwing" new call terminate on allocation failure, or is returning null from "throwing" new fine?

I'm leaning towards returning null, as I would rapidly grow tired of std::nothrow everywhere, but it does seem a bit dangerous.


http://reviews.llvm.org/D20677





More information about the cfe-commits mailing list