[libc++abi] Clean up visibility
Use the libc++abi visibility macros instead of pragmas or using
visibility attributes directly. Clean up redundant attributes on
definitions (where the declarations already have visibility attributes
applied, from either libc++ or libc++abi headers).
Introduce _LIBCXXABI_WEAK as a drive-by cleanup, which matches the
semantics of _LIBCPP_WEAK.
No functional change. Tested by building on Linux before and after this
change and verifying that the list of exported symbols is identical.
Differential Revision: https://reviews.llvm.org/D26949
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@296576 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
index 08d5627..f0dcf20 100644
--- a/src/cxa_exception.cpp
+++ b/src/cxa_exception.cpp
@@ -33,8 +33,6 @@
namespace __cxxabiv1 {
-#pragma GCC visibility push(default)
-
// Utility routines
static
inline
@@ -139,7 +137,7 @@
// object. Zero-fill the object. If memory can't be allocated, call
// std::terminate. Return a pointer to the memory to be used for the
// user's exception object.
-_LIBCXXABI_FUNC_VIS void *__cxa_allocate_exception(size_t thrown_size) throw() {
+void *__cxa_allocate_exception(size_t thrown_size) throw() {
size_t actual_size = cxa_exception_size_from_exception_thrown_size(thrown_size);
__cxa_exception *exception_header =
static_cast<__cxa_exception *>(__malloc_with_fallback(actual_size));
@@ -151,7 +149,7 @@
// Free a __cxa_exception object allocated with __cxa_allocate_exception.
-_LIBCXXABI_FUNC_VIS void __cxa_free_exception(void *thrown_object) throw() {
+void __cxa_free_exception(void *thrown_object) throw() {
__free_with_fallback(cxa_exception_from_thrown_object(thrown_object));
}
@@ -202,7 +200,7 @@
will call terminate, assuming that there was no handler for the
exception.
*/
-_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
+void
__cxa_throw(void *thrown_object, std::type_info *tinfo, void (*dest)(void *)) {
__cxa_eh_globals *globals = __cxa_get_globals();
__cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object);
@@ -235,7 +233,6 @@
Requires: exception is native
*/
-_LIBCXXABI_FUNC_VIS
void *__cxa_get_exception_ptr(void *unwind_exception) throw() {
#if _LIBCXXABI_ARM_EHABI
return reinterpret_cast<void*>(
@@ -251,7 +248,6 @@
The routine to be called before the cleanup. This will save __cxa_exception in
__cxa_eh_globals, so that __cxa_end_cleanup() can recover later.
*/
-_LIBCXXABI_FUNC_VIS
bool __cxa_begin_cleanup(void *unwind_arg) throw() {
_Unwind_Exception* unwind_exception = static_cast<_Unwind_Exception*>(unwind_arg);
__cxa_eh_globals* globals = __cxa_get_globals();
@@ -423,7 +419,7 @@
* If it has been rethrown, there is nothing to do.
* Otherwise delete the exception and pop the catch stack to empty.
*/
-_LIBCXXABI_FUNC_VIS void __cxa_end_catch() {
+void __cxa_end_catch() {
static_assert(sizeof(__cxa_exception) == sizeof(__cxa_dependent_exception),
"sizeof(__cxa_exception) must be equal to "
"sizeof(__cxa_dependent_exception)");
@@ -500,7 +496,7 @@
// Note: exception_header may be masquerading as a __cxa_dependent_exception
// and that's ok. exceptionType is there too.
// However watch out for foreign exceptions. Return null for them.
-_LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type() {
+std::type_info *__cxa_current_exception_type() {
// get the current exception
__cxa_eh_globals *globals = __cxa_get_globals_fast();
if (NULL == globals)
@@ -525,7 +521,7 @@
Note: exception_header may be masquerading as a __cxa_dependent_exception
and that's ok.
*/
-_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow() {
+void __cxa_rethrow() {
__cxa_eh_globals* globals = __cxa_get_globals();
__cxa_exception* exception_header = globals->caughtExceptions;
if (NULL == exception_header)
@@ -570,7 +566,7 @@
Requires: If thrown_object is not NULL, it is a native exception.
*/
-_LIBCXXABI_FUNC_VIS void
+void
__cxa_increment_exception_refcount(void *thrown_object) throw() {
if (thrown_object != NULL )
{
@@ -587,7 +583,7 @@
Requires: If thrown_object is not NULL, it is a native exception.
*/
-_LIBCXXABI_FUNC_VIS void
+void
__cxa_decrement_exception_refcount(void *thrown_object) throw() {
if (thrown_object != NULL )
{
@@ -611,7 +607,7 @@
been no exceptions thrown, ever, on this thread, we can return NULL without
the need to allocate the exception-handling globals.
*/
-_LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception() throw() {
+void *__cxa_current_primary_exception() throw() {
// get the current exception
__cxa_eh_globals* globals = __cxa_get_globals_fast();
if (NULL == globals)
@@ -697,6 +693,4 @@
} // extern "C"
-#pragma GCC visibility pop
-
} // abi