xo-alloc2: tidy for ++ utest coverage

This commit is contained in:
Roland Conybeare 2026-05-08 08:19:31 -04:00
commit 8e8b6041d6
5 changed files with 33 additions and 0 deletions

View file

@ -159,11 +159,13 @@ namespace xo {
* zero @p z.
**/
virtual value_type sub_alloc(Opaque d, size_type z, bool complete_flag) const = 0;
#ifdef OBSOLETE
/** Allocate copy of an existing object @p src.
* Existing object must be contained in @p d.
* NOTE: load bearing for copying garbage collector.
**/
virtual value_type alloc_copy(Opaque d, value_type src) const = 0;
#endif
/** reset allocator @p d to empty state. **/
virtual void clear(Opaque d) const = 0;
/** assign helper for allocator that may require a write barrier

View file

@ -58,7 +58,9 @@ namespace xo {
[[noreturn]] value_type alloc(Opaque, typeseq, std::size_t) const override { _fatal(); }
[[noreturn]] value_type super_alloc(Opaque, typeseq, std::size_t) const override { _fatal(); }
[[noreturn]] value_type sub_alloc(Opaque, std::size_t, bool) const override { _fatal(); }
#ifdef OBSOLETE
[[noreturn]] value_type alloc_copy(Opaque, value_type) const override { _fatal(); }
#endif
[[noreturn]] void clear(Opaque) const override { _fatal(); }
[[noreturn]] void barrier_assign_aux(Opaque,
void *,

View file

@ -75,8 +75,10 @@ namespace xo {
bool complete_flag) const override {
return I::sub_alloc(_dcast(d), z, complete_flag);
}
#ifdef OBSOLETE
value_type alloc_copy(Opaque d,
value_type src) const override { return I::alloc_copy(_dcast(d), src); }
#endif
void clear(Opaque d) const override { return I::clear(_dcast(d)); }
void barrier_assign_aux(Opaque d,
void * parent,

View file

@ -10,6 +10,7 @@ set(UTEST_SRCS
# Collector.test.cpp
# DX1CollectorIterator.test.cpp
Generation.test.cpp
VisitReason.test.cpp
dp.test.cpp
random_allocs.cpp
)

View file

@ -0,0 +1,26 @@
/** @file VisitReason.test.cpp
*
* @author Roland Conybeare, May 2026
**/
#include <xo/alloc2/VisitReason.hpp>
#include <catch2/catch.hpp>
namespace xo {
using xo::mm::VisitReason;
namespace ut {
TEST_CASE("visitreason-1", "[visitreason]")
{
REQUIRE(VisitReason::unspecified() == VisitReason::unspecified());
REQUIRE(VisitReason::unspecified() != VisitReason::forward());
REQUIRE(VisitReason::unspecified() != VisitReason::verify());
REQUIRE(VisitReason::forward() != VisitReason::verify());
}
} /*namespace ut*/
} /*namespace xo*/
/* end VisitReason.test.cpp */