Skip to content

Commit 83bc7b5

Browse files
authored
[libc++] Remove _LIBCPP_DISABLE_NODISCARD_EXTENSIONS and refactor the tests (#87094)
This also adds a few tests that were missing.
1 parent 7c58546 commit 83bc7b5

File tree

198 files changed

+1224
-1331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+1224
-1331
lines changed

libcxx/.clang-format

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ AttributeMacros: [
4444
'_LIBCPP_NO_SANITIZE',
4545
'_LIBCPP_NO_UNIQUE_ADDRESS',
4646
'_LIBCPP_NOALIAS',
47-
'_LIBCPP_NODISCARD_EXT',
4847
'_LIBCPP_NODISCARD',
4948
'_LIBCPP_NORETURN',
5049
'_LIBCPP_OVERRIDABLE_FUNC_VIS',

libcxx/docs/ReleaseNotes/19.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ Deprecations and Removals
7979
in language modes prior to C++20. If you are using these features prior to C++20, please update to ``-std=c++20``.
8080
In LLVM 20, the C++20 synchronization library will be removed entirely in language modes prior to C++20.
8181

82+
- ``_LIBCPP_DISABLE_NODISCARD_EXT`` has been removed. ``[[nodiscard]]`` applications are now unconditional.
83+
This decision is based on LEWGs discussion on `P3122 <https://wg21.link/P3122>` and `P3162 <https://wg21.link/P3162>`
84+
to not use ``[[nodiscard]]`` in the standard.
85+
8286
- TODO: The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable that was used to enable the safe mode has been deprecated and setting
8387
it triggers an error; use the ``LIBCXX_HARDENING_MODE`` CMake variable with the value ``extensive`` instead. Similarly,
8488
the ``_LIBCPP_ENABLE_ASSERTIONS`` macro has been deprecated (setting it to ``1`` still enables the extensive mode in

libcxx/docs/UsingLibcxx.rst

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,6 @@ safety annotations.
196196
replacement scenarios from working, e.g. replacing `operator new` and
197197
expecting a non-replaced `operator new[]` to call the replaced `operator new`.
198198

199-
**_LIBCPP_DISABLE_NODISCARD_EXT**:
200-
This macro disables library-extensions of ``[[nodiscard]]``.
201-
See :ref:`Extended Applications of [[nodiscard]] <nodiscard extension>` for more information.
202-
203199
**_LIBCPP_DISABLE_DEPRECATION_WARNINGS**:
204200
This macro disables warnings when using deprecated components. For example,
205201
using `std::auto_ptr` when compiling in C++11 mode will normally trigger a
@@ -279,29 +275,6 @@ Libc++ Extensions
279275
This section documents various extensions provided by libc++, how they're
280276
provided, and any information regarding how to use them.
281277

282-
.. _nodiscard extension:
283-
284-
Extended applications of ``[[nodiscard]]``
285-
------------------------------------------
286-
287-
The ``[[nodiscard]]`` attribute is intended to help users find bugs where
288-
function return values are ignored when they shouldn't be. After C++17 the
289-
C++ standard has started to declared such library functions as ``[[nodiscard]]``.
290-
However, this application is limited and applies only to dialects after C++17.
291-
Users who want help diagnosing misuses of STL functions may desire a more
292-
liberal application of ``[[nodiscard]]``.
293-
294-
For this reason libc++ provides an extension that does just that! The
295-
extension is enabled by default and can be disabled by defining ``_LIBCPP_DISABLE_NODISCARD_EXT``.
296-
The extended applications of ``[[nodiscard]]`` takes two forms:
297-
298-
1. Backporting ``[[nodiscard]]`` to entities declared as such by the
299-
standard in newer dialects, but not in the present one.
300-
301-
2. Extended applications of ``[[nodiscard]]``, at the library's discretion,
302-
applied to entities never declared as such by the standard. You can find
303-
all such applications by grepping for ``_LIBCPP_NODISCARD_EXT``.
304-
305278
Extended integral type support
306279
------------------------------
307280

libcxx/include/__algorithm/adjacent_find.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ _LIBCPP_PUSH_MACROS
2626
_LIBCPP_BEGIN_NAMESPACE_STD
2727

2828
template <class _Iter, class _Sent, class _BinaryPredicate>
29-
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter
29+
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter
3030
__adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) {
3131
if (__first == __last)
3232
return __first;
@@ -40,13 +40,13 @@ __adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) {
4040
}
4141

4242
template <class _ForwardIterator, class _BinaryPredicate>
43-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
43+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
4444
adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) {
4545
return std::__adjacent_find(std::move(__first), std::move(__last), __pred);
4646
}
4747

4848
template <class _ForwardIterator>
49-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
49+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
5050
adjacent_find(_ForwardIterator __first, _ForwardIterator __last) {
5151
return std::adjacent_find(std::move(__first), std::move(__last), __equal_to());
5252
}

libcxx/include/__algorithm/all_of.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

2121
template <class _InputIterator, class _Predicate>
22-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
22+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
2323
all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
2424
for (; __first != __last; ++__first)
2525
if (!__pred(*__first))

libcxx/include/__algorithm/any_of.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

2121
template <class _InputIterator, class _Predicate>
22-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
22+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
2323
any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
2424
for (; __first != __last; ++__first)
2525
if (__pred(*__first))

libcxx/include/__algorithm/binary_search.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
_LIBCPP_BEGIN_NAMESPACE_STD
2323

2424
template <class _ForwardIterator, class _Tp, class _Compare>
25-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
25+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
2626
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
2727
__first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
2828
return __first != __last && !__comp(__value, *__first);
2929
}
3030

