[libcxx-commits] [libcxx] [libc++] Assume __STDCPP_DEFAULT_NEW_ALIGNMENT__ is available (PR #140551)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 19 07:52:25 PDT 2025


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/140551

Both Clang and GCC define the macro unconditionally, so the `#else` case is dead code.


>From 452acb82465ab99a02b832f15f3d57d2f2db519e Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Mon, 19 May 2025 16:50:51 +0200
Subject: [PATCH] [libc++] Assume __STDCPP_DEFAULT_NEW_ALIGNMENT__ is available

---
 libcxx/include/__new/allocate.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/libcxx/include/__new/allocate.h b/libcxx/include/__new/allocate.h
index 738fa62af4d61..1ab4eddea7fa5 100644
--- a/libcxx/include/__new/allocate.h
+++ b/libcxx/include/__new/allocate.h
@@ -10,7 +10,6 @@
 #define _LIBCPP___NEW_ALLOCATE_H
 
 #include <__config>
-#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
@@ -24,11 +23,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI bool __is_overaligned_for_new(size_t __align) _NOEXCEPT {
-#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__
   return __align > __STDCPP_DEFAULT_NEW_ALIGNMENT__;
-#else
-  return __align > _LIBCPP_ALIGNOF(max_align_t);
-#endif
 }
 
 template <class... _Args>



More information about the libcxx-commits mailing list