diff options
author | David 'Digit' Turner <digit@android.com> | 2013-07-29 20:12:22 +0200 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2013-07-30 14:56:10 +0200 |
commit | d9767af301c97e0f825caead7cab9bfaf0d9e5e2 (patch) | |
tree | e58002159797ef0dd6df5fb87303d5406d4a51e1 | |
parent | ce2be28ffd56784d084ece009d26a37f829cff00 (diff) | |
download | ndk-d9767af301c97e0f825caead7cab9bfaf0d9e5e2.tar.gz |
gabi++: Add _GABIXX_NOEXCEPT.
This adds a new macro that will resolve to the C++11 'noexcept'
keyword, and to 'throw()' otherwise.
Change-Id: Ifa9b6643773b99eb1be5de28e6d27783f2942898
-rw-r--r-- | sources/cxx-stl/gabi++/include/cxxabi.h | 8 | ||||
-rw-r--r-- | sources/cxx-stl/gabi++/include/gabixx_config.h | 3 | ||||
-rw-r--r-- | sources/cxx-stl/gabi++/src/cxxabi.cc | 10 | ||||
-rw-r--r-- | sources/cxx-stl/gabi++/src/delete.cc | 17 | ||||
-rw-r--r-- | sources/cxx-stl/gabi++/src/exception.cc | 26 | ||||
-rw-r--r-- | sources/cxx-stl/gabi++/src/new.cc | 23 |
6 files changed, 48 insertions, 39 deletions
diff --git a/sources/cxx-stl/gabi++/include/cxxabi.h b/sources/cxx-stl/gabi++/include/cxxabi.h index d94c8dfbd..0cd9eb8ff 100644 --- a/sources/cxx-stl/gabi++/include/cxxabi.h +++ b/sources/cxx-stl/gabi++/include/cxxabi.h @@ -107,11 +107,11 @@ namespace __cxxabiv1 void __cxa_pure_virtual(); // Missing libcxxabi functions. - bool __cxa_uncaught_exception() throw(); - void __cxa_decrement_exception_refcount(void* exceptionObject) throw(); - void __cxa_increment_exception_refcount(void* exceptionObject) throw(); + bool __cxa_uncaught_exception() _GABIXX_NOEXCEPT; + void __cxa_decrement_exception_refcount(void* exceptionObject) _GABIXX_NOEXCEPT; + void __cxa_increment_exception_refcount(void* exceptionObject) _GABIXX_NOEXCEPT; void __cxa_rethrow_primary_exception(void* exceptionObject); - void* __cxa_current_primary_exception() throw(); + void* __cxa_current_primary_exception() _GABIXX_NOEXCEPT; // The ARM ABI mandates that constructors and destructors // must return 'this', i.e. their first parameter. This is diff --git a/sources/cxx-stl/gabi++/include/gabixx_config.h b/sources/cxx-stl/gabi++/include/gabixx_config.h index bcd1bc1d5..b727497b2 100644 --- a/sources/cxx-stl/gabi++/include/gabixx_config.h +++ b/sources/cxx-stl/gabi++/include/gabixx_config.h @@ -50,6 +50,9 @@ // never be exposed to client code. #define _GABIXX_HIDDEN __attribute__((__visibility__("hidden"))) +// Use _GABIXX_WEAK to define a symbol with weak linkage. +#define _GABIXX_WEAK __attribute__((__weak__)) + // Use _GABIXX_ALWAYS_INLINE to declare a function that shall always be // inlined. Note that the always_inline doesn't make a function inline // per se. diff --git a/sources/cxx-stl/gabi++/src/cxxabi.cc b/sources/cxx-stl/gabi++/src/cxxabi.cc index e820184e7..d65d9a9d2 100644 --- a/sources/cxx-stl/gabi++/src/cxxabi.cc +++ b/sources/cxx-stl/gabi++/src/cxxabi.cc @@ -265,14 +265,15 @@ namespace __cxxabiv1 { return header->adjustedPtr; } - extern "C" bool __cxa_uncaught_exception() throw() { + extern "C" bool __cxa_uncaught_exception() _GABIXX_NOEXCEPT { __cxa_eh_globals* globals = __cxa_get_globals(); if (globals == NULL) return false; return globals->uncaughtExceptions == 0; } - extern "C" void __cxa_decrement_exception_refcount(void* exceptionObject) throw() { + extern "C" void __cxa_decrement_exception_refcount(void* exceptionObject) + _GABIXX_NOEXCEPT { if (exceptionObject != NULL) { __cxa_exception* header = @@ -282,7 +283,8 @@ namespace __cxxabiv1 { } } - extern "C" void __cxa_increment_exception_refcount(void* exceptionObject) throw() { + extern "C" void __cxa_increment_exception_refcount(void* exceptionObject) + _GABIXX_NOEXCEPT { if (exceptionObject != NULL) { __cxa_exception* header = @@ -299,7 +301,7 @@ namespace __cxxabiv1 { #endif /* defined(GABIXX_LIBCXX) */ } - extern "C" void* __cxa_current_primary_exception() throw() { + extern "C" void* __cxa_current_primary_exception() _GABIXX_NOEXCEPT { #if defined(GABIXX_LIBCXX) // Only warn if we're building for libcxx since other libraries do not use // this. diff --git a/sources/cxx-stl/gabi++/src/delete.cc b/sources/cxx-stl/gabi++/src/delete.cc index e91e589c5..ae673fe3e 100644 --- a/sources/cxx-stl/gabi++/src/delete.cc +++ b/sources/cxx-stl/gabi++/src/delete.cc @@ -27,31 +27,32 @@ // // delete.cc: delete operator +#include <gabixx_config.h> #include <stdlib.h> #include <new> -__attribute__ ((weak)) -void operator delete(void* ptr) throw() +_GABIXX_WEAK +void operator delete(void* ptr) _GABIXX_NOEXCEPT { if (ptr) free(ptr); } -__attribute__ ((weak)) -void operator delete[](void* ptr) throw() +_GABIXX_WEAK +void operator delete[](void* ptr) _GABIXX_NOEXCEPT { ::operator delete(ptr); } -__attribute__ ((weak)) -void operator delete(void* ptr, const std::nothrow_t &) throw() +_GABIXX_WEAK +void operator delete(void* ptr, const std::nothrow_t &) _GABIXX_NOEXCEPT { if (ptr) free(ptr); } -__attribute__ ((weak)) -void operator delete[](void* ptr, const std::nothrow_t &nt) throw() +_GABIXX_WEAK +void operator delete[](void* ptr, const std::nothrow_t &nt) _GABIXX_NOEXCEPT { ::operator delete(ptr, nt); } diff --git a/sources/cxx-stl/gabi++/src/exception.cc b/sources/cxx-stl/gabi++/src/exception.cc index c54236ec0..73c0ffc9e 100644 --- a/sources/cxx-stl/gabi++/src/exception.cc +++ b/sources/cxx-stl/gabi++/src/exception.cc @@ -33,50 +33,50 @@ namespace std { #if !defined(GABIXX_LIBCXX) -exception::exception() throw() { +exception::exception() _GABIXX_NOEXCEPT { } #endif // !defined(GABIXX_LIBCXX) -exception::~exception() throw() { +exception::~exception() _GABIXX_NOEXCEPT { } -const char* exception::what() const throw() { +const char* exception::what() const _GABIXX_NOEXCEPT { return "std::exception"; } #if !defined(GABIXX_LIBCXX) -bad_exception::bad_exception() throw() { +bad_exception::bad_exception() _GABIXX_NOEXCEPT { } -bad_exception::~bad_exception() throw() { +bad_exception::~bad_exception() _GABIXX_NOEXCEPT { } -const char* bad_exception::what() const throw() { +const char* bad_exception::what() const _GABIXX_NOEXCEPT { return "std::bad_exception"; } #endif // !defined(GABIXX_LIBCXX) -bad_cast::bad_cast() throw() { +bad_cast::bad_cast() _GABIXX_NOEXCEPT { } -bad_cast::~bad_cast() throw() { +bad_cast::~bad_cast() _GABIXX_NOEXCEPT { } -const char* bad_cast::what() const throw() { +const char* bad_cast::what() const _GABIXX_NOEXCEPT { return "std::bad_cast"; } -bad_typeid::bad_typeid() throw() { +bad_typeid::bad_typeid() _GABIXX_NOEXCEPT { } -bad_typeid::~bad_typeid() throw() { +bad_typeid::~bad_typeid() _GABIXX_NOEXCEPT { } -const char* bad_typeid::what() const throw() { +const char* bad_typeid::what() const _GABIXX_NOEXCEPT { return "std::bad_typeid"; } -bool uncaught_exception() throw() { +bool uncaught_exception() _GABIXX_NOEXCEPT { using namespace __cxxabiv1; __cxa_eh_globals* globals = __cxa_get_globals(); diff --git a/sources/cxx-stl/gabi++/src/new.cc b/sources/cxx-stl/gabi++/src/new.cc index c37717e3d..f9206e7aa 100644 --- a/sources/cxx-stl/gabi++/src/new.cc +++ b/sources/cxx-stl/gabi++/src/new.cc @@ -26,6 +26,7 @@ // SUCH DAMAGE. // +#include <gabixx_config.h> #include <stdlib.h> #include <new> @@ -40,17 +41,17 @@ namespace std { const nothrow_t nothrow = {}; #endif // !defined(GABIXX_LIBCXX) - bad_alloc::bad_alloc() throw() { + bad_alloc::bad_alloc() _GABIXX_NOEXCEPT { } - bad_alloc::~bad_alloc() throw() { + bad_alloc::~bad_alloc() _GABIXX_NOEXCEPT { } - const char* bad_alloc::what() const throw() { + const char* bad_alloc::what() const _GABIXX_NOEXCEPT { return "std::bad_alloc"; } - new_handler set_new_handler(new_handler next_handler) throw() { + new_handler set_new_handler(new_handler next_handler) _GABIXX_NOEXCEPT { new_handler old_handler = cur_handler; cur_handler = next_handler; return old_handler; @@ -58,7 +59,7 @@ namespace std { } // namespace std -__attribute__ ((weak)) +_GABIXX_WEAK void* operator new(std::size_t size) throw(std::bad_alloc) { void* space; do { @@ -74,8 +75,9 @@ void* operator new(std::size_t size) throw(std::bad_alloc) { } while (space == 0); } -__attribute__ ((weak)) -void* operator new(std::size_t size, const std::nothrow_t& no) throw() { +_GABIXX_WEAK +void* operator new(std::size_t size, const std::nothrow_t& no) + _GABIXX_NOEXCEPT { try { return ::operator new(size); } catch (const std::bad_alloc&) { @@ -83,12 +85,13 @@ void* operator new(std::size_t size, const std::nothrow_t& no) throw() { } } -__attribute__ ((weak)) +_GABIXX_WEAK void* operator new[](std::size_t size) throw(std::bad_alloc) { return ::operator new(size); } -__attribute__ ((weak)) -void* operator new[](std::size_t size, const std::nothrow_t& no) throw() { +_GABIXX_WEAK +void* operator new[](std::size_t size, const std::nothrow_t& no) + _GABIXX_NOEXCEPT { return ::operator new(size, no); } |