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

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue Mar 19 15:09:02 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 *) {
----------------
michaelrj-google wrote:

is there a reason this shouldn't be `extern "C"`?

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


More information about the libc-commits mailing list