Skip to content

Commit 94e7c0b

Browse files
[libc++] Remove get_temporary_buffer and return_temporary_buffer (#100914)
Works towards P0619R4 / #99985. The use of `std::get_temporary_buffer` and `std::return_temporary_buffer` are replaced with `unique_ptr`-based RAII buffer holder. Escape hatches: - `_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER` restores `std::get_temporary_buffer` and `std::return_temporary_buffer`. Drive-by changes: - In `<syncstream>`, states that `get_temporary_buffer` is now removed, because `<syncstream>` is added in C++20.
1 parent 0bc8168 commit 94e7c0b

File tree

18 files changed

+153
-84
lines changed

18 files changed

+153
-84
lines changed

libcxx/docs/ReleaseNotes/20.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ Improvements and New Features
4949
- The ``lexicographical_compare`` and ``ranges::lexicographical_compare`` algorithms have been optimized for trivially
5050
equality comparable types, resulting in a performance improvement of up to 40x.
5151

52+
- The ``_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER`` macro has been added to make ``std::get_temporary_buffer`` and
53+
``std::return_temporary_buffer`` available.
54+
5255
- The ``_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION`` macro has been added to make ``std::uncaught_exception``
5356
available in C++20 and later modes.
5457

libcxx/docs/Status/Cxx20Papers.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"`P0528R3 <https://wg21.link/P0528R3>`__","The Curious Case of Padding Bits, Featuring Atomic Compare-and-Exchange","2018-06 (Rapperswil)","","",""
3535
"`P0542R5 <https://wg21.link/P0542R5>`__","Support for contract based programming in C++","2018-06 (Rapperswil)","|Nothing To Do|","n/a","Pulled at the 2019-07 meeting in Cologne"
3636
"`P0556R3 <https://wg21.link/P0556R3>`__","Integral power-of-2 operations","2018-06 (Rapperswil)","|Complete|","9.0",""
37-
"`P0619R4 <https://wg21.link/P0619R4>`__","Reviewing Deprecated Facilities of C++17 for C++20","2018-06 (Rapperswil)","|Partial|","","Only sections D.7, D.8, D.9, D.10, D.11 and D.13 are implemented. Sections D.4 and D.12 remain undone."
37+
"`P0619R4 <https://wg21.link/P0619R4>`__","Reviewing Deprecated Facilities of C++17 for C++20","2018-06 (Rapperswil)","|Partial|","","Only sections D.7, D.8, D.9, D.10, D.11, D.12, and D.13 are implemented. Section D.4 remains undone."
3838
"`P0646R1 <https://wg21.link/P0646R1>`__","Improving the Return Value of Erase-Like Algorithms","2018-06 (Rapperswil)","|Complete|","10.0",""
3939
"`P0722R3 <https://wg21.link/P0722R3>`__","Efficient sized delete for variable sized classes","2018-06 (Rapperswil)","|Complete|","9.0",""
4040
"`P0758R1 <https://wg21.link/P0758R1>`__","Implicit conversion traits and utility functions","2018-06 (Rapperswil)","|Complete|","",""

libcxx/docs/UserDocumentation.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ C++20 Specific Configuration Macros
181181
**_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR**:
182182
This macro is used to re-enable `raw_storage_iterator`.
183183

184+
**_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER**:
185+
This macro is used to re-enable `get_temporary_buffer` and `return_temporary_buffer`.
186+
184187
**_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS**:
185188
This macro is used to re-enable `is_literal_type`, `is_literal_type_v`,
186189
`result_of` and `result_of_t`.

libcxx/include/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ set(files
556556
__memory/temporary_buffer.h
557557
__memory/uninitialized_algorithms.h
558558
__memory/unique_ptr.h
559+
__memory/unique_temporary_buffer.h
559560
__memory/uses_allocator.h
560561
__memory/uses_allocator_construction.h
561562
__memory/voidify.h

libcxx/include/__algorithm/inplace_merge.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#include <__iterator/iterator_traits.h>
2525
#include <__iterator/reverse_iterator.h>
2626
#include <__memory/destruct_n.h>
27-
#include <__memory/temporary_buffer.h>
2827
#include <__memory/unique_ptr.h>
28+
#include <__memory/unique_temporary_buffer.h>
2929
#include <__utility/pair.h>
3030
#include <new>
3131

@@ -208,16 +208,19 @@ _LIBCPP_HIDE_FROM_ABI void __inplace_merge(
208208
_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare&& __comp) {
209209
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
210210
typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
211-
difference_type __len1 = _IterOps<_AlgPolicy>::distance(__first, __middle);
212-
difference_type __len2 = _IterOps<_AlgPolicy>::distance(__middle, __last);
213-
difference_type __buf_size = std::min(__len1, __len2);
214-
// TODO: Remove the use of std::get_temporary_buffer
215-
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
216-
pair<value_type*, ptrdiff_t> __buf = std::get_temporary_buffer<value_type>(__buf_size);
217-
_LIBCPP_SUPPRESS_DEPRECATED_POP
218-
unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
211+
difference_type __len1 = _IterOps<_AlgPolicy>::distance(__first, __middle);
212+
difference_type __len2 = _IterOps<_AlgPolicy>::distance(__middle, __last);
213+
difference_type __buf_size = std::min(__len1, __len2);
214+
__unique_temporary_buffer<value_type> __unique_buf = std::__allocate_unique_temporary_buffer<value_type>(__buf_size);
219215
return std::__inplace_merge<_AlgPolicy>(
220-
std::move(__first), std::move(__middle), std::move(__last), __comp, __len1, __len2, __buf.first, __buf.second);
216+
std::move(__first),
217+
std::move(__middle),
218+
std::move(__last),
219+
__comp,
220+
__len1,
221+
__len2,
222+
__unique_buf.get(),
223+
__unique_buf.get_deleter().__count_);
221224
}
222225

223226
template <class _BidirectionalIterator, class _Compare>

libcxx/include/__algorithm/stable_partition.h

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include <__iterator/distance.h>
1717
#include <__iterator/iterator_traits.h>
1818
#include <__memory/destruct_n.h>
19-
#include <__memory/temporary_buffer.h>
2019
#include <__memory/unique_ptr.h>
20+
#include <__memory/unique_temporary_buffer.h>
2121
#include <__utility/move.h>
2222
#include <__utility/pair.h>
2323
#include <new>
@@ -132,14 +132,12 @@ __stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Pred
132132
// We now have a reduced range [__first, __last)
133133
// *__first is known to be false
134134
difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last);
135+
__unique_temporary_buffer<value_type> __unique_buf;
135136
pair<value_type*, ptrdiff_t> __p(0, 0);
136-
unique_ptr<value_type, __return_temporary_buffer> __h;
137137
if (__len >= __alloc_limit) {
138-
// TODO: Remove the use of std::get_temporary_buffer
139-
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
140-
__p = std::get_temporary_buffer<value_type>(__len);
141-
_LIBCPP_SUPPRESS_DEPRECATED_POP
142-
__h.reset(__p.first);
138+
__unique_buf = std::__allocate_unique_temporary_buffer<value_type>(__len);
139+
__p.first = __unique_buf.get();
140+
__p.second = __unique_buf.get_deleter().__count_;
143141
}
144142
return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
145143
std::move(__first), std::move(__last), __pred, __len, __p, forward_iterator_tag());
@@ -272,14 +270,12 @@ _LIBCPP_HIDE_FROM_ABI _BidirectionalIterator __stable_partition_impl(
272270
// *__last is known to be true
273271
// __len >= 2
274272
difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last) + 1;
273+
__unique_temporary_buffer<value_type> __unique_buf;
275274
pair<value_type*, ptrdiff_t> __p(0, 0);
276-
unique_ptr<value_type, __return_temporary_buffer> __h;
277275
if (__len >= __alloc_limit) {
278-
// TODO: Remove the use of std::get_temporary_buffer
279-
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
280-
__p = std::get_temporary_buffer<value_type>(__len);
281-
_LIBCPP_SUPPRESS_DEPRECATED_POP
282-
__h.reset(__p.first);
276+
__unique_buf = std::__allocate_unique_temporary_buffer<value_type>(__len);
277+
__p.first = __unique_buf.get();
278+
__p.second = __unique_buf.get_deleter().__count_;
283279
}
284280
return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
285281
std::move(__first), std::move(__last), __pred, __len, __p, bidirectional_iterator_tag());

