Skip to content

Commit c659a3b

Browse files
authored
[libc++][C++03] Remove macros that expand to nothing (#134046)
This is part of https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
1 parent 65eb5e8 commit c659a3b

File tree

230 files changed

+2774
-4011
lines changed

Some content is hidden

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

230 files changed

+2774
-4011
lines changed

libcxx/include/__cxx03/__algorithm/adjacent_find.h

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

2828
template <class _Iter, class _Sent, class _BinaryPredicate>
29-
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter
30-
__adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) {
29+
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _Iter __adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) {
3130
if (__first == __last)
3231
return __first;
3332
_Iter __i = __first;
@@ -40,13 +39,13 @@ __adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) {
4039
}
4140

4241
template <class _ForwardIterator, class _BinaryPredicate>
43-
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
42+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
4443
adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) {
4544
return std::__adjacent_find(std::move(__first), std::move(__last), __pred);
4645
}
4746

4847
template <class _ForwardIterator>
49-
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
48+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
5049
adjacent_find(_ForwardIterator __first, _ForwardIterator __last) {
5150
return std::adjacent_find(std::move(__first), std::move(__last), __equal_to());
5251
}

libcxx/include/__cxx03/__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 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
22+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool
2323
all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
2424
for (; __first != __last; ++__first)
2525
if (!__pred(*__first))

libcxx/include/__cxx03/__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 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
22+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool
2323
any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
2424
for (; __first != __last; ++__first)
2525
if (__pred(*__first))

libcxx/include/__cxx03/__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 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
25+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI 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 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
32+
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool
3333
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
3434
return std::binary_search(__first, __last, __value, __less<>());
3535
}

libcxx/include/__cxx03/__algorithm/comp.h

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

2121
struct __equal_to {
2222
template <class _T1, class _T2>
23-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _T1& __x, const _T2& __y) const {
23+
_LIBCPP_HIDE_FROM_ABI bool operator()(const _T1& __x, const _T2& __y) const {
2424
return __x == __y;
2525
}
2626
};
@@ -36,7 +36,7 @@ struct __less {};
3636
template <>
3737
struct __less<void, void> {
3838
template <class _Tp, class _Up>
39-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __lhs, const _Up& __rhs) const {
39+
_LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __lhs, const _Up& __rhs) const {
4040
return __lhs < __rhs;
4141
}
4242
};

libcxx/include/__cxx03/__algorithm/comp_ref_type.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222
template <class _Compare>
2323
struct __debug_less {
2424
_Compare& __comp_;
25-
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __debug_less(_Compare& __c) : __comp_(__c) {}
25+
_LIBCPP_HIDE_FROM_ABI __debug_less(_Compare& __c) : __comp_(__c) {}
2626

2727
template <class _Tp, class _Up>
28-
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Up& __y) {
28+
_LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Up& __y) {
2929
bool __r = __comp_(__x, __y);
3030
if (__r)
3131
__do_compare_assert(0, __y, __x);
3232
return __r;
3333
}
3434

