diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/docs/UsingLibcxx.rst @@ -271,9 +271,8 @@ Users who want help diagnosing misuses of STL functions may desire a more liberal application of ``[[nodiscard]]``. -For this reason libc++ provides an extension that does just that! The -extension must be enabled by defining ``_LIBCPP_ENABLE_NODISCARD``. The extended -applications of ``[[nodiscard]]`` takes two forms: +For this reason libc++ provides an extension that does just that! The extended +applications of ``[[nodiscard]]`` take two forms: 1. Backporting ``[[nodiscard]]`` to entities declared as such by the standard in newer dialects, but not in the present one. @@ -281,18 +280,9 @@ 2. Extended applications of ``[[nodiscard]]``, at the library's discretion, applied to entities never declared as such by the standard. -Users may also opt-out of additional applications ``[[nodiscard]]`` using -additional macros. -Applications of the first form, which backport ``[[nodiscard]]`` from a newer -dialect, may be disabled using macros specific to the dialect in which it was -added. For example, ``_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17``. -Applications of the second form, which are pure extensions, may be disabled -by defining ``_LIBCPP_DISABLE_NODISCARD_EXT``. - - -Entities declared with ``_LIBCPP_NODISCARD_EXT`` +Entities declared with ``[[nodiscard]]`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This section lists all extended applications of ``[[nodiscard]]`` to entities diff --git a/libcxx/include/__algorithm/adjacent_find.h b/libcxx/include/__algorithm/adjacent_find.h --- a/libcxx/include/__algorithm/adjacent_find.h +++ b/libcxx/include/__algorithm/adjacent_find.h @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) { if (__first != __last) { _ForwardIterator __i = __first; @@ -38,7 +38,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator adjacent_find(_ForwardIterator __first, _ForwardIterator __last) { typedef typename iterator_traits<_ForwardIterator>::value_type __v; return _VSTD::adjacent_find(__first, __last, __equal_to<__v>()); diff --git a/libcxx/include/__algorithm/all_of.h b/libcxx/include/__algorithm/all_of.h --- a/libcxx/include/__algorithm/all_of.h +++ b/libcxx/include/__algorithm/all_of.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (!__pred(*__first)) diff --git a/libcxx/include/__algorithm/any_of.h b/libcxx/include/__algorithm/any_of.h --- a/libcxx/include/__algorithm/any_of.h +++ b/libcxx/include/__algorithm/any_of.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (__pred(*__first)) diff --git a/libcxx/include/__algorithm/binary_search.h b/libcxx/include/__algorithm/binary_search.h --- a/libcxx/include/__algorithm/binary_search.h +++ b/libcxx/include/__algorithm/binary_search.h @@ -34,7 +34,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) @@ -44,7 +44,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) diff --git a/libcxx/include/__algorithm/clamp.h b/libcxx/include/__algorithm/clamp.h --- a/libcxx/include/__algorithm/clamp.h +++ b/libcxx/include/__algorithm/clamp.h @@ -25,7 +25,7 @@ #if _LIBCPP_STD_VER > 14 // clamp template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const _Tp& clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp) @@ -36,7 +36,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const _Tp& clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi) diff --git a/libcxx/include/__algorithm/count.h b/libcxx/include/__algorithm/count.h --- a/libcxx/include/__algorithm/count.h +++ b/libcxx/include/__algorithm/count.h @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename iterator_traits<_InputIterator>::difference_type count(_InputIterator __first, _InputIterator __last, const _Tp& __value_) { typename iterator_traits<_InputIterator>::difference_type __r(0); diff --git a/libcxx/include/__algorithm/count_if.h b/libcxx/include/__algorithm/count_if.h --- a/libcxx/include/__algorithm/count_if.h +++ b/libcxx/include/__algorithm/count_if.h @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename iterator_traits<_InputIterator>::difference_type count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { typename iterator_traits<_InputIterator>::difference_type __r(0); diff --git a/libcxx/include/__algorithm/equal.h b/libcxx/include/__algorithm/equal.h --- a/libcxx/include/__algorithm/equal.h +++ b/libcxx/include/__algorithm/equal.h @@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { for (; __first1 != __last1; ++__first1, (void)++__first2) if (!__pred(*__first1, *__first2)) @@ -34,7 +34,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { typedef typename iterator_traits<_InputIterator1>::value_type __v1; typedef typename iterator_traits<_InputIterator2>::value_type __v2; @@ -64,7 +64,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred) { return _VSTD::__equal::type>( @@ -73,7 +73,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { typedef typename iterator_traits<_InputIterator1>::value_type __v1; typedef typename iterator_traits<_InputIterator2>::value_type __v2; diff --git a/libcxx/include/__algorithm/equal_range.h b/libcxx/include/__algorithm/equal_range.h --- a/libcxx/include/__algorithm/equal_range.h +++ b/libcxx/include/__algorithm/equal_range.h @@ -61,7 +61,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator> equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) @@ -71,7 +71,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator> equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) diff --git a/libcxx/include/__algorithm/find.h b/libcxx/include/__algorithm/find.h --- a/libcxx/include/__algorithm/find.h +++ b/libcxx/include/__algorithm/find.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator find(_InputIterator __first, _InputIterator __last, const _Tp& __value_) { for (; __first != __last; ++__first) if (*__first == __value_) diff --git a/libcxx/include/__algorithm/find_end.h b/libcxx/include/__algorithm/find_end.h --- a/libcxx/include/__algorithm/find_end.h +++ b/libcxx/include/__algorithm/find_end.h @@ -131,7 +131,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) { return _VSTD::__find_end::type>( @@ -140,7 +140,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; diff --git a/libcxx/include/__algorithm/find_first_of.h b/libcxx/include/__algorithm/find_first_of.h --- a/libcxx/include/__algorithm/find_first_of.h +++ b/libcxx/include/__algorithm/find_first_of.h @@ -36,14 +36,14 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) { return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred); } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 find_first_of( +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 find_first_of( _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; diff --git a/libcxx/include/__algorithm/find_if.h b/libcxx/include/__algorithm/find_if.h --- a/libcxx/include/__algorithm/find_if.h +++ b/libcxx/include/__algorithm/find_if.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (__pred(*__first)) diff --git a/libcxx/include/__algorithm/find_if_not.h b/libcxx/include/__algorithm/find_if_not.h --- a/libcxx/include/__algorithm/find_if_not.h +++ b/libcxx/include/__algorithm/find_if_not.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (!__pred(*__first)) diff --git a/libcxx/include/__algorithm/includes.h b/libcxx/include/__algorithm/includes.h --- a/libcxx/include/__algorithm/includes.h +++ b/libcxx/include/__algorithm/includes.h @@ -39,7 +39,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, @@ -50,7 +50,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) diff --git a/libcxx/include/__algorithm/is_heap.h b/libcxx/include/__algorithm/is_heap.h --- a/libcxx/include/__algorithm/is_heap.h +++ b/libcxx/include/__algorithm/is_heap.h @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) @@ -33,7 +33,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) diff --git a/libcxx/include/__algorithm/is_heap_until.h b/libcxx/include/__algorithm/is_heap_until.h --- a/libcxx/include/__algorithm/is_heap_until.h +++ b/libcxx/include/__algorithm/is_heap_until.h @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator +_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; @@ -50,7 +50,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) diff --git a/libcxx/include/__algorithm/is_partitioned.h b/libcxx/include/__algorithm/is_partitioned.h --- a/libcxx/include/__algorithm/is_partitioned.h +++ b/libcxx/include/__algorithm/is_partitioned.h @@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) diff --git a/libcxx/include/__algorithm/is_permutation.h b/libcxx/include/__algorithm/is_permutation.h --- a/libcxx/include/__algorithm/is_permutation.h +++ b/libcxx/include/__algorithm/is_permutation.h @@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _BinaryPredicate __pred) { // shorten sequences as much as possible by lopping of any equal prefix @@ -71,7 +71,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) { typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; @@ -141,7 +141,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) { return _VSTD::__is_permutation::type>( @@ -150,7 +150,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; diff --git a/libcxx/include/__algorithm/is_sorted.h b/libcxx/include/__algorithm/is_sorted.h --- a/libcxx/include/__algorithm/is_sorted.h +++ b/libcxx/include/__algorithm/is_sorted.h @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) @@ -33,7 +33,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool is_sorted(_ForwardIterator __first, _ForwardIterator __last) diff --git a/libcxx/include/__algorithm/is_sorted_until.h b/libcxx/include/__algorithm/is_sorted_until.h --- a/libcxx/include/__algorithm/is_sorted_until.h +++ b/libcxx/include/__algorithm/is_sorted_until.h @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator +_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { if (__first != __last) @@ -40,7 +40,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) diff --git a/libcxx/include/__algorithm/lexicographical_compare.h b/libcxx/include/__algorithm/lexicographical_compare.h --- a/libcxx/include/__algorithm/lexicographical_compare.h +++ b/libcxx/include/__algorithm/lexicographical_compare.h @@ -39,7 +39,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, @@ -50,7 +50,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, diff --git a/libcxx/include/__algorithm/lower_bound.h b/libcxx/include/__algorithm/lower_bound.h --- a/libcxx/include/__algorithm/lower_bound.h +++ b/libcxx/include/__algorithm/lower_bound.h @@ -46,7 +46,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) @@ -56,7 +56,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) diff --git a/libcxx/include/__algorithm/max.h b/libcxx/include/__algorithm/max.h --- a/libcxx/include/__algorithm/max.h +++ b/libcxx/include/__algorithm/max.h @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) @@ -33,7 +33,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& max(const _Tp& __a, const _Tp& __b) @@ -44,7 +44,7 @@ #ifndef _LIBCPP_CXX03_LANG template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp max(initializer_list<_Tp> __t, _Compare __comp) @@ -53,7 +53,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp max(initializer_list<_Tp> __t) diff --git a/libcxx/include/__algorithm/max_element.h b/libcxx/include/__algorithm/max_element.h --- a/libcxx/include/__algorithm/max_element.h +++ b/libcxx/include/__algorithm/max_element.h @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) @@ -42,7 +42,7 @@ template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last) diff --git a/libcxx/include/__algorithm/min.h b/libcxx/include/__algorithm/min.h --- a/libcxx/include/__algorithm/min.h +++ b/libcxx/include/__algorithm/min.h @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) @@ -33,7 +33,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& min(const _Tp& __a, const _Tp& __b) @@ -44,7 +44,7 @@ #ifndef _LIBCPP_CXX03_LANG template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp min(initializer_list<_Tp> __t, _Compare __comp) @@ -53,7 +53,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp min(initializer_list<_Tp> __t) diff --git a/libcxx/include/__algorithm/min_element.h b/libcxx/include/__algorithm/min_element.h --- a/libcxx/include/__algorithm/min_element.h +++ b/libcxx/include/__algorithm/min_element.h @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) @@ -41,7 +41,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last) diff --git a/libcxx/include/__algorithm/minmax.h b/libcxx/include/__algorithm/minmax.h --- a/libcxx/include/__algorithm/minmax.h +++ b/libcxx/include/__algorithm/minmax.h @@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) @@ -35,7 +35,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair minmax(const _Tp& __a, const _Tp& __b) @@ -46,7 +46,7 @@ #ifndef _LIBCPP_CXX03_LANG template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t, _Compare __comp) @@ -84,7 +84,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t) diff --git a/libcxx/include/__algorithm/minmax_element.h b/libcxx/include/__algorithm/minmax_element.h --- a/libcxx/include/__algorithm/minmax_element.h +++ b/libcxx/include/__algorithm/minmax_element.h @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11 +_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { @@ -74,7 +74,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last) diff --git a/libcxx/include/__algorithm/mismatch.h b/libcxx/include/__algorithm/mismatch.h --- a/libcxx/include/__algorithm/mismatch.h +++ b/libcxx/include/__algorithm/mismatch.h @@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { for (; __first1 != __last1; ++__first1, (void)++__first2) @@ -35,7 +35,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { typedef typename iterator_traits<_InputIterator1>::value_type __v1; @@ -45,7 +45,7 @@ #if _LIBCPP_STD_VER > 11 template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred) { @@ -56,7 +56,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { typedef typename iterator_traits<_InputIterator1>::value_type __v1; diff --git a/libcxx/include/__algorithm/none_of.h b/libcxx/include/__algorithm/none_of.h --- a/libcxx/include/__algorithm/none_of.h +++ b/libcxx/include/__algorithm/none_of.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (__pred(*__first)) diff --git a/libcxx/include/__algorithm/remove.h b/libcxx/include/__algorithm/remove.h --- a/libcxx/include/__algorithm/remove.h +++ b/libcxx/include/__algorithm/remove.h @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator +_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { __first = _VSTD::find(__first, __last, __value_); diff --git a/libcxx/include/__algorithm/remove_if.h b/libcxx/include/__algorithm/remove_if.h --- a/libcxx/include/__algorithm/remove_if.h +++ b/libcxx/include/__algorithm/remove_if.h @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator +_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { __first = _VSTD::find_if<_ForwardIterator, typename add_lvalue_reference<_Predicate>::type> diff --git a/libcxx/include/__algorithm/search.h b/libcxx/include/__algorithm/search.h --- a/libcxx/include/__algorithm/search.h +++ b/libcxx/include/__algorithm/search.h @@ -98,7 +98,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) { return _VSTD::__search::type>( @@ -108,7 +108,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; @@ -117,7 +117,7 @@ #if _LIBCPP_STD_VER > 14 template -_LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator +_LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher& __s) { return __s(__f, __l).first; } diff --git a/libcxx/include/__algorithm/search_n.h b/libcxx/include/__algorithm/search_n.h --- a/libcxx/include/__algorithm/search_n.h +++ b/libcxx/include/__algorithm/search_n.h @@ -95,7 +95,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator search_n( +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator search_n( _ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_, _BinaryPredicate __pred) { return _VSTD::__search_n::type>( __first, __last, _VSTD::__convert_to_integral(__count), __value_, __pred, @@ -103,7 +103,7 @@ } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_) { typedef typename iterator_traits<_ForwardIterator>::value_type __v; return _VSTD::search_n(__first, __last, _VSTD::__convert_to_integral(__count), __value_, __equal_to<__v, _Tp>()); diff --git a/libcxx/include/__algorithm/unique.h b/libcxx/include/__algorithm/unique.h --- a/libcxx/include/__algorithm/unique.h +++ b/libcxx/include/__algorithm/unique.h @@ -28,7 +28,7 @@ // unique template -_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator +_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) { __first = _VSTD::adjacent_find<_ForwardIterator, typename add_lvalue_reference<_BinaryPredicate>::type> @@ -47,7 +47,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator unique(_ForwardIterator __first, _ForwardIterator __last) diff --git a/libcxx/include/__algorithm/upper_bound.h b/libcxx/include/__algorithm/upper_bound.h --- a/libcxx/include/__algorithm/upper_bound.h +++ b/libcxx/include/__algorithm/upper_bound.h @@ -46,7 +46,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) @@ -56,7 +56,7 @@ } template -_LIBCPP_NODISCARD_EXT inline +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1051,32 +1051,15 @@ # define _LIBCPP_CONSTEXPR_AFTER_CXX17 #endif -// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other -// NODISCARD macros to the correct attribute. #if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_NODISCARD_ATTRIBUTE [[nodiscard]] +# define _LIBCPP_NODISCARD [[nodiscard]] #elif defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_CXX03_LANG) -# define _LIBCPP_NODISCARD_ATTRIBUTE [[clang::warn_unused_result]] +# define _LIBCPP_NODISCARD [[clang::warn_unused_result]] #else // We can't use GCC's [[gnu::warn_unused_result]] and // __attribute__((warn_unused_result)), because GCC does not silence them via // (void) cast. -# define _LIBCPP_NODISCARD_ATTRIBUTE -#endif - -// _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not -// specified as such as an extension. -#if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT) -# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD_ATTRIBUTE -#else -# define _LIBCPP_NODISCARD_EXT -#endif - -#if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && \ - (_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD)) -# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD_ATTRIBUTE -#else -# define _LIBCPP_NODISCARD_AFTER_CXX17 +# define _LIBCPP_NODISCARD #endif #if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L) diff --git a/libcxx/include/__functional/identity.h b/libcxx/include/__functional/identity.h --- a/libcxx/include/__functional/identity.h +++ b/libcxx/include/__functional/identity.h @@ -23,7 +23,7 @@ struct identity { template - _LIBCPP_NODISCARD_EXT constexpr _Tp&& operator()(_Tp&& __t) const noexcept + _LIBCPP_NODISCARD constexpr _Tp&& operator()(_Tp&& __t) const noexcept { return _VSTD::forward<_Tp>(__t); } diff --git a/libcxx/include/__iterator/empty.h b/libcxx/include/__iterator/empty.h --- a/libcxx/include/__iterator/empty.h +++ b/libcxx/include/__iterator/empty.h @@ -26,18 +26,18 @@ #if _LIBCPP_STD_VER > 14 template -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY constexpr auto empty(const _Cont& __c) _NOEXCEPT_(noexcept(__c.empty())) -> decltype (__c.empty()) { return __c.empty(); } template -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY constexpr bool empty(const _Tp (&)[_Sz]) noexcept { return false; } template -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; } #endif // _LIBCPP_STD_VER > 14 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 @@ -97,7 +97,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 allocator(const allocator<_Up>&) _NOEXCEPT { } - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp* allocate(size_t __n) { if (__n > allocator_traits::max_size(*this)) __throw_length_error("allocator::allocate(size_t n)" @@ -139,7 +139,7 @@ return _VSTD::addressof(__x); } - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 _Tp* allocate(size_t __n, const void*) { return allocate(__n); } @@ -179,7 +179,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 allocator(const allocator<_Up>&) _NOEXCEPT { } - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 const _Tp* allocate(size_t __n) { if (__n > allocator_traits::max_size(*this)) __throw_length_error("allocator::allocate(size_t n)" @@ -217,7 +217,7 @@ return _VSTD::addressof(__x); } - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 const _Tp* allocate(size_t __n, const void*) { return allocate(__n); } diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h --- a/libcxx/include/__memory/allocator_traits.h +++ b/libcxx/include/__memory/allocator_traits.h @@ -257,14 +257,14 @@ }; #endif // _LIBCPP_CXX03_LANG - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 static pointer allocate(allocator_type& __a, size_type __n) { return __a.allocate(__n); } template ::value> > - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) { _LIBCPP_SUPPRESS_DEPRECATED_PUSH return __a.allocate(__n, __hint); @@ -272,7 +272,7 @@ } template ::value> > - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer) { return __a.allocate(__n); } 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 @@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT _LIBCPP_NO_CFI +_LIBCPP_NODISCARD _LIBCPP_NO_CFI pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT { diff --git a/libcxx/include/__mutex_base b/libcxx/include/__mutex_base --- a/libcxx/include/__mutex_base +++ b/libcxx/include/__mutex_base @@ -85,11 +85,11 @@ mutex_type& __m_; public: - _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) : __m_(__m) {__m_.lock();} - _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) : __m_(__m) {} _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/__node_handle b/libcxx/include/__node_handle --- a/libcxx/include/__node_handle +++ b/libcxx/include/__node_handle @@ -126,7 +126,7 @@ _LIBCPP_INLINE_VISIBILITY explicit operator bool() const { return __ptr_ != nullptr; } - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const { return __ptr_ == nullptr; } _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/__utility/as_const.h b/libcxx/include/__utility/as_const.h --- a/libcxx/include/__utility/as_const.h +++ b/libcxx/include/__utility/as_const.h @@ -25,7 +25,7 @@ #if _LIBCPP_STD_VER > 14 template -_LIBCPP_NODISCARD_EXT constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; } +_LIBCPP_NODISCARD constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; } template void as_const(const _Tp&&) = delete; diff --git a/libcxx/include/__utility/forward.h b/libcxx/include/__utility/forward.h --- a/libcxx/include/__utility/forward.h +++ b/libcxx/include/__utility/forward.h @@ -23,13 +23,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT { return static_cast<_Tp&&>(__t); } template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT { static_assert(!is_lvalue_reference<_Tp>::value, "cannot forward an rvalue as an lvalue"); return static_cast<_Tp&&>(__t); diff --git a/libcxx/include/__utility/move.h b/libcxx/include/__utility/move.h --- a/libcxx/include/__utility/move.h +++ b/libcxx/include/__utility/move.h @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename remove_reference<_Tp>::type&& +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename remove_reference<_Tp>::type&& move(_Tp&& __t) _NOEXCEPT { typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tp>::type _Up; return static_cast<_Up&&>(__t); @@ -40,7 +40,7 @@ #endif template -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __move_if_noexcept_result_t<_Tp> +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __move_if_noexcept_result_t<_Tp> move_if_noexcept(_Tp& __x) _NOEXCEPT { return _VSTD::move(__x); } diff --git a/libcxx/include/__utility/to_underlying.h b/libcxx/include/__utility/to_underlying.h --- a/libcxx/include/__utility/to_underlying.h +++ b/libcxx/include/__utility/to_underlying.h @@ -32,7 +32,7 @@ #if _LIBCPP_STD_VER > 20 template -_LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY constexpr underlying_type_t<_Tp> +_LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY constexpr underlying_type_t<_Tp> to_underlying(_Tp __val) noexcept { return _VSTD::__to_underlying(__val); } diff --git a/libcxx/include/array b/libcxx/include/array --- a/libcxx/include/array +++ b/libcxx/include/array @@ -188,7 +188,7 @@ _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;} // element access: @@ -302,7 +302,7 @@ _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return 0; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return 0;} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return true;} // element access: diff --git a/libcxx/include/cstddef b/libcxx/include/cstddef --- a/libcxx/include/cstddef +++ b/libcxx/include/cstddef @@ -152,7 +152,7 @@ { return static_cast(static_cast(static_cast(__lhs) >> __shift)); } template > - _LIBCPP_NODISCARD_EXT constexpr _Integer + _LIBCPP_NODISCARD constexpr _Integer to_integer(byte __b) noexcept { return static_cast<_Integer>(__b); } } diff --git a/libcxx/include/deque b/libcxx/include/deque --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -1403,7 +1403,7 @@ void resize(size_type __n); void resize(size_type __n, const value_type& __v); void shrink_to_fit() _NOEXCEPT; - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __base::size() == 0;} // element access: diff --git a/libcxx/include/filesystem b/libcxx/include/filesystem --- a/libcxx/include/filesystem +++ b/libcxx/include/filesystem @@ -1371,7 +1371,7 @@ } // query - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const noexcept { return __pn_.empty(); } diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list --- a/libcxx/include/forward_list +++ b/libcxx/include/forward_list @@ -754,7 +754,7 @@ const_iterator cbefore_begin() const _NOEXCEPT {return const_iterator(base::__before_begin());} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return base::__before_begin()->__next_ == nullptr;} _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/future b/libcxx/include/future --- a/libcxx/include/future +++ b/libcxx/include/future @@ -2195,7 +2195,7 @@ { return (int(__policy) & int(__value)) != 0; } template -_LIBCPP_NODISCARD_AFTER_CXX17 +_LIBCPP_NODISCARD future::type, typename decay<_Args>::type...>::type> async(launch __policy, _Fp&& __f, _Args&&... __args) { @@ -2221,7 +2221,7 @@ } template -_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY future::type, typename decay<_Args>::type...>::type> async(_Fp&& __f, _Args&&... __args) { diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -931,7 +931,7 @@ _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return base::__sz();} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return base::empty();} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT diff --git a/libcxx/include/map b/libcxx/include/map --- a/libcxx/include/map +++ b/libcxx/include/map @@ -1146,7 +1146,7 @@ _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __tree_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __tree_.size();} @@ -1929,7 +1929,7 @@ _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __tree_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __tree_.size();} diff --git a/libcxx/include/new b/libcxx/include/new --- a/libcxx/include/new +++ b/libcxx/include/new @@ -177,16 +177,16 @@ #if !defined(_LIBCPP_ABI_VCRUNTIME) -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC; -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; +_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC; +_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _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; #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; #endif -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC; -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; +_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC; +_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _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; #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION @@ -194,16 +194,16 @@ #endif #ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; +_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; +_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* 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; #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; #endif -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; +_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; +_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* 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; #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION @@ -211,8 +211,8 @@ #endif #endif -_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;} -_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;} +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;} +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;} inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {} inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {} @@ -332,7 +332,7 @@ template -_LIBCPP_NODISCARD_AFTER_CXX17 inline +_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT { static_assert (!(is_function<_Tp>::value), "can't launder functions" ); @@ -347,7 +347,7 @@ #if _LIBCPP_STD_VER > 14 template -_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD inline _LIBCPP_INLINE_VISIBILITY constexpr _Tp* launder(_Tp* __p) noexcept { return _VSTD::__launder(__p); diff --git a/libcxx/include/queue b/libcxx/include/queue --- a/libcxx/include/queue +++ b/libcxx/include/queue @@ -305,7 +305,7 @@ #endif // _LIBCPP_CXX03_LANG - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} _LIBCPP_INLINE_VISIBILITY size_type size() const {return c.size();} @@ -559,7 +559,7 @@ _EnableIf::value>* = 0); #endif // _LIBCPP_CXX03_LANG - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} _LIBCPP_INLINE_VISIBILITY size_type size() const {return c.size();} diff --git a/libcxx/include/regex b/libcxx/include/regex --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -5383,7 +5383,7 @@ size_type size() const _NOEXCEPT {return __matches_.size();} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT {return __matches_.max_size();} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return size() == 0;} // element access: diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator --- a/libcxx/include/scoped_allocator +++ b/libcxx/include/scoped_allocator @@ -478,11 +478,11 @@ const outer_allocator_type& outer_allocator() const _NOEXCEPT {return base::outer_allocator();} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n) {return allocator_traits:: allocate(outer_allocator(), __n);} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, const_void_pointer __hint) {return allocator_traits:: allocate(outer_allocator(), __n, __hint);} diff --git a/libcxx/include/set b/libcxx/include/set --- a/libcxx/include/set +++ b/libcxx/include/set @@ -649,7 +649,7 @@ _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __tree_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __tree_.size();} @@ -1180,7 +1180,7 @@ _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __tree_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __tree_.size();} diff --git a/libcxx/include/stack b/libcxx/include/stack --- a/libcxx/include/stack +++ b/libcxx/include/stack @@ -183,7 +183,7 @@ : c(_VSTD::move(__s.c), __a) {} #endif // _LIBCPP_CXX03_LANG - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} _LIBCPP_INLINE_VISIBILITY size_type size() const {return c.size();} diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -990,7 +990,7 @@ void shrink_to_fit() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT; - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return size() == 0;} _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __pos) const _NOEXCEPT; diff --git a/libcxx/include/string_view b/libcxx/include/string_view --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -313,7 +313,7 @@ _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT { return numeric_limits::max(); } - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return __size == 0; } // [string.view.access], element access diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -2340,7 +2340,7 @@ #ifndef _LIBCPP_CXX03_LANG template -_LIBCPP_NODISCARD_ATTRIBUTE _LIBCPP_INLINE_VISIBILITY constexpr +_LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY constexpr typename make_unsigned<_Tp>::type __to_unsigned_like(_Tp __x) noexcept { return static_cast::type>(__x); } diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -1075,7 +1075,7 @@ allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__table_.__node_alloc());} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __table_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __table_.size();} @@ -2010,7 +2010,7 @@ allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__table_.__node_alloc());} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __table_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __table_.size();} diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -539,7 +539,7 @@ allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__table_.__node_alloc());} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __table_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __table_.size();} @@ -1234,7 +1234,7 @@ allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__table_.__node_alloc());} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __table_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __table_.size();} diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -661,7 +661,7 @@ _LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT {return __base::capacity();} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return this->__begin_ == this->__end_;} size_type max_size() const _NOEXCEPT; @@ -2308,7 +2308,7 @@ _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __size_;} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __size_ == 0;} void reserve(size_type __n); diff --git a/libcxx/test/libcxx/diagnostics/enable_nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/enable_nodiscard.verify.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/diagnostics/enable_nodiscard.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Test that _LIBCPP_NODISCARD_EXT and _LIBCPP_NODISCARD_AFTER_CXX17 are defined -// to the appropriate warning-generating attribute when _LIBCPP_ENABLE_NODISCARD -// is explicitly provided. - -// UNSUPPORTED: c++03 - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD - -#include <__config> - -_LIBCPP_NODISCARD_EXT int foo() { return 42; } -_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; } - -int main(int, char**) { - foo(); // expected-warning-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} - bar(); // expected-warning-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} - (void)foo(); // OK. void casts disable the diagnostic. - (void)bar(); - - return 0; -} diff --git a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.verify.cpp b/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.verify.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.verify.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// Test that _LIBCPP_DISABLE_NODISCARD_EXT only disables _LIBCPP_NODISCARD_EXT -// and not _LIBCPP_NODISCARD_AFTER_CXX17. - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17 -#include <__config> - - -_LIBCPP_NODISCARD_EXT int foo() { return 42; } -_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; } - -int main(int, char**) { - foo(); // expected-warning-re{{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} - bar(); // OK. - (void)foo(); // OK. - - return 0; -} diff --git a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.verify.cpp b/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.verify.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.verify.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_EXT -#include <__config> - - -_LIBCPP_NODISCARD_EXT int foo() { return 42; } -_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; } - -int main(int, char**) { - bar(); // expected-warning-re{{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} - foo(); // OK. - (void)bar(); // OK. - - return 0; -} diff --git a/libcxx/test/libcxx/diagnostics/nodiscard.pass.cpp b/libcxx/test/libcxx/diagnostics/nodiscard.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/diagnostics/nodiscard.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Test that _LIBCPP_NODISCARD_EXT is not defined to [[nodiscard]] unless -// explicitly enabled by _LIBCPP_ENABLE_NODISCARD - -#include <__config> - -#include "test_macros.h" - -_LIBCPP_NODISCARD_EXT int foo() { return 42; } - -int main(int, char**) { - foo(); // OK. - - return 0; -} diff --git a/libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp b/libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Test that _LIBCPP_NODISCARD_AFTER_CXX17 is disabled whenever -// _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17 is defined by the user. - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17 - -#include <__config> - -#include "test_macros.h" - -_LIBCPP_NODISCARD_AFTER_CXX17 int foo() { return 6; } - -int main(int, char**) -{ - foo(); // no error here! - - return 0; -} diff --git a/libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.verify.cpp b/libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.verify.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.verify.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Test that _LIBCPP_NODISCARD_AFTER_CXX17 works -// #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]] - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <__config> - -_LIBCPP_NODISCARD_AFTER_CXX17 int foo() { return 6; } - -int main(int, char**) -{ - foo(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - return 0; -} diff --git a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp +++ /dev/null @@ -1,195 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Test that entities declared [[nodiscard]] as at extension by libc++, are -// only actually declared such when _LIBCPP_ENABLE_NODISCARD is specified. - -// This test intentionally leaks memory, so it is unsupported under ASAN. -// UNSUPPORTED: asan - -// AppleClang9 and GCC 5 don't support C++17's implicitly synthesized -// deduction guides from existing ctors, needed by default_searcher() below. -// UNSUPPORTED: apple-clang-9 - -// All entities to which libc++ applies [[nodiscard]] as an extension should -// be tested here and in nodiscard_extensions.fail.cpp. They should also -// be listed in `UsingLibcxx.rst` in the documentation for the extension. - -#include -#include // to_integer -#include // identity -#include -#include -#include // to_underlying - -#include "test_macros.h" - -struct P { - bool operator()(int) const { return false; } -}; - -void test_algorithms() { - int arr[1] = { 1 }; - - std::adjacent_find(std::begin(arr), std::end(arr)); - std::adjacent_find(std::begin(arr), std::end(arr), std::greater()); - std::all_of(std::begin(arr), std::end(arr), P()); - std::any_of(std::begin(arr), std::end(arr), P()); - std::binary_search(std::begin(arr), std::end(arr), 1); - std::binary_search(std::begin(arr), std::end(arr), 1, std::greater()); -#if TEST_STD_VER >= 17 - std::clamp(2, 1, 3); - std::clamp(2, 3, 1, std::greater()); -#endif - std::count_if(std::begin(arr), std::end(arr), P()); - std::count(std::begin(arr), std::end(arr), 1); - std::equal_range(std::begin(arr), std::end(arr), 1); - std::equal_range(std::begin(arr), std::end(arr), 1, std::greater()); - std::equal(std::begin(arr), std::end(arr), std::begin(arr)); - std::equal(std::begin(arr), std::end(arr), std::begin(arr), - std::greater()); -#if TEST_STD_VER >= 14 - std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), - std::greater()); -#endif - std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), - std::greater()); - std::find_first_of(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr)); - std::find_first_of(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr), std::greater()); - std::find_if_not(std::begin(arr), std::end(arr), P()); - std::find_if(std::begin(arr), std::end(arr), P()); - std::find(std::begin(arr), std::end(arr), 1); - std::get_temporary_buffer(1); // intentional memory leak. - std::includes(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - std::includes(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), - std::greater()); - std::is_heap_until(std::begin(arr), std::end(arr)); - std::is_heap_until(std::begin(arr), std::end(arr), std::greater()); - std::is_heap(std::begin(arr), std::end(arr)); - std::is_heap(std::begin(arr), std::end(arr), std::greater()); - std::is_partitioned(std::begin(arr), std::end(arr), P()); - std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr)); - std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), - std::greater()); -#if TEST_STD_VER >= 14 - std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr)); - std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr), std::greater()); -#endif - std::is_sorted_until(std::begin(arr), std::end(arr)); - std::is_sorted_until(std::begin(arr), std::end(arr), std::greater()); - std::is_sorted(std::begin(arr), std::end(arr)); - std::is_sorted(std::begin(arr), std::end(arr), std::greater()); - std::lexicographical_compare(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr)); - std::lexicographical_compare(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr), std::greater()); - std::lower_bound(std::begin(arr), std::end(arr), 1); - std::lower_bound(std::begin(arr), std::end(arr), 1, std::greater()); - std::max_element(std::begin(arr), std::end(arr)); - std::max_element(std::begin(arr), std::end(arr), std::greater()); - std::max(1, 2); - std::max(1, 2, std::greater()); -#if TEST_STD_VER >= 11 - std::max({1, 2, 3}); - std::max({1, 2, 3}, std::greater()); -#endif - std::min_element(std::begin(arr), std::end(arr)); - std::min_element(std::begin(arr), std::end(arr), std::greater()); - std::min(1, 2); - std::min(1, 2, std::greater()); -#if TEST_STD_VER >= 11 - std::min({1, 2, 3}); - std::min({1, 2, 3}, std::greater()); -#endif - std::minmax_element(std::begin(arr), std::end(arr)); - std::minmax_element(std::begin(arr), std::end(arr), std::greater()); - std::minmax(1, 2); - std::minmax(1, 2, std::greater()); -#if TEST_STD_VER >= 11 - std::minmax({1, 2, 3}); - std::minmax({1, 2, 3}, std::greater()); -#endif - std::mismatch(std::begin(arr), std::end(arr), std::begin(arr)); - std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), - std::greater()); -#if TEST_STD_VER >= 14 - std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), - std::greater()); -#endif - std::none_of(std::begin(arr), std::end(arr), P()); - std::remove_if(std::begin(arr), std::end(arr), P()); - std::remove(std::begin(arr), std::end(arr), 1); - std::search_n(std::begin(arr), std::end(arr), 1, 1); - std::search_n(std::begin(arr), std::end(arr), 1, 1, std::greater()); - std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), - std::greater()); -#if TEST_STD_VER >= 17 - std::search(std::begin(arr), std::end(arr), - std::default_searcher(std::begin(arr), std::end(arr))); -#endif - std::unique(std::begin(arr), std::end(arr)); - std::unique(std::begin(arr), std::end(arr), std::greater()); - std::upper_bound(std::begin(arr), std::end(arr), 1); - std::upper_bound(std::begin(arr), std::end(arr), 1, std::greater()); -} - -template -void test_template_cast_wrappers(LV&& lv, RV&& rv) { - std::forward(lv); - std::forward(rv); - std::move(lv); - std::move(rv); - std::move_if_noexcept(lv); - std::move_if_noexcept(rv); - -#if TEST_STD_VER >= 17 - std::as_const(lv); - std::as_const(rv); -#endif - -#if TEST_STD_VER >= 20 - std::identity()(lv); - std::identity()(rv); -#endif -} - -void test_nontemplate_cast_wrappers() -{ -#if TEST_STD_VER >= 17 - std::byte b{42}; - std::to_integer(b); -#endif - -#if TEST_STD_VER >= 20 - // std::bit_cast(42); -#endif - -#if TEST_STD_VER > 20 - enum E { Apple, Orange } e = Apple; - std::to_underlying(e); -#endif -} - -int main(int, char**) { - test_algorithms(); - - int i = 42; - test_template_cast_wrappers(i, std::move(i)); - test_nontemplate_cast_wrappers(); - - return 0; -} diff --git a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.verify.cpp b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.verify.cpp --- a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.verify.cpp +++ b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.verify.cpp @@ -13,15 +13,12 @@ // guides from existing ctors, needed by default_searcher() below. // UNSUPPORTED: apple-clang-9 -// Test that entities declared [[nodiscard]] as an extension by libc++, are -// only actually declared such when _LIBCPP_ENABLE_NODISCARD is specified. +// Test that entities declared [[nodiscard]] as an extension by libc++. // All entities to which libc++ applies [[nodiscard]] as an extension should // be tested here and in nodiscard_extensions.pass.cpp. They should also // be listed in `UsingLibcxx.rst` in the documentation for the extension. -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD - #include #include // to_integer #include // identity diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp --- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp @@ -22,15 +22,15 @@ typedef cpp17_input_iterator Iter; { // expected-error@*:* {{"std::min_element requires a ForwardIterator"}} - std::min_element(Iter(b), Iter(e)); + (void)std::min_element(Iter(b), Iter(e)); } { // expected-error@*:* {{"std::max_element requires a ForwardIterator"}} - std::max_element(Iter(b), Iter(e)); + (void)std::max_element(Iter(b), Iter(e)); } { // expected-error@*:* {{"std::minmax_element requires a ForwardIterator"}} - std::minmax_element(Iter(b), Iter(e)); + (void)std::minmax_element(Iter(b), Iter(e)); } diff --git a/libcxx/test/std/utilities/utility/forward/forward.fail.cpp b/libcxx/test/std/utilities/utility/forward/forward.fail.cpp --- a/libcxx/test/std/utilities/utility/forward/forward.fail.cpp +++ b/libcxx/test/std/utilities/utility/forward/forward.fail.cpp @@ -22,26 +22,26 @@ int main(int, char**) { { - std::forward(source()); // expected-note {{requested here}} + (void)std::forward(source()); // expected-note {{requested here}} // expected-error-re@*:* 1 {{static_assert failed{{.*}} "cannot forward an rvalue as an lvalue"}} } { const A ca = A(); - std::forward(ca); // expected-error {{no matching function for call to 'forward'}} + (void)std::forward(ca); // expected-error {{no matching function for call to 'forward'}} } { - std::forward(csource()); // expected-error {{no matching function for call to 'forward'}} + (void)std::forward(csource()); // expected-error {{no matching function for call to 'forward'}} } { const A ca = A(); - std::forward(ca); // expected-error {{no matching function for call to 'forward'}} + (void)std::forward(ca); // expected-error {{no matching function for call to 'forward'}} } { - std::forward(csource()); // expected-error {{no matching function for call to 'forward'}} + (void)std::forward(csource()); // expected-error {{no matching function for call to 'forward'}} } { A a; - std::forward(a); // expected-error {{no matching function for call to 'forward'}} + (void)std::forward(a); // expected-error {{no matching function for call to 'forward'}} } return 0;