libcxx/include/__algorithm/stable_sort.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include <__debug_utils/strict_weak_ordering_check.h>
1919
#include <__iterator/iterator_traits.h>
2020
#include <__memory/destruct_n.h>
21-
#include <__memory/temporary_buffer.h>
2221
#include <__memory/unique_ptr.h>
22+
#include <__memory/unique_temporary_buffer.h>
2323
#include <__type_traits/is_trivially_assignable.h>
2424
#include <__utility/move.h>
2525
#include <__utility/pair.h>
@@ -241,14 +241,12 @@ __stable_sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last,
241241
using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
242242

243243
difference_type __len = __last - __first;
244+
__unique_temporary_buffer<value_type> __unique_buf;
244245
pair<value_type*, ptrdiff_t> __buf(0, 0);
245-
unique_ptr<value_type, __return_temporary_buffer> __h;
246246
if (__len > static_cast<difference_type>(__stable_sort_switch<value_type>::value)) {
247-
// TODO: Remove the use of std::get_temporary_buffer
248-
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
249-
__buf = std::get_temporary_buffer<value_type>(__len);
250-
_LIBCPP_SUPPRESS_DEPRECATED_POP
251-
__h.reset(__buf.first);
247+
__unique_buf = std::__allocate_unique_temporary_buffer<value_type>(__len);
248+
__buf.first = __unique_buf.get();
249+
__buf.second = __unique_buf.get_deleter().__count_;
252250
}
253251

