[libcxx-commits] [PATCH] D144520: [libcxx[ Provide set_new_handler/get_new_handler on Windows

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 21 13:53:45 PST 2023


phosek created this revision.
phosek added reviewers: ldionne, mstorsjo.
Herald added a project: All.
phosek requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

These are not provided by VCRuntime so we need to provide our own.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144520

Files:
  libcxx/include/new
  libcxx/src/new.cpp


Index: libcxx/src/new.cpp
===================================================================
--- libcxx/src/new.cpp
+++ libcxx/src/new.cpp
@@ -13,9 +13,7 @@
 #include "include/atomic_support.h"
 
 #if defined(_LIBCPP_ABI_MICROSOFT)
-#   if !defined(_LIBCPP_ABI_VCRUNTIME)
-#       include "support/runtime/new_handler_fallback.ipp"
-#   endif
+#   include "support/runtime/new_handler_fallback.ipp"
 #elif defined(LIBCXX_BUILDING_LIBCXXABI)
 #   include <cxxabi.h>
 #elif defined(LIBCXXRT)
Index: libcxx/include/new
===================================================================
--- libcxx/include/new
+++ libcxx/include/new
@@ -144,10 +144,6 @@
     const char* what() const _NOEXCEPT override;
 };
 
-typedef void (*new_handler)();
-_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
-_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
-
 #elif defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0 // !_LIBCPP_ABI_VCRUNTIME
 
 // When _HAS_EXCEPTIONS == 0, these complete definitions are needed,
@@ -168,6 +164,10 @@
 };
 #endif // defined(_LIBCPP_ABI_VCRUNTIME) && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0
 
+typedef void (*new_handler)();
+_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
+_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
+
 _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc();  // not in C++ spec
 
 _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144520.499288.patch
Type: text/x-patch
Size: 1443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230221/c39fbffe/attachment-0001.bin>


More information about the libcxx-commits mailing list