[libcxx-commits] [libcxx] [libc++] Simplify when the sized global deallocations overloads are available (PR #114667)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 28 05:39:46 PST 2024
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/114667
>From 441d7ad1bed8c50b6cc6885bc5ad6ce06ad02c85 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Sat, 2 Nov 2024 14:41:22 +0100
Subject: [PATCH] [libc++] Simplify when the sized global deallocations
overloads are available
---
libcxx/include/new | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)
diff --git a/libcxx/include/new b/libcxx/include/new
index 49e500809e158f..3c9ce3b03ef7ab 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -103,19 +103,7 @@ void operator delete[](void* ptr, void*) noexcept;
# pragma GCC system_header
#endif
-#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
-# define _LIBCPP_HAS_LANGUAGE_SIZED_DEALLOCATION 1
-#else
-# define _LIBCPP_HAS_LANGUAGE_SIZED_DEALLOCATION 0
-#endif
-
-#if _LIBCPP_STD_VER >= 14 || _LIBCPP_HAS_LANGUAGE_SIZED_DEALLOCATION
-# define _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION 1
-#else
-# define _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION 0
-#endif
-
-#if _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION && _LIBCPP_HAS_LANGUAGE_SIZED_DEALLOCATION
+#if defined(_LIBCPP_BUILDING_LIBRARY) || (defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L)
# define _LIBCPP_HAS_SIZED_DEALLOCATION 1
#else
# define _LIBCPP_HAS_SIZED_DEALLOCATION 0
@@ -214,7 +202,7 @@ inline constexpr destroying_delete_t destroying_delete{};
_LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
-# if _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
+# if _LIBCPP_HAS_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
# endif
@@ -223,7 +211,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _
_LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
-# if _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
+# if _LIBCPP_HAS_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
# endif
@@ -233,7 +221,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz)
operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
-# if _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
+# if _LIBCPP_HAS_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
# endif
@@ -243,7 +231,7 @@ operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
-# if _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
+# if _LIBCPP_HAS_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
# endif
# endif
More information about the libcxx-commits
mailing list