254252
std::__stable_sort<_AlgPolicy, __comp_ref_type<_Compare> >(__first, __last, __comp, __len, __buf.first, __buf.second);

libcxx/include/__memory/temporary_buffer.h

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define _LIBCPP___MEMORY_TEMPORARY_BUFFER_H
1212

1313
#include <__config>
14+
#include <__memory/unique_temporary_buffer.h>
1415
#include <__utility/pair.h>
1516
#include <cstddef>
1617
#include <new>
@@ -19,57 +20,27 @@
1920
# pragma GCC system_header
2021
#endif
2122

23+
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER)
24+
2225
_LIBCPP_BEGIN_NAMESPACE_STD
2326

2427
template <class _Tp>
2528
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 pair<_Tp*, ptrdiff_t>
2629
get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT {
27-
pair<_Tp*, ptrdiff_t> __r(0, 0);
28-
const ptrdiff_t __m =
29-
(~ptrdiff_t(0) ^ ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1))) / sizeof(_Tp);
30-
if (__n > __m)
31-
__n = __m;
32-
while (__n > 0) {
33-
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
34-
if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) {
35-
align_val_t __al = align_val_t(_LIBCPP_ALIGNOF(_Tp));
36-
__r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), __al, nothrow));
37-
} else {
38-
__r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow));
39-
}
40-
#else
41-
if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) {
42-
// Since aligned operator new is unavailable, return an empty
43-
// buffer rather than one with invalid alignment.
44-
return __r;
45-
}
46-
47-
__r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow));
48-
#endif
49-
50-
if (__r.first) {
51-
__r.second = __n;
52-
break;
53-
}
54-
__n /= 2;
55-
}
56-
return __r;
30+
__unique_temporary_buffer<_Tp> __unique_buf = std::__allocate_unique_temporary_buffer<_Tp>(__n);
31+
pair<_Tp*, ptrdiff_t> __result(__unique_buf.get(), __unique_buf.get_deleter().__count_);
32+
__unique_buf.release();
33+
return __result;
5734
}
5835

