[libcxx] r287388 - Allow using libsupc++ with LIBCXX_ENABLE_STATIC_ABI_LIBRARY. Patch from Michael Daniels.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 14:25:41 PST 2016


Author: ericwf
Date: Fri Nov 18 16:25:41 2016
New Revision: 287388

URL: http://llvm.org/viewvc/llvm-project?rev=287388&view=rev
Log:
Allow using libsupc++ with LIBCXX_ENABLE_STATIC_ABI_LIBRARY. Patch from Michael Daniels.

The code cannot currently link when using libsupc++ with the
LIBCXX_ENABLE_STATIC_ABI_LIBRARY option.

This change ifdef's out the the destructor and 'what' function for
bad_array_length and bad_array_new_length when GLIBCXX is defined.
The constructors that are left in are the only functions not being provided by
libsupc++ itself, and follows the same pattern that was used to ifdef bad_alloc.

Testing was done on a Linux x86_64 host using GCC 5.4 and libc++ from ToT.
I see no change to the test results when using libsup++ or libstdc++ without
LIBCXX_ENABLE_STATIC_ABI_LIBRARY. When using libsupc++ with
LIBCXX_ENABLE_STATIC_ABI_LIBRARY it will now build and test results are the
same as those without the option specified.

Reviewed as https://reviews.llvm.org/D26186

Modified:
    libcxx/trunk/src/new.cpp

Modified: libcxx/trunk/src/new.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=287388&r1=287387&r2=287388&view=diff
==============================================================================
--- libcxx/trunk/src/new.cpp (original)
+++ libcxx/trunk/src/new.cpp Fri Nov 18 16:25:41 2016
@@ -316,6 +316,8 @@ bad_array_new_length::bad_array_new_leng
 {
 }
 
+#ifndef __GLIBCXX__
+
 bad_array_new_length::~bad_array_new_length() _NOEXCEPT
 {
 }
@@ -326,22 +328,28 @@ bad_array_new_length::what() const _NOEX
     return "bad_array_new_length";
 }
 
+#endif // !__GLIBCXX__
+
 #endif //LIBCXXRT
 
-const char*
-bad_array_length::what() const _NOEXCEPT
+bad_array_length::bad_array_length() _NOEXCEPT
 {
-    return "bad_array_length";
 }
 
-bad_array_length::bad_array_length() _NOEXCEPT
+#ifndef __GLIBCXX__
+
+bad_array_length::~bad_array_length() _NOEXCEPT
 {
 }
 
-bad_array_length::~bad_array_length() _NOEXCEPT
+const char*
+bad_array_length::what() const _NOEXCEPT
 {
+    return "bad_array_length";
 }
 
+#endif // !__GLIBCXX__
+
 #endif // _LIBCPPABI_VERSION
 
 #ifndef LIBSTDCXX




More information about the cfe-commits mailing list