Skip to content

Commit 90e2125

Browse files
committed
[libc++] Update the status for lwg-3143
Current implementation use the larger one either requested bytes or growth factor multiply previous buffer size. This patch update the lwg 3143 issue latest status.
1 parent c727b48 commit 90e2125

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

libcxx/docs/Status/Cxx23Issues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"Issue #","Issue Name","Meeting","Status","First released version","Notes"
22
"`LWG2839 <https://wg21.link/LWG2839>`__","Self-move-assignment of library types, again","2020-11 (Virtual)","|Nothing To Do|","",""
33
"`LWG3117 <https://wg21.link/LWG3117>`__","Missing ``packaged_task`` deduction guides","2020-11 (Virtual)","|Complete|","16",""
4-
"`LWG3143 <https://wg21.link/LWG3143>`__","``monotonic_buffer_resource`` growth policy is unclear","2020-11 (Virtual)","","",""
4+
"`LWG3143 <https://wg21.link/LWG3143>`__","``monotonic_buffer_resource`` growth policy is unclear","2020-11 (Virtual)","|Complete|","16",""
55
"`LWG3195 <https://wg21.link/LWG3195>`__","What is the stored pointer value of an empty ``weak_ptr``?","2020-11 (Virtual)","|Nothing To Do|","",""
66
"`LWG3211 <https://wg21.link/LWG3211>`__","``std::tuple<>`` should be trivially constructible","2020-11 (Virtual)","|Complete|","9",""
77
"`LWG3236 <https://wg21.link/LWG3236>`__","Random access iterator requirements lack limiting relational operators domain to comparing those from the same range","2020-11 (Virtual)","|Nothing To Do|","",""
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,40 @@
2020
#include "count_new.h"
2121
#include "test_macros.h"
2222

23-
void test_geometric_progression() {
23+
// LWG 3143: https://cplusplus.github.io/LWG/issue3143
24+
void test_growth_capacity() {
2425
// mem.res.monotonic.buffer 1.3
25-
// Each additional buffer is larger than the previous one, following a
26-
// geometric progression.
26+
// Each additional buffer is larger than the previous one
27+
28+
constexpr auto foot_size{4 * sizeof(void*)};
2729

2830
globalMemCounter.reset();
2931
std::pmr::monotonic_buffer_resource mono1(100, std::pmr::new_delete_resource());
3032
std::pmr::memory_resource& r1 = mono1;
3133

3234
assert(globalMemCounter.checkNewCalledEq(0));
3335
std::size_t next_buffer_size = 100;
34-
void* ret = r1.allocate(10, 1);
36+
void* ret = r1.allocate(10, 1);
3537
assert(ret != nullptr);
3638
assert(globalMemCounter.checkNewCalledEq(1));
3739
assert(globalMemCounter.last_new_size >= next_buffer_size);
38-
next_buffer_size = globalMemCounter.last_new_size + 1;
40+
next_buffer_size = globalMemCounter.last_new_size;
3941

4042
int new_called = 1;
4143
while (new_called < 5) {
4244
ret = r1.allocate(10, 1);
4345
if (globalMemCounter.new_called > new_called) {
4446
assert(globalMemCounter.new_called == new_called + 1);
45-
assert(globalMemCounter.last_new_size >= next_buffer_size);
46-
next_buffer_size = globalMemCounter.last_new_size + 1;
47+
next_buffer_size = next_buffer_size * 2 - foot_size;
48+
assert(globalMemCounter.last_new_size == next_buffer_size);
4749
new_called += 1;
4850
}
4951
}
5052
}
5153

5254
int main(int, char**) {
5355
#if TEST_SUPPORTS_LIBRARY_INTERNAL_ALLOCATIONS && !defined(DISABLE_NEW_COUNT)
54-
test_geometric_progression();
56+
test_growth_capacity();
5557
#endif
5658

5759
return 0;

0 commit comments

Comments
 (0)