5936
template <class _Tp>
6037
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 void return_temporary_buffer(_Tp* __p) _NOEXCEPT {
61-
std::__libcpp_deallocate_unsized((void*)__p, _LIBCPP_ALIGNOF(_Tp));
38+
__unique_temporary_buffer<_Tp> __unique_buf(__p);
39+
(void)__unique_buf;
6240
}
6341

64-
struct __return_temporary_buffer {
65-
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
66-
template <class _Tp>
67-
_LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) const {
68-
std::return_temporary_buffer(__p);
69-
}
70-
_LIBCPP_SUPPRESS_DEPRECATED_POP
71-
};
72-
7342
_LIBCPP_END_NAMESPACE_STD
7443

44+
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER)
45+
7546
#endif // _LIBCPP___MEMORY_TEMPORARY_BUFFER_H
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// -*- C++ -*-
2+
//===----------------------------------------------------------------------===//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#ifndef _LIBCPP___MEMORY_UNIQUE_TEMPORARY_BUFFER_H
11+
#define _LIBCPP___MEMORY_UNIQUE_TEMPORARY_BUFFER_H
12+
13+
#include <__assert>
14+
#include <__config>
15+
16+
#include <__memory/allocator.h>
17+
#include <__memory/unique_ptr.h>
18+
#include <__type_traits/is_constant_evaluated.h>
19+
#include <cstddef>
20+
#include <new>
21+
22+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
23+
# pragma GCC system_header
24+
#endif
25+
26+
_LIBCPP_BEGIN_NAMESPACE_STD
27+
28+
template <class _Tp>
29+
struct __temporary_buffer_deleter {
30+
ptrdiff_t __count_; // ignored in non-constant evaluation
31+
32+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __temporary_buffer_deleter() _NOEXCEPT : __count_(0) {}
33+
_LIBCPP_HIDE_FROM_ABI
34+
_LIBCPP_CONSTEXPR explicit __temporary_buffer_deleter(ptrdiff_t __count) _NOEXCEPT : __count_(__count) {}
35+
36+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator()(_Tp* __ptr) _NOEXCEPT {
37+
if (__libcpp_is_constant_evaluated()) {
38+
allocator<_Tp>().deallocate(__ptr, __count_);
39+
return;
40+
}
41+
42+
std::__libcpp_deallocate_unsized((void*)__ptr, _LIBCPP_ALIGNOF(_Tp));
43+
}
44+
};
45+
46+
template <class _Tp>
47+
using __unique_temporary_buffer = unique_ptr<_Tp, __temporary_buffer_deleter<_Tp> >;
48+
49+
template <class _Tp>
50+
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __unique_temporary_buffer<_Tp>
51+
__allocate_unique_temporary_buffer(ptrdiff_t __count) {
52+
using __deleter_type = __temporary_buffer_deleter<_Tp>;
53+
using __unique_buffer_type = __unique_temporary_buffer<_Tp>;
54+
55+
if (__libcpp_is_constant_evaluated()) {
56+
return __unique_buffer_type(allocator<_Tp>().allocate(__count), __deleter_type(__count));
57+
}
58+
59+
_Tp* __ptr = nullptr;
60+
const ptrdiff_t __max_count =
61+
(~ptrdiff_t(0) ^ ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1))) / sizeof(_Tp);
62+
if (__count > __max_count)
63+
__count = __max_count;
64+
while (__count > 0) {
65+
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
66+
if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) {
67+
align_val_t __al = align_val_t(_LIBCPP_ALIGNOF(_Tp));
68+
__ptr = static_cast<_Tp*>(::operator new(__count * sizeof(_Tp), __al, nothrow));
69+
} else {
70+
__ptr = static_cast<_Tp*>(::operator new(__count * sizeof(_Tp), nothrow));
71+
}
72+
#else
73+
if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) {
74+
// Since aligned operator new is unavailable, constructs an empty buffer rather than one with invalid alignment.
75+
return __unique_buffer_type();
76+
}
77+
78+
__ptr = static_cast<_Tp*>(::operator new(__count * sizeof(_Tp), nothrow));
79+
#endif
80+
81+
if (__ptr) {
82+
break;
83+
}
84+
__count /= 2;
85+
}
86+
87+
return __unique_buffer_type(__ptr, __deleter_type(__count));
88+
}
89+
90+
_LIBCPP_END_NAMESPACE_STD
91+
92+
#endif // _LIBCPP___MEMORY_UNIQUE_TEMPORARY_BUFFER_H

