diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -46,6 +46,8 @@ - Implemented P0980R1 (Making ``std::string`` constexpr) +- Implemented P0174R2 (Deprecating Vestigial Library Parts in C++17) + - Marked the following papers as "Complete" (note that some of those might have been implemented in a previous release but not marked as such): diff --git a/libcxx/docs/Status/Cxx17Papers.csv b/libcxx/docs/Status/Cxx17Papers.csv --- a/libcxx/docs/Status/Cxx17Papers.csv +++ b/libcxx/docs/Status/Cxx17Papers.csv @@ -50,7 +50,7 @@ "`p0088r3 `__","LWG","Variant: a type-safe union for C++17","Oulu","|Complete|","4.0" "`p0137r1 `__","CWG","Core Issue 1776: Replacement of class objects containing reference members","Oulu","|Complete|","6.0" "`p0163r0 `__","LWG","shared_ptr::weak_type","Oulu","|Complete|","3.9" -"`p0174r2 `__","LWG","Deprecating Vestigial Library Parts in C++17","Oulu","|Partial|","" +"`p0174r2 `__","LWG","Deprecating Vestigial Library Parts in C++17","Oulu","|Complete|","15.0" "`p0175r1 `__","LWG","Synopses for the C library","Oulu","","" "`p0180r2 `__","LWG","Reserve a New Library Namespace for Future Standardization","Oulu","|Nothing To Do|","n/a" "`p0181r1 `__","LWG","Ordered by Default","Oulu","*Removed in Kona*","n/a" diff --git a/libcxx/include/__memory/allocator.h b/libcxx/include/__memory/allocator.h --- a/libcxx/include/__memory/allocator.h +++ b/libcxx/include/__memory/allocator.h @@ -29,7 +29,7 @@ #if _LIBCPP_STD_VER <= 17 template <> -class _LIBCPP_TEMPLATE_VIS allocator +class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator { public: _LIBCPP_DEPRECATED_IN_CXX17 typedef void* pointer; @@ -40,7 +40,7 @@ }; template <> -class _LIBCPP_TEMPLATE_VIS allocator +class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator { public: _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* pointer; diff --git a/libcxx/include/__memory/temporary_buffer.h b/libcxx/include/__memory/temporary_buffer.h --- a/libcxx/include/__memory/temporary_buffer.h +++ b/libcxx/include/__memory/temporary_buffer.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT _LIBCPP_NO_CFI +_LIBCPP_NODISCARD_EXT _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT { @@ -67,7 +67,7 @@ } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 void return_temporary_buffer(_Tp* __p) _NOEXCEPT { _VSTD::__libcpp_deallocate_unsized((void*)__p, _LIBCPP_ALIGNOF(_Tp)); diff --git a/libcxx/test/std/utilities/memory/default.allocator/void.depr.verify.cpp b/libcxx/test/std/utilities/memory/default.allocator/void.depr.verify.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/memory/default.allocator/void.depr.verify.cpp @@ -0,0 +1,15 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// REQUIRES: c++17 + +// Ensure allocator is deprecated + +#include + +std::allocator alloc; // expected-warning {{'allocator' is deprecated}} diff --git a/libcxx/test/std/utilities/memory/temporary.buffer/depr.verify.cpp b/libcxx/test/std/utilities/memory/temporary.buffer/depr.verify.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/memory/temporary.buffer/depr.verify.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// REQUIRES: c++17 + +// Ensure allocator is deprecated + +#include + +void test() { + auto a = std::get_temporary_buffer(1); // expected-warning {{'get_temporary_buffer' is deprecated}} + std::return_temporary_buffer(a.first); // expected-warning {{'return_temporary_buffer' is deprecated}} +}