-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[libcxxabi] Rename abort_message to __abort_message #111413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is an internal API and the name should reflect that. This is a reland of llvm#108887.
Member
|
@llvm/pr-subscribers-libcxxabi Author: Petr Hosek (petrhosek) ChangesThis is an internal API and the name should reflect that. This is a reland of #108887. Full diff: https://github.com/llvm/llvm-project/pull/111413.diff 11 Files Affected:
diff --git a/libcxxabi/src/abort_message.cpp b/libcxxabi/src/abort_message.cpp
index 859a5031b93fec..299994266e26a8 100644
--- a/libcxxabi/src/abort_message.cpp
+++ b/libcxxabi/src/abort_message.cpp
@@ -26,7 +26,7 @@
# define _LIBCXXABI_USE_CRASHREPORTER_CLIENT
#endif
-void abort_message(const char* format, ...)
+void __abort_message(const char* format, ...)
{
// Write message to stderr. We do this before formatting into a
// variable-size buffer so that we still get some information if
@@ -61,7 +61,7 @@ void abort_message(const char* format, ...)
# if __ANDROID_API__ >= 21
// Show error in tombstone.
- android_set_abort_message(buffer);
+ android_set___abort_message(buffer);
// Show error in logcat.
openlog("libc++abi", 0, 0);
diff --git a/libcxxabi/src/abort_message.h b/libcxxabi/src/abort_message.h
index 97641777801919..2c12c429569d34 100644
--- a/libcxxabi/src/abort_message.h
+++ b/libcxxabi/src/abort_message.h
@@ -12,14 +12,14 @@
#include "cxxabi.h"
extern "C" _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void
-abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));
+__abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));
#ifndef _LIBCXXABI_ASSERT
# define _LIBCXXABI_ASSERT(expr, msg) \
do { \
if (!(expr)) { \
char const* __msg = (msg); \
- ::abort_message("%s:%d: %s", __FILE__, __LINE__, __msg); \
+ ::__abort_message("%s:%d: %s", __FILE__, __LINE__, __msg); \
} \
} while (false)
diff --git a/libcxxabi/src/cxa_default_handlers.cpp b/libcxxabi/src/cxa_default_handlers.cpp
index 60e402c55b395b..52b1aacae9932f 100644
--- a/libcxxabi/src/cxa_default_handlers.cpp
+++ b/libcxxabi/src/cxa_default_handlers.cpp
@@ -30,18 +30,18 @@ static void demangling_terminate_handler()
// If there is no uncaught exception, just note that we're terminating
if (!globals)
- abort_message("terminating");
+ __abort_message("terminating");
__cxa_exception* exception_header = globals->caughtExceptions;
if (!exception_header)
- abort_message("terminating");
+ __abort_message("terminating");
_Unwind_Exception* unwind_exception =
reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1;
// If we're terminating due to a foreign exception
if (!__isOurExceptionClass(unwind_exception))
- abort_message("terminating due to %s foreign exception", cause);
+ __abort_message("terminating due to %s foreign exception", cause);
void* thrown_object =
__getExceptionClass(unwind_exception) == kOurDependentExceptionClass ?
@@ -67,19 +67,19 @@ static void demangling_terminate_handler()
{
// Include the what() message from the exception
const std::exception* e = static_cast<const std::exception*>(thrown_object);
- abort_message("terminating due to %s exception of type %s: %s", cause, name, e->what());
+ __abort_message("terminating due to %s exception of type %s: %s", cause, name, e->what());
}
else
{
// Else just note that we're terminating due to an exception
- abort_message("terminating due to %s exception of type %s", cause, name);
+ __abort_message("terminating due to %s exception of type %s", cause, name);
}
}
#else // !_LIBCXXABI_NO_EXCEPTIONS
__attribute__((noreturn))
static void demangling_terminate_handler()
{
- abort_message("terminating");
+ __abort_message("terminating");
}
#endif // !_LIBCXXABI_NO_EXCEPTIONS
diff --git a/libcxxabi/src/cxa_exception_storage.cpp b/libcxxabi/src/cxa_exception_storage.cpp
index c842da195accbd..733f0d470569a2 100644
--- a/libcxxabi/src/cxa_exception_storage.cpp
+++ b/libcxxabi/src/cxa_exception_storage.cpp
@@ -61,12 +61,12 @@ namespace {
void _LIBCPP_TLS_DESTRUCTOR_CC destruct_(void *p) {
__free_with_fallback(p);
if (0 != std::__libcpp_tls_set(key_, NULL))
- abort_message("cannot zero out thread value for __cxa_get_globals()");
+ __abort_message("cannot zero out thread value for __cxa_get_globals()");
}
void construct_() {
if (0 != std::__libcpp_tls_create(&key_, destruct_))
- abort_message("cannot create thread specific key for __cxa_get_globals()");
+ __abort_message("cannot create thread specific key for __cxa_get_globals()");
}
} // namespace
@@ -80,9 +80,9 @@ extern "C" {
retVal = static_cast<__cxa_eh_globals*>(
__calloc_with_fallback(1, sizeof(__cxa_eh_globals)));
if (NULL == retVal)
- abort_message("cannot allocate __cxa_eh_globals");
+ __abort_message("cannot allocate __cxa_eh_globals");
if (0 != std::__libcpp_tls_set(key_, retVal))
- abort_message("std::__libcpp_tls_set failure in __cxa_get_globals()");
+ __abort_message("std::__libcpp_tls_set failure in __cxa_get_globals()");
}
return retVal;
}
@@ -94,7 +94,7 @@ extern "C" {
__cxa_eh_globals *__cxa_get_globals_fast() {
// First time through, create the key.
if (0 != std::__libcpp_execute_once(&flag_, construct_))
- abort_message("execute once failure in __cxa_get_globals_fast()");
+ __abort_message("execute once failure in __cxa_get_globals_fast()");
return static_cast<__cxa_eh_globals*>(std::__libcpp_tls_get(key_));
}
} // extern "C"
diff --git a/libcxxabi/src/cxa_guard_impl.h b/libcxxabi/src/cxa_guard_impl.h
index 3e533054098e20..7b05bf32f3eda7 100644
--- a/libcxxabi/src/cxa_guard_impl.h
+++ b/libcxxabi/src/cxa_guard_impl.h
@@ -91,7 +91,7 @@
// the former.
#ifdef BUILDING_CXA_GUARD
# include "abort_message.h"
-# define ABORT_WITH_MESSAGE(...) ::abort_message(__VA_ARGS__)
+# define ABORT_WITH_MESSAGE(...) ::__abort_message(__VA_ARGS__)
#elif defined(TESTING_CXA_GUARD)
# define ABORT_WITH_MESSAGE(...) ::abort()
#else
diff --git a/libcxxabi/src/cxa_handlers.cpp b/libcxxabi/src/cxa_handlers.cpp
index 344250dde0c7e1..f879ff0d8ff186 100644
--- a/libcxxabi/src/cxa_handlers.cpp
+++ b/libcxxabi/src/cxa_handlers.cpp
@@ -33,7 +33,7 @@ __unexpected(unexpected_handler func)
{
func();
// unexpected handler should not return
- abort_message("unexpected_handler unexpectedly returned");
+ __abort_message("unexpected_handler unexpectedly returned");
}
__attribute__((noreturn))
@@ -58,13 +58,13 @@ __terminate(terminate_handler func) noexcept
#endif // _LIBCXXABI_NO_EXCEPTIONS
func();
// handler should not return
- abort_message("terminate_handler unexpectedly returned");
+ __abort_message("terminate_handler unexpectedly returned");
#ifndef _LIBCXXABI_NO_EXCEPTIONS
}
catch (...)
{
// handler should not throw exception
- abort_message("terminate_handler unexpectedly threw an exception");
+ __abort_message("terminate_handler unexpectedly threw an exception");
}
#endif // _LIBCXXABI_NO_EXCEPTIONS
}
diff --git a/libcxxabi/src/cxa_thread_atexit.cpp b/libcxxabi/src/cxa_thread_atexit.cpp
index c6bd0aa323f2e1..8546cfe48c3976 100644
--- a/libcxxabi/src/cxa_thread_atexit.cpp
+++ b/libcxxabi/src/cxa_thread_atexit.cpp
@@ -89,7 +89,7 @@ namespace {
// __cxa_thread_atexit() may be called arbitrarily late (for example, from
// global destructors or atexit() handlers).
if (std::__libcpp_tls_create(&dtors_key, run_dtors) != 0) {
- abort_message("std::__libcpp_tls_create() failed in __cxa_thread_atexit()");
+ __abort_message("std::__libcpp_tls_create() failed in __cxa_thread_atexit()");
}
}
diff --git a/libcxxabi/src/cxa_vector.cpp b/libcxxabi/src/cxa_vector.cpp
index 17d942a6e61c79..857ee27d065c31 100644
--- a/libcxxabi/src/cxa_vector.cpp
+++ b/libcxxabi/src/cxa_vector.cpp
@@ -121,7 +121,7 @@ void throw_bad_array_new_length() {
#ifndef _LIBCXXABI_NO_EXCEPTIONS
throw std::bad_array_new_length();
#else
- abort_message("__cxa_vec_new failed to allocate memory");
+ __abort_message("__cxa_vec_new failed to allocate memory");
#endif
}
diff --git a/libcxxabi/src/cxa_virtual.cpp b/libcxxabi/src/cxa_virtual.cpp
index c868672e00af90..8f4fdd0919f0e2 100644
--- a/libcxxabi/src/cxa_virtual.cpp
+++ b/libcxxabi/src/cxa_virtual.cpp
@@ -13,12 +13,12 @@ namespace __cxxabiv1 {
extern "C" {
_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN
void __cxa_pure_virtual(void) {
- abort_message("Pure virtual function called!");
+ __abort_message("Pure virtual function called!");
}
_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN
void __cxa_deleted_virtual(void) {
- abort_message("Deleted virtual function called!");
+ __abort_message("Deleted virtual function called!");
}
} // extern "C"
} // abi
diff --git a/libcxxabi/src/demangle/DemangleConfig.h b/libcxxabi/src/demangle/DemangleConfig.h
index d67d89bdb06927..06fd223f5553f9 100644
--- a/libcxxabi/src/demangle/DemangleConfig.h
+++ b/libcxxabi/src/demangle/DemangleConfig.h
@@ -15,7 +15,7 @@
// build systems to override this value.
// https://libcxx.llvm.org/UsingLibcxx.html#enabling-the-safe-libc-mode
#ifndef _LIBCPP_VERBOSE_ABORT
-#define _LIBCPP_VERBOSE_ABORT(...) abort_message(__VA_ARGS__)
+#define _LIBCPP_VERBOSE_ABORT(...) __abort_message(__VA_ARGS__)
#include "../abort_message.h"
#endif
diff --git a/libcxxabi/src/stdlib_new_delete.cpp b/libcxxabi/src/stdlib_new_delete.cpp
index b802559d479e2c..bd576e6aeed744 100644
--- a/libcxxabi/src/stdlib_new_delete.cpp
+++ b/libcxxabi/src/stdlib_new_delete.cpp
@@ -32,14 +32,14 @@ inline void __throw_bad_alloc_shim() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw std::bad_alloc();
#else
- abort_message("bad_alloc was thrown in -fno-exceptions mode");
+ __abort_message("bad_alloc was thrown in -fno-exceptions mode");
#endif
}
#define _LIBCPP_ASSERT_SHIM(expr, str) \
do { \
if (!expr) \
- abort_message(str); \
+ __abort_message(str); \
} while (false)
// ------------------ BEGIN COPY ------------------
|
d012007 to
50331a7
Compare
You can test this locally with the following command:git-clang-format --diff 0b8fec69464ce4a7e759137b091a6b7500458f36 50331a7f39f3607558d4cd45445aaaad4bc9b033 --extensions h,cpp -- libcxxabi/src/abort_message.cpp libcxxabi/src/abort_message.h libcxxabi/src/cxa_default_handlers.cpp libcxxabi/src/cxa_exception_storage.cpp libcxxabi/src/cxa_guard_impl.h libcxxabi/src/cxa_handlers.cpp libcxxabi/src/cxa_thread_atexit.cpp libcxxabi/src/cxa_vector.cpp libcxxabi/src/cxa_virtual.cpp libcxxabi/src/demangle/DemangleConfig.h libcxxabi/src/stdlib_new_delete.cppView the diff from clang-format here.diff --git a/libcxxabi/src/abort_message.cpp b/libcxxabi/src/abort_message.cpp
index 9e5a984807..adefc621cf 100644
--- a/libcxxabi/src/abort_message.cpp
+++ b/libcxxabi/src/abort_message.cpp
@@ -26,11 +26,10 @@
# define _LIBCXXABI_USE_CRASHREPORTER_CLIENT
#endif
-void __abort_message(const char* format, ...)
-{
- // Write message to stderr. We do this before formatting into a
- // variable-size buffer so that we still get some information if
- // formatting into the variable-sized buffer fails.
+ void __abort_message(const char* format, ...) {
+ // Write message to stderr. We do this before formatting into a
+ // variable-size buffer so that we still get some information if
+ // formatting into the variable-sized buffer fails.
#if !defined(NDEBUG) || !defined(LIBCXXABI_BAREMETAL)
{
fprintf(stderr, "libc++abi: ");
@@ -76,4 +75,4 @@ void __abort_message(const char* format, ...)
#endif // __BIONIC__
abort();
-}
+ }
diff --git a/libcxxabi/src/abort_message.h b/libcxxabi/src/abort_message.h
index 2c12c42956..d7f5aa5bec 100644
--- a/libcxxabi/src/abort_message.h
+++ b/libcxxabi/src/abort_message.h
@@ -11,8 +11,8 @@
#include "cxxabi.h"
-extern "C" _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void
-__abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));
+extern "C" _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void __abort_message(const char* format, ...)
+ __attribute__((format(printf, 1, 2)));
#ifndef _LIBCXXABI_ASSERT
# define _LIBCXXABI_ASSERT(expr, msg) \
diff --git a/libcxxabi/src/cxa_default_handlers.cpp b/libcxxabi/src/cxa_default_handlers.cpp
index 52b1aacae9..ebdbc10c41 100644
--- a/libcxxabi/src/cxa_default_handlers.cpp
+++ b/libcxxabi/src/cxa_default_handlers.cpp
@@ -30,18 +30,18 @@ static void demangling_terminate_handler()
// If there is no uncaught exception, just note that we're terminating
if (!globals)
- __abort_message("terminating");
+ __abort_message("terminating");
__cxa_exception* exception_header = globals->caughtExceptions;
if (!exception_header)
- __abort_message("terminating");
+ __abort_message("terminating");
_Unwind_Exception* unwind_exception =
reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1;
// If we're terminating due to a foreign exception
if (!__isOurExceptionClass(unwind_exception))
- __abort_message("terminating due to %s foreign exception", cause);
+ __abort_message("terminating due to %s foreign exception", cause);
void* thrown_object =
__getExceptionClass(unwind_exception) == kOurDependentExceptionClass ?
@@ -76,11 +76,7 @@ static void demangling_terminate_handler()
}
}
#else // !_LIBCXXABI_NO_EXCEPTIONS
-__attribute__((noreturn))
-static void demangling_terminate_handler()
-{
- __abort_message("terminating");
-}
+__attribute__((noreturn)) static void demangling_terminate_handler() { __abort_message("terminating"); }
#endif // !_LIBCXXABI_NO_EXCEPTIONS
__attribute__((noreturn))
diff --git a/libcxxabi/src/cxa_exception_storage.cpp b/libcxxabi/src/cxa_exception_storage.cpp
index 733f0d4705..439ec4d2c9 100644
--- a/libcxxabi/src/cxa_exception_storage.cpp
+++ b/libcxxabi/src/cxa_exception_storage.cpp
@@ -61,12 +61,12 @@ namespace {
void _LIBCPP_TLS_DESTRUCTOR_CC destruct_(void *p) {
__free_with_fallback(p);
if (0 != std::__libcpp_tls_set(key_, NULL))
- __abort_message("cannot zero out thread value for __cxa_get_globals()");
+ __abort_message("cannot zero out thread value for __cxa_get_globals()");
}
void construct_() {
if (0 != std::__libcpp_tls_create(&key_, destruct_))
- __abort_message("cannot create thread specific key for __cxa_get_globals()");
+ __abort_message("cannot create thread specific key for __cxa_get_globals()");
}
} // namespace
@@ -80,9 +80,9 @@ extern "C" {
retVal = static_cast<__cxa_eh_globals*>(
__calloc_with_fallback(1, sizeof(__cxa_eh_globals)));
if (NULL == retVal)
- __abort_message("cannot allocate __cxa_eh_globals");
+ __abort_message("cannot allocate __cxa_eh_globals");
if (0 != std::__libcpp_tls_set(key_, retVal))
- __abort_message("std::__libcpp_tls_set failure in __cxa_get_globals()");
+ __abort_message("std::__libcpp_tls_set failure in __cxa_get_globals()");
}
return retVal;
}
@@ -94,7 +94,7 @@ extern "C" {
__cxa_eh_globals *__cxa_get_globals_fast() {
// First time through, create the key.
if (0 != std::__libcpp_execute_once(&flag_, construct_))
- __abort_message("execute once failure in __cxa_get_globals_fast()");
+ __abort_message("execute once failure in __cxa_get_globals_fast()");
return static_cast<__cxa_eh_globals*>(std::__libcpp_tls_get(key_));
}
} // extern "C"
|
ldionne
approved these changes
Oct 9, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an internal API and the name should reflect that.
This is a reland of #108887.