libcxx/include/memory

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ public:
182182
raw_storage_iterator operator++(int);
183183
};
184184
185-
template <class T> pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept;
186-
template <class T> void return_temporary_buffer(T* p) noexcept;
185+
template <class T> pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept; // deprecated in C++17, removed in C++20
186+
template <class T> void return_temporary_buffer(T* p) noexcept; // deprecated in C++17, removed in C++20
187187
188188
template <class T> T* addressof(T& r) noexcept;
189189
template <class T> T* addressof(const T&& r) noexcept = delete;

libcxx/include/module.modulemap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,6 +1542,11 @@ module std_private_memory_unique_ptr [system] {
15421542
export std_private_type_traits_is_pointer
15431543
export std_private_type_traits_type_identity
15441544
}
1545+
module std_private_memory_unique_temporary_buffer [system] {
1546+
header "__memory/unique_temporary_buffer.h"
1547+
export std_private_memory_unique_ptr
1548+
export std_private_type_traits_is_constant_evaluated
1549+
}
15451550
module std_private_memory_uses_allocator [system] { header "__memory/uses_allocator.h" }
15461551
module std_private_memory_uses_allocator_construction [system] { header "__memory/uses_allocator_construction.h" }
15471552
module std_private_memory_voidify [system] { header "__memory/voidify.h" }

libcxx/include/syncstream

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ private:
364364
// TODO Use a more generic buffer.
365365
// That buffer should be light with almost no additional headers. Then
366366
// it can be use here, the __retarget_buffer, and place that use
367-
// the now deprecated get_temporary_buffer
367+
// the now removed get_temporary_buffer
368368

369369
basic_string<_CharT, _Traits, _Allocator> __str_;
370370
bool __emit_on_sync_{false};

libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// check that <memory> functions are marked [[nodiscard]]
1212

13+
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER
1314
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
1415

1516
// clang-format off

libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ test()
282282
assert(array[9] == P(0, 2));
283283
}
284284
#if TEST_STD_VER >= 11 && !defined(TEST_HAS_NO_EXCEPTIONS)
285-
// TODO: Re-enable this test once we're no longer using get_temporary_buffer().
285+
// TODO: Re-enable this test once we get recursive inlining fixed.
286286
// For now it trips up GCC due to the use of always_inline.
287-
#if 0
287+
# if 0
288288
{ // check that the algorithm still works when no memory is available
289289
std::vector<int> vec(150, 3);
290290
vec[5] = 6;
@@ -300,7 +300,7 @@ test()
300300
assert(std::is_partitioned(vec.begin(), vec.end(), [](int i) { return i < 5; }));
301301
getGlobalMemCounter()->reset();
302302
}
303-
#endif
303+
# endif
304304
#endif // TEST_STD_VER >= 11 && !defined(TEST_HAS_NO_EXCEPTIONS)
305305
}
306306

libcxx/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// UNSUPPORTED: c++03
1010

11+
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER
1112
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
1213

1314
// <memory>

libcxx/test/std/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// <memory>
1010

11+
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER
1112
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
1213

1314
// template <class T>

0 commit comments

Comments
 (0)