[libc++] [P0619] Hide not1 and not2 under _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS.

This also provides some of the scaffolding needed by D102992 and D101729, and mops up after D101730 etc.

Differential Revision: https://reviews.llvm.org/D103055
This commit is contained in:
Arthur O'Dwyer 2021-05-24 18:36:17 -04:00
parent 68e4596253
commit d42d9e10b6
16 changed files with 66 additions and 22 deletions

View File

@ -43,7 +43,7 @@ Paper Status
.. [#note-P0600] P0600: The missing bits in P0600 are in |sect|\ [mem.res.class], |sect|\ [mem.poly.allocator.class], and |sect|\ [container.node.overview].
.. [#note-P0966] P0966: It was previously erroneously marked as complete in version 8.0. See `bug 45368 <https://llvm.org/PR45368>`__.
.. [#note-P0619] P0619: Only ``std::allocator`` part is implemented.
.. [#note-P0619] P0619: Only sections D.9 and D.10 are implemented. Section D.8 is partly implemented. Sections D.4, D.7, D.11, D.12, and D.14 remain undone.
.. _issues-status-cxx2a:
@ -56,4 +56,4 @@ Library Working Group Issues Status
:header-rows: 1
:widths: auto
Last Updated: 24-Nov-2020
Last Updated: 24-May-2021

View File

@ -220,12 +220,23 @@ C++17 Specific Configuration Macros
This macro is used to re-enable all the features removed in C++17. The effect
is equivalent to manually defining each macro listed below.
**_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS**:
This macro is used to re-enable the `set_unexpected`, `get_unexpected`, and
`unexpected` functions, which were removed in C++17.
**_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR**:
This macro is used to re-enable `std::auto_ptr` in C++17.
This macro is used to re-enable `auto_ptr`.
**_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS**:
This macro is used to re-enable the `binder1st`, `binder2nd`,
`pointer_to_unary_function`, `pointer_to_binary_function`, `mem_fun_t`,
`mem_fun1_t`, `mem_fun_ref_t`, `mem_fun1_ref_t`, `const_mem_fun_t`,
`const_mem_fun1_t`, `const_mem_fun_ref_t`, and `const_mem_fun1_ref_t`
class templates, and the `bind1st`, `bind2nd`, `mem_fun`, `mem_fun_ref`,
and `ptr_fun` functions.
**_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE**:
This macro is used to re-enable the `random_shuffle` algorithm.
**_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS**:
This macro is used to re-enable `set_unexpected`, `get_unexpected`, and
`unexpected`.
C++20 Specific Configuration Macros:
------------------------------------
@ -234,6 +245,24 @@ C++20 Specific Configuration Macros:
``[[nodiscard]]`` in dialects after C++17. See :ref:`Extended Applications of [[nodiscard]] <nodiscard extension>`
for more information.
**_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES**:
This macro is used to re-enable all the features removed in C++20. The effect
is equivalent to manually defining each macro listed below.
**_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS**:
This macro is used to re-enable redundant members of `allocator<T>`,
including `pointer`, `reference`, `rebind`, `address`, `max_size`,
`construct`, `destroy`, and the two-argument overload of `allocate`.
It also re-enables the library-provided explicit specializations
of `allocator<void>` and `allocator<const void>`.
**_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS**:
This macro is used to re-enable `not1`, `not2`, `unary_negate`,
and `binary_negate`.
**_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR**:
This macro is used to re-enable `raw_storage_iterator`.
Libc++ Extensions
=================

View File

@ -1363,11 +1363,17 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES)
#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
#define _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
#define _LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR
#endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES
#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
#define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
#endif

View File

@ -25,7 +25,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 17
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
template <class _OutputIterator, class _Tp>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator
@ -54,7 +54,7 @@ public:
#endif
};
#endif // _LIBCPP_STD_VER <= 17
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
_LIBCPP_END_NAMESPACE_STD

View File

@ -192,7 +192,7 @@ struct bit_not : unary_function<T, T>
struct identity; // C++20
template <class Predicate>
class unary_negate // deprecated in C++17
class unary_negate // deprecated in C++17, removed in C++20
: public unary_function<typename Predicate::argument_type, bool>
{
public:
@ -200,11 +200,11 @@ public:
bool operator()(const typename Predicate::argument_type& x) const;
};
template <class Predicate> // deprecated in C++17
template <class Predicate> // deprecated in C++17, removed in C++20
unary_negate<Predicate> not1(const Predicate& pred);
template <class Predicate>
class binary_negate // deprecated in C++17
class binary_negate // deprecated in C++17, removed in C++20
: public binary_function<typename Predicate::first_argument_type,
typename Predicate::second_argument_type,
bool>
@ -215,7 +215,7 @@ public:
const typename Predicate::second_argument_type& y) const;
};
template <class Predicate> // deprecated in C++17
template <class Predicate> // deprecated in C++17, removed in C++20
binary_negate<Predicate> not2(const Predicate& pred);
template <class F>
@ -1008,6 +1008,7 @@ struct _LIBCPP_TEMPLATE_VIS bit_not<void>
};
#endif
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
template <class _Predicate>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate
: public unary_function<typename _Predicate::argument_type, bool>
@ -1048,6 +1049,7 @@ template <class _Predicate>
_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
binary_negate<_Predicate>
not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
template <class __Operation>

View File

@ -13,6 +13,7 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++03, c++11, c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
#include <functional>

View File

@ -10,6 +10,7 @@
// binary_negate
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>

View File

@ -13,6 +13,7 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++03, c++11, c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
#include <functional>

View File

@ -10,6 +10,7 @@
// not1
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>

View File

@ -13,6 +13,7 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++03, c++11, c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
#include <functional>

View File

@ -10,6 +10,7 @@
// not2
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>

View File

@ -13,6 +13,7 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++03, c++11, c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
#include <functional>

View File

@ -10,6 +10,7 @@
// unary_negate
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>

View File

@ -6,7 +6,8 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: c++17
// UNSUPPORTED: c++03, c++11, c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR
// std::raw_storage_iterator

View File

@ -6,12 +6,11 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: c++03 || c++11 || c++14 || c++17
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// raw_storage_iterator
#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <memory>
#include <type_traits>
#include <cassert>

View File

@ -6,12 +6,11 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: c++03 || c++11 || c++14 || c++17
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// raw_storage_iterator
#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <memory>
#include <type_traits>
#include <cassert>