[libcxx-commits] [PATCH] D141004: [libc++][test] Port memory_resource tests to MSVCSTL

Casey Carter via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 4 11:11:05 PST 2023


CaseyCarter created this revision.
CaseyCarter added a reviewer: arthur.j.odwyer.
CaseyCarter added a project: libc++.
Herald added a project: All.
CaseyCarter requested review of this revision.
Herald added a reviewer: libc++.

- Use `new  char[n]` instead of `malloc(n)` to avoid warnings about dereferencing potentially null pointers.
- Initialization of `polymorphic_allocator` from `nullptr` violates a precondition; test only with libc++.
- MSVCSTL doesn't implement LWG-3120 (cursed ABI); deal with buggy `monotonic_buffer_resource::reset` behavior.
- Don't expect to portably be able to allocate 0 bytes from a potentially-exhausted block in `monotonic_buffer_resource`. Zero-byte allocations may still consume block space to provide that guarantee that a return value cannot repeat absent deallocation/reset.
- MSVCSTL's pool resources use a vector internally, so they perform an additional allocation when iterator debugging. This requires adjustment to the expected number of allocations for some tests, and completely disabling the case that sets the default resource to `null_memory_resource`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141004

Files:
  libcxx/test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_pair_values.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/resource.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/select_on_container_copy_construction.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_from_underaligned_buffer.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_with_initial_size.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.ctor/ctor_does_not_allocate.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.ctor/sync_with_default_resource.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.ctor/unsync_with_default_resource.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate_overaligned_request.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_deallocate_matches_allocate.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate_overaligned_request.pass.cpp
  libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_deallocate_matches_allocate.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141004.486346.patch
Type: text/x-patch
Size: 18388 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230104/8b1c01b9/attachment-0001.bin>


More information about the libcxx-commits mailing list