3131
template <class _ForwardIterator, class _Tp>
32-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
32+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
3333
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
3434
return std::binary_search(__first, __last, __value, __less<>());
3535
}

libcxx/include/__algorithm/clamp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2121

2222
#if _LIBCPP_STD_VER >= 17
2323
template <class _Tp, class _Compare>
24-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
24+
[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
2525
clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
2626
_LIBCPP_LIFETIMEBOUND const _Tp& __lo,
2727
_LIBCPP_LIFETIMEBOUND const _Tp& __hi,
@@ -31,7 +31,7 @@ clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
3131
}
3232

3333
template <class _Tp>
34-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
34+
[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
3535
clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
3636
_LIBCPP_LIFETIMEBOUND const _Tp& __lo,
3737
_LIBCPP_LIFETIMEBOUND const _Tp& __hi) {

libcxx/include/__algorithm/count.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ __count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __l
7979
}
8080

8181
template <class _InputIterator, class _Tp>
82-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iter_diff_t<_InputIterator>
82+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iter_diff_t<_InputIterator>
8383
count(_InputIterator __first, _InputIterator __last, const _Tp& __value) {
8484
__identity __proj;
8585
return std::__count<_ClassicAlgPolicy>(__first, __last, __value, __proj);

libcxx/include/__algorithm/count_if.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
_LIBCPP_BEGIN_NAMESPACE_STD
2121

2222
template <class _InputIterator, class _Predicate>
23-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
24-
typename iterator_traits<_InputIterator>::difference_type
25-
count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
23+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
24+
typename iterator_traits<_InputIterator>::difference_type
25+
count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
2626
typename iterator_traits<_InputIterator>::difference_type __r(0);
2727
for (; __first != __last; ++__first)
2828
if (__pred(*__first))

libcxx/include/__algorithm/equal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ __equal_iter_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _BinaryPredicate&)
5555
}
5656

5757
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
58-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
58+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
5959
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
6060
return std::__equal_iter_impl(
6161
std::__unwrap_iter(__first1), std::__unwrap_iter(__last1), std::__unwrap_iter(__first2), __pred);
6262
}
6363

6464
template <class _InputIterator1, class _InputIterator2>
65-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
65+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
6666
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) {
6767
return std::equal(__first1, __last1, __first2, __equal_to());
6868
}
@@ -96,7 +96,7 @@ __equal_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _Up*, _Pred&, _Proj1&,
9696
}
9797

9898
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
99-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
99+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
100100
equal(_InputIterator1 __first1,
101101
_InputIterator1 __last1,
102102
_InputIterator2 __first2,
@@ -119,7 +119,7 @@ equal(_InputIterator1 __first1,
119119
}
120120

121121
template <class _InputIterator1, class _InputIterator2>
122-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
122+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
123123
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
124124
return std::equal(__first1, __last1, __first2, __last2, __equal_to());
125125
}

libcxx/include/__algorithm/equal_range.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ __equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp
6060
}
6161

6262
template <class _ForwardIterator, class _Tp, class _Compare>
63-
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
63+
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
6464
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
6565
static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value, "The comparator has to be callable");
6666
static_assert(is_copy_constructible<_ForwardIterator>::value, "Iterator has to be copy constructible");
@@ -73,7 +73,7 @@ equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
7373
}
7474

7575
template <class _ForwardIterator, class _Tp>
76-
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
76+
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
7777
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
7878
return std::equal_range(std::move(__first), std::move(__last), __value, __less<>());
7979
}

