[libc-commits] [libc] [libc][stdlib] initial support for __cxa_finalize (PR #85865)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Wed Mar 20 08:26:35 PDT 2024


================
@@ -71,20 +67,31 @@ void call_exit_callbacks() {
   ExitCallbackList::destroy(&exit_callbacks);
 }
 
-} // namespace internal
-
-static int add_atexit_unit(const AtExitUnit &unit) {
+int add_atexit_unit(const AtExitUnit &unit) {
   MutexLock lock(&handler_list_mtx);
-  if (!exit_callbacks.push_back(unit))
-    return -1;
-  return 0;
+  if (exit_callbacks.push_back(unit))
+    return 0;
+  return -1;
 }
 
+} // namespace
+
+extern "C" {
+
 // TODO: Handle the last dso handle argument.
-extern "C" int __cxa_atexit(AtExitCallback *callback, void *payload, void *) {
+int __cxa_atexit(AtExitCallback *callback, void *payload, void *) {
----------------
nickdesaulniers wrote:

It still is, I just changed the code to use an `extern "C"` block (see line 79) rather than declare BOTH `__cxa_atexit` and `__cxa_finalize` with `extern "C"` on their function signatures.

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


More information about the libc-commits mailing list