3535
template <class _Tp, class _Up>
36-
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(_Tp& __x, _Up& __y) {
36+
_LIBCPP_HIDE_FROM_ABI bool operator()(_Tp& __x, _Up& __y) {
3737
bool __r = __comp_(__x, __y);
3838
if (__r)
3939
__do_compare_assert(0, __y, __x);
4040
return __r;
4141
}
4242

4343
template <class _LHS, class _RHS>
44-
_LIBCPP_CONSTEXPR_SINCE_CXX14 inline
45-
_LIBCPP_HIDE_FROM_ABI decltype((void)std::declval<_Compare&>()(std::declval<_LHS&>(), std::declval<_RHS&>()))
46-
__do_compare_assert(int, _LHS& __l, _RHS& __r) {
44+
inline _LIBCPP_HIDE_FROM_ABI decltype((void)std::declval<_Compare&>()(std::declval<_LHS&>(), std::declval<_RHS&>()))
45+
__do_compare_assert(int, _LHS& __l, _RHS& __r) {
4746
_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering");
4847
(void)__l;
4948
(void)__r;
5049
}
5150

5251
template <class _LHS, class _RHS>
53-
_LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI void __do_compare_assert(long, _LHS&, _RHS&) {}
52+
inline _LIBCPP_HIDE_FROM_ABI void __do_compare_assert(long, _LHS&, _RHS&) {}
5453
};
5554

5655
// Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference.

libcxx/include/__cxx03/__algorithm/copy.h

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ _LIBCPP_PUSH_MACROS
2929
_LIBCPP_BEGIN_NAMESPACE_STD
3030

3131
template <class, class _InIter, class _Sent, class _OutIter>
32-
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> __copy(_InIter, _Sent, _OutIter);
32+
inline _LIBCPP_HIDE_FROM_ABI pair<_InIter, _OutIter> __copy(_InIter, _Sent, _OutIter);
3333

3434
template <class _AlgPolicy>
3535
struct __copy_impl {
3636
template <class _InIter, class _Sent, class _OutIter>
37-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
38-
operator()(_InIter __first, _Sent __last, _OutIter __result) const {
37+
_LIBCPP_HIDE_FROM_ABI pair<_InIter, _OutIter> operator()(_InIter __first, _Sent __last, _OutIter __result) const {
3938
while (__first != __last) {
4039
*__result = *__first;
4140
++__first;
@@ -51,18 +50,16 @@ struct __copy_impl {
5150

5251
_OutIter& __result_;
5352

54-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit _CopySegment(_OutIter& __result)
55-
: __result_(__result) {}
53+
_LIBCPP_HIDE_FROM_ABI explicit _CopySegment(_OutIter& __result) : __result_(__result) {}
5654

57-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
55+
_LIBCPP_HIDE_FROM_ABI void
5856
operator()(typename _Traits::__local_iterator __lfirst, typename _Traits::__local_iterator __llast) {
5957
__result_ = std::__copy<_AlgPolicy>(__lfirst, __llast, std::move(__result_)).second;
6058
}
6159
};
6260

6361
template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
64-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
65-
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
62+
_LIBCPP_HIDE_FROM_ABI pair<_InIter, _OutIter> operator()(_InIter __first, _InIter __last, _OutIter __result) const {
6663
std::__for_each_segment(__first, __last, _CopySegment<_InIter, _OutIter>(__result));
6764
return std::make_pair(__last, std::move(__result));
6865
}
@@ -72,8 +69,7 @@ struct __copy_impl {
7269
__enable_if_t<__has_random_access_iterator_category<_InIter>::value &&
7370
!__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
7471
int> = 0>
75-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
76-
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
72+
_LIBCPP_HIDE_FROM_ABI pair<_InIter, _OutIter> operator()(_InIter __first, _InIter __last, _OutIter __result) const {
7773
using _Traits = __segmented_iterator_traits<_OutIter>;
7874
using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
7975

@@ -97,21 +93,19 @@ struct __copy_impl {
9793

9894
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
9995
template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
100-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
101-
operator()(_In* __first, _In* __last, _Out* __result) const {
96+
_LIBCPP_HIDE_FROM_ABI pair<_In*, _Out*> operator()(_In* __first, _In* __last, _Out* __result) const {
10297
return std::__copy_trivial_impl(__first, __last, __result);
10398
}
10499
};
105100

106101
template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter>
107-
pair<_InIter, _OutIter> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
108-
__copy(_InIter __first, _Sent __last, _OutIter __result) {
102+
pair<_InIter, _OutIter> inline _LIBCPP_HIDE_FROM_ABI __copy(_InIter __first, _Sent __last, _OutIter __result) {
109103
return std::__copy_move_unwrap_iters<__copy_impl<_AlgPolicy> >(
110104
std::move(__first), std::move(__last), std::move(__result));
111105
}
112106

113107
template <class _InputIterator, class _OutputIterator>
114-
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
108+
inline _LIBCPP_HIDE_FROM_ABI _OutputIterator
115109
copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
116110
return std::__copy<_ClassicAlgPolicy>(__first, __last, __result).second;
117111
}

libcxx/include/__cxx03/__algorithm/copy_backward.h

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ _LIBCPP_PUSH_MACROS
2929
_LIBCPP_BEGIN_NAMESPACE_STD
3030

3131
template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter>
32-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter>
33-
__copy_backward(_InIter __first, _Sent __last, _OutIter __result);
32+
_LIBCPP_HIDE_FROM_ABI pair<_InIter, _OutIter> __copy_backward(_InIter __first, _Sent __last, _OutIter __result);
3433

3534
template <class _AlgPolicy>
3635
struct __copy_backward_impl {
3736
template <class _InIter, class _Sent, class _OutIter>
38-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
39-
operator()(_InIter __first, _Sent __last, _OutIter __result) const {
37+
_LIBCPP_HIDE_FROM_ABI pair<_InIter, _OutIter> operator()(_InIter __first, _Sent __last, _OutIter __result) const {
4038
auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
4139
auto __original_last_iter = __last_iter;
4240

@@ -48,8 +46,7 @@ struct __copy_backward_impl {
4846
}
4947

5048
template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
51-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
52-
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
49+
_LIBCPP_HIDE_FROM_ABI pair<_InIter, _OutIter> operator()(_InIter __first, _InIter __last, _OutIter __result) const {
5350
using _Traits = __segmented_iterator_traits<_InIter>;
5451
auto __sfirst = _Traits::__segment(__first);
5552
auto __slast = _Traits::__segment(__last);
@@ -79,8 +76,7 @@ struct __copy_backward_impl {
7976
__enable_if_t<__has_random_access_iterator_category<_InIter>::value &&
8077
!__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
8178
int> = 0>
82-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
83-
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
79+
_LIBCPP_HIDE_FROM_ABI pair<_InIter, _OutIter> operator()(_InIter __first, _InIter __last, _OutIter __result) const {
8480
using _Traits = __segmented_iterator_traits<_OutIter>;
8581
auto __orig_last = __last;
8682
auto __segment_iterator = _Traits::__segment(__result);
@@ -107,21 +103,20 @@ struct __copy_backward_impl {
107103

108104
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
109105
template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
110-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
111-
operator()(_In* __first, _In* __last, _Out* __result) const {
106+
_LIBCPP_HIDE_FROM_ABI pair<_In*, _Out*> operator()(_In* __first, _In* __last, _Out* __result) const {
112107
return std::__copy_backward_trivial_impl(__first, __last, __result);
113108
}
114109
};
115110

116111
template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2>
117-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2>
112+
_LIBCPP_HIDE_FROM_ABI pair<_BidirectionalIterator1, _BidirectionalIterator2>
118113
__copy_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) {
119114
return std::__copy_move_unwrap_iters<__copy_backward_impl<_AlgPolicy> >(
120115
std::move(__first), std::move(__last), std::move(__result));
121116
}
122117

123118
template <class _BidirectionalIterator1, class _BidirectionalIterator2>
124-
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator2
119+
inline _LIBCPP_HIDE_FROM_ABI _BidirectionalIterator2
125120
copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) {
126121
static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value &&
127122
std::is_copy_constructible<_BidirectionalIterator1>::value,

libcxx/include/__cxx03/__algorithm/copy_if.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 _OutputIterator, class _Predicate>
21-
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
21+
inline _LIBCPP_HIDE_FROM_ABI _OutputIterator
2222
copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) {
2323
for (; __first != __last; ++__first) {
2424
if (__pred(*__first)) {

libcxx/include/__cxx03/__algorithm/copy_move_common.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ struct __can_lower_move_assignment_to_memmove {
5858
// `memmove` algorithms implementation.
5959

6060
template <class _In, class _Out>
61-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
62-
__copy_trivial_impl(_In* __first, _In* __last, _Out* __result) {
61+
_LIBCPP_HIDE_FROM_ABI pair<_In*, _Out*> __copy_trivial_impl(_In* __first, _In* __last, _Out* __result) {
6362
const size_t __n = static_cast<size_t>(__last - __first);
6463

6564
std::__constexpr_memmove(__result, __first, __element_count(__n));
@@ -68,8 +67,7 @@ __copy_trivial_impl(_In* __first, _In* __last, _Out* __result) {
6867
}
6968

7069
template <class _In, class _Out>
71-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
72-
__copy_backward_trivial_impl(_In* __first, _In* __last, _Out* __result) {
70+
_LIBCPP_HIDE_FROM_ABI pair<_In*, _Out*> __copy_backward_trivial_impl(_In* __first, _In* __last, _Out* __result) {
7371
const size_t __n = static_cast<size_t>(__last - __first);
7472
__result -= __n;
7573

@@ -89,7 +87,7 @@ template <class _Algorithm,
8987
class _Sent,
9088
class _OutIter,
9189
__enable_if_t<__can_rewrap<_InIter, _OutIter>::value, int> = 0>
92-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
90+
_LIBCPP_HIDE_FROM_ABI pair<_InIter, _OutIter>
9391
__copy_move_unwrap_iters(_InIter __first, _Sent __last, _OutIter __out_first) {
9492
auto __range = std::__unwrap_range(__first, std::move(__last));
9593
auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first));
@@ -102,7 +100,7 @@ template <class _Algorithm,
102100
class _Sent,
103101
class _OutIter,
104102
__enable_if_t<!__can_rewrap<_InIter, _OutIter>::value, int> = 0>
105-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
103+
_LIBCPP_HIDE_FROM_ABI pair<_InIter, _OutIter>
106104
__copy_move_unwrap_iters(_InIter __first, _Sent __last, _OutIter __out_first) {
107105
return _Algorithm()(std::move(__first), std::move(__last), std::move(__out_first));
108106
}

0 commit comments

Comments
 (0)