Skip to content

[libc++] Update the status for lwg-3143 #116971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx23Issues.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"Issue #","Issue Name","Meeting","Status","First released version","Notes"
"`LWG2839 <https://wg21.link/LWG2839>`__","Self-move-assignment of library types, again","2020-11 (Virtual)","|Nothing To Do|","",""
"`LWG3117 <https://wg21.link/LWG3117>`__","Missing ``packaged_task`` deduction guides","2020-11 (Virtual)","|Complete|","16",""
"`LWG3143 <https://wg21.link/LWG3143>`__","``monotonic_buffer_resource`` growth policy is unclear","2020-11 (Virtual)","","",""
"`LWG3143 <https://wg21.link/LWG3143>`__","``monotonic_buffer_resource`` growth policy is unclear","2020-11 (Virtual)","|Complete|","16",""
"`LWG3195 <https://wg21.link/LWG3195>`__","What is the stored pointer value of an empty ``weak_ptr``?","2020-11 (Virtual)","|Nothing To Do|","",""
"`LWG3211 <https://wg21.link/LWG3211>`__","``std::tuple<>`` should be trivially constructible","2020-11 (Virtual)","|Complete|","9",""
"`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|","",""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,40 @@
#include "count_new.h"
#include "test_macros.h"

void test_geometric_progression() {
// LWG 3143: https://cplusplus.github.io/LWG/issue3143
void test_growth_capacity() {
// mem.res.monotonic.buffer 1.3
// Each additional buffer is larger than the previous one, following a
// geometric progression.
// Each additional buffer is larger than the previous one
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to still test that libc++ does geometric progression? Perhaps as a libc++ specific test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for review. Yes, and here i want to remove "geometric progression" related naming for not causing ambiguous as the lwg issue saied( when request allocation size larger than growth factor * previous allocation size). this test want to test when initial buffer size is specified the growth behaviour.

maybe i should remove the 3143 link here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this test is OK as it is now, but we're missing an additional test for the libc++ specific behavior with the geometric progression -- unless I misunderstood what this LWG issue is about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add more test to test the behavior

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gentle ping on this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sry, I was busy with my work these day. I will finish my job ASAP. thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, Could i also implement this task P0843R14. could you assign it to me? My job is related to this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, Could i also implement this task P0843R14. could you assign it to me? My job is related to this.

There's already a PR #105981 for this, although it seems stuck.


constexpr auto foot_size{4 * sizeof(void*)};

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

assert(globalMemCounter.checkNewCalledEq(0));
std::size_t next_buffer_size = 100;
void* ret = r1.allocate(10, 1);
void* ret = r1.allocate(10, 1);
assert(ret != nullptr);
assert(globalMemCounter.checkNewCalledEq(1));
assert(globalMemCounter.last_new_size >= next_buffer_size);
next_buffer_size = globalMemCounter.last_new_size + 1;
next_buffer_size = globalMemCounter.last_new_size;

int new_called = 1;
while (new_called < 5) {
ret = r1.allocate(10, 1);
if (globalMemCounter.new_called > new_called) {
assert(globalMemCounter.new_called == new_called + 1);
assert(globalMemCounter.last_new_size >= next_buffer_size);
next_buffer_size = globalMemCounter.last_new_size + 1;
next_buffer_size = next_buffer_size * 2 - foot_size;
assert(globalMemCounter.last_new_size == next_buffer_size);
new_called += 1;
}
}
}

int main(int, char**) {
#if TEST_SUPPORTS_LIBRARY_INTERNAL_ALLOCATIONS && !defined(DISABLE_NEW_COUNT)
test_geometric_progression();
test_growth_capacity();
#endif

return 0;
Expand Down
Loading