[libcxx-commits] [libcxxabi] [libcxxabi] Rename abort_message to __abort_message (PR #111413)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 7 11:00:06 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
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.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
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"

``````````

</details>


https://github.com/llvm/llvm-project/pull/111413


More information about the libcxx-commits mailing list