[libcxx-commits] [libcxx] 207d58b - [libc++] Move guards against std::auto_ptr outside of auto_ptr.h
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Apr 14 11:22:19 PDT 2021
Author: Louis Dionne
Date: 2021-04-14T14:06:55-04:00
New Revision: 207d58bf31ab975203c6bb818ee4167a09c195ce
URL: https://github.com/llvm/llvm-project/commit/207d58bf31ab975203c6bb818ee4167a09c195ce
DIFF: https://github.com/llvm/llvm-project/commit/207d58bf31ab975203c6bb818ee4167a09c195ce.diff
LOG: [libc++] Move guards against std::auto_ptr outside of auto_ptr.h
This makes it clear that headers like <memory> which include auto_ptr
only do that when compiling under an older Standard, or when the removed
feature is explicitly requested.
Added:
Modified:
libcxx/include/__memory/auto_ptr.h
libcxx/include/__memory/shared_ptr.h
libcxx/include/__memory/unique_ptr.h
libcxx/include/memory
Removed:
################################################################################
diff --git a/libcxx/include/__memory/auto_ptr.h b/libcxx/include/__memory/auto_ptr.h
index d08c745fef6a..c12698efe00e 100644
--- a/libcxx/include/__memory/auto_ptr.h
+++ b/libcxx/include/__memory/auto_ptr.h
@@ -21,7 +21,6 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
template <class _Tp>
struct _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr_ref
{
@@ -78,7 +77,6 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr<void>
public:
typedef void element_type;
};
-#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index fae94bee2d52..8ded2ab3c7b0 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -17,7 +17,6 @@
#include <__memory/allocation_guard.h>
#include <__memory/allocator.h>
#include <__memory/allocator_traits.h>
-#include <__memory/auto_ptr.h>
#include <__memory/compressed_pair.h>
#include <__memory/pointer_traits.h>
#include <__memory/unique_ptr.h>
@@ -31,6 +30,10 @@
# include <atomic>
#endif
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
+# include <__memory/auto_ptr.h>
+#endif
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h
index 355b259c1b87..5527eda2ae33 100644
--- a/libcxx/include/__memory/unique_ptr.h
+++ b/libcxx/include/__memory/unique_ptr.h
@@ -13,12 +13,15 @@
#include <__config>
#include <__functional_base> // std::less
#include <__memory/allocator_traits.h> // __pointer
-#include <__memory/auto_ptr.h>
#include <__memory/compressed_pair.h>
#include <cstddef>
#include <type_traits>
#include <utility>
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
+# include <__memory/auto_ptr.h>
+#endif
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/libcxx/include/memory b/libcxx/include/memory
index ae3c2cef2f8e..35c0a2959b85 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -682,7 +682,6 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <__memory/allocation_guard.h>
#include <__memory/allocator.h>
#include <__memory/allocator_traits.h>
-#include <__memory/auto_ptr.h>
#include <__memory/compressed_pair.h>
#include <__memory/construct_at.h>
#include <__memory/pointer_safety.h>
@@ -694,6 +693,10 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <__memory/unique_ptr.h>
#include <version>
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
+# include <__memory/auto_ptr.h>
+#endif
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
More information about the libcxx-commits
mailing list