[libc++] Remove _LIBCPP_HAS_SIZED_DEALLOCATION (#172285)

This macro provides relatively little value. Using the standard FTM
directly removes one level of indicretion, making it easier to
understand what is actually happening.
This commit is contained in:
Nikolas Klauser 2026-01-06 17:16:04 +01:00 committed by GitHub
parent 7bf6ad5c80
commit 2b01e7cf2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 13 deletions

View File

@ -13,7 +13,6 @@
#include <__cstddef/max_align_t.h>
#include <__cstddef/size_t.h>
#include <__new/align_val_t.h>
#include <__new/global_new_delete.h> // for _LIBCPP_HAS_SIZED_DEALLOCATION
#include <__type_traits/type_identity.h>
#include <__utility/element_count.h>
@ -43,7 +42,7 @@ __libcpp_allocate(__element_count __n, [[__maybe_unused__]] size_t __align = _LI
return static_cast<_Tp*>(__builtin_operator_new(__size));
}
#if _LIBCPP_HAS_SIZED_DEALLOCATION
#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
# define _LIBCPP_ONLY_IF_SIZED_DEALLOCATION(...) __VA_ARGS__
#else
# define _LIBCPP_ONLY_IF_SIZED_DEALLOCATION(...) /* nothing */

View File

@ -12,7 +12,6 @@
#include <__config>
#include <__cstddef/size_t.h>
#include <__new/align_val_t.h>
#include <__new/exceptions.h>
#include <__new/nothrow_t.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@ -25,12 +24,6 @@
# define _THROW_BAD_ALLOC
#endif
#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
# define _LIBCPP_HAS_SIZED_DEALLOCATION 1
#else
# define _LIBCPP_HAS_SIZED_DEALLOCATION 0
#endif
#if defined(_LIBCPP_ABI_VCRUNTIME)
# include <new.h>
#else
@ -39,7 +32,7 @@
_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_SIZED_DEALLOCATION
# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
# endif
@ -48,7 +41,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_SIZED_DEALLOCATION
# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
# endif
@ -58,7 +51,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_SIZED_DEALLOCATION
# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
# endif
@ -68,7 +61,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_SIZED_DEALLOCATION
# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
# endif
# endif