libcxx/include/__algorithm/find.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ struct __find_segment {
169169

170170
// public API
171171
template <class _InputIterator, class _Tp>
172-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
172+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
173173
find(_InputIterator __first, _InputIterator __last, const _Tp& __value) {
174174
__identity __proj;
175175
return std::__rewrap_iter(

libcxx/include/__algorithm/find_end.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Fo
205205
}
206206

207207
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
208-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_end(
208+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_end(
209209
_ForwardIterator1 __first1,
210210
_ForwardIterator1 __last1,
211211
_ForwardIterator2 __first2,
@@ -215,7 +215,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
215215
}
216216

217217
template <class _ForwardIterator1, class _ForwardIterator2>
218-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
218+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
219219
find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
220220
return std::find_end(__first1, __last1, __first2, __last2, __equal_to());
221221
}

libcxx/include/__algorithm/find_first_of.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_fir
3535
}
3636

3737
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
38-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of(
38+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of(
3939
_ForwardIterator1 __first1,
4040
_ForwardIterator1 __last1,
4141
_ForwardIterator2 __first2,
@@ -45,7 +45,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
4545
}
4646

4747
template <class _ForwardIterator1, class _ForwardIterator2>
48-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of(
48+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of(
4949
_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
5050
return std::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to());
5151
}

libcxx/include/__algorithm/find_if.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

2121
template <class _InputIterator, class _Predicate>
22-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
22+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
2323
find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
2424
for (; __first != __last; ++__first)
2525
if (__pred(*__first))

libcxx/include/__algorithm/find_if_not.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

2121
template <class _InputIterator, class _Predicate>
22-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
22+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
2323
find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
2424
for (; __first != __last; ++__first)
2525
if (!__pred(*__first))

libcxx/include/__algorithm/fold.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ concept __indirectly_binary_left_foldable =
7878

7979
struct __fold_left_with_iter {
8080
template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp>
81-
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto
82-
operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
81+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
8382
using _Up = decay_t<invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>;
8483

8584
if (__first == __last) {
@@ -95,7 +94,7 @@ struct __fold_left_with_iter {
9594
}
9695

9796
template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp>
98-
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) {
97+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) {
9998
auto __result = operator()(ranges::begin(__r), ranges::end(__r), std::move(__init), std::ref(__f));
10099

101100
using _Up = decay_t<invoke_result_t<_Fp&, _Tp, range_reference_t<_Rp>>>;
@@ -107,13 +106,12 @@ inline constexpr auto fold_left_with_iter = __fold_left_with_iter();
107106

108107
struct __fold_left {
109108
template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp>
110-
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto
111-
operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
109+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
112110
return fold_left_with_iter(std::move(__first), std::move(__last), std::move(__init), std::ref(__f)).value;
113111
}
114112

115113
template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp>
116-
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) {
114+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) {
117115
return fold_left_with_iter(ranges::begin(__r), ranges::end(__r), std::move(__init), std::ref(__f)).value;
118116
}
119117
};

libcxx/include/__algorithm/includes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __includes(
4747
}
4848

4949
template <class _InputIterator1, class _InputIterator2, class _Compare>
50-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
50+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
5151
includes(_InputIterator1 __first1,
5252
_InputIterator1 __last1,
5353
_InputIterator2 __first2,
@@ -67,7 +67,7 @@ includes(_InputIterator1 __first1,
6767
}
6868

6969
template <class _InputIterator1, class _InputIterator2>
70-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
70+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
7171
includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
7272
return std::includes(std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __less<>());
7373
}

libcxx/include/__algorithm/is_heap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
_LIBCPP_BEGIN_NAMESPACE_STD
2323

2424
template <class _RandomAccessIterator, class _Compare>
25-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
25+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
2626
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
2727
return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)) == __last;
2828
}
2929

3030
template <class _RandomAccessIterator>
31-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
31+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
3232
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
3333
return std::is_heap(__first, __last, __less<>());
3434
}

libcxx/include/__algorithm/is_heap_until.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ __is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
4646
}
4747

4848
template <class _RandomAccessIterator, class _Compare>
49-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
49+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
5050
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
5151
return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp));
5252
}
5353

5454
template <class _RandomAccessIterator>
55-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
55+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
5656
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) {
5757
return std::__is_heap_until(__first, __last, __less<>());
5858
}

libcxx/include/__algorithm/is_partitioned.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
_LIBCPP_BEGIN_NAMESPACE_STD
1919

2020
template <class _InputIterator, class _Predicate>
21-
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
21+
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
2222
is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
2323
for (; __first != __last; ++__first)
2424
if (!__pred(*__first))

0 commit comments

Comments
 (0)