From fefb15fbadbb4ea3a927c88bff5568c8251001ff Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 16:54:46 -0400 Subject: [PATCH] refactor: void return type for Collector.forward_children() --- idl/Collector.json5 | 2 +- idl/GCObject.json5 | 2 +- include/xo/alloc2/gc/AGCObject.hpp | 2 +- include/xo/alloc2/gc/IGCObject_Any.hpp | 2 +- include/xo/alloc2/gc/IGCObject_Xfer.hpp | 2 +- include/xo/alloc2/gc/RCollector.hpp | 12 ++++++------ include/xo/alloc2/gc/RGCObject.hpp | 2 +- src/alloc2/IGCObject_Any.cpp | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/idl/Collector.json5 b/idl/Collector.json5 index 6f42b854..9c4666eb 100644 --- a/idl/Collector.json5 +++ b/idl/Collector.json5 @@ -312,7 +312,7 @@ "", "/** convenience template for move-constructible T (this is common) **/", "template ", - "T * std_copy_for(const T * src) noexcept {", + "T * std_move_for(T * src) noexcept {", " void * mem = this->alloc_copy_for(src);", " if (mem) {", " return new (mem) T(std::move(*src));", diff --git a/idl/GCObject.json5 b/idl/GCObject.json5 index 0b4dfdf9..13f97710 100644 --- a/idl/GCObject.json5 +++ b/idl/GCObject.json5 @@ -72,7 +72,7 @@ { name: "forward_children", doc: ["during GC: forward immdiate children"], - return_type: "size_type", + return_type: "void", args: [ {type: "obj", name: "gc"}, ], diff --git a/include/xo/alloc2/gc/AGCObject.hpp b/include/xo/alloc2/gc/AGCObject.hpp index 44c777e9..463b3300 100644 --- a/include/xo/alloc2/gc/AGCObject.hpp +++ b/include/xo/alloc2/gc/AGCObject.hpp @@ -69,7 +69,7 @@ public: /** move instance using allocator **/ virtual Opaque shallow_move(Opaque data, obj gc) const noexcept = 0; /** during GC: forward immdiate children **/ - virtual size_type forward_children(Opaque data, obj gc) const noexcept = 0; + virtual void forward_children(Opaque data, obj gc) const noexcept = 0; ///@} }; /*AGCObject*/ diff --git a/include/xo/alloc2/gc/IGCObject_Any.hpp b/include/xo/alloc2/gc/IGCObject_Any.hpp index 25ff5db3..e3ebe179 100644 --- a/include/xo/alloc2/gc/IGCObject_Any.hpp +++ b/include/xo/alloc2/gc/IGCObject_Any.hpp @@ -65,7 +65,7 @@ namespace mm { // nonconst methods [[noreturn]] Opaque shallow_move(Opaque, obj) const noexcept override; - [[noreturn]] size_type forward_children(Opaque, obj) const noexcept override; + [[noreturn]] void forward_children(Opaque, obj) const noexcept override; ///@} diff --git a/include/xo/alloc2/gc/IGCObject_Xfer.hpp b/include/xo/alloc2/gc/IGCObject_Xfer.hpp index b311e6f3..3b786fb0 100644 --- a/include/xo/alloc2/gc/IGCObject_Xfer.hpp +++ b/include/xo/alloc2/gc/IGCObject_Xfer.hpp @@ -57,7 +57,7 @@ namespace mm { Opaque shallow_move(Opaque data, obj gc) const noexcept override { return I::shallow_move(_dcast(data), gc); } - size_type forward_children(Opaque data, obj gc) const noexcept override { + void forward_children(Opaque data, obj gc) const noexcept override { return I::forward_children(_dcast(data), gc); } diff --git a/include/xo/alloc2/gc/RCollector.hpp b/include/xo/alloc2/gc/RCollector.hpp index 3189a0f0..efcbfc58 100644 --- a/include/xo/alloc2/gc/RCollector.hpp +++ b/include/xo/alloc2/gc/RCollector.hpp @@ -52,7 +52,7 @@ public: void * alloc_copy_for(const T * src) noexcept { return O::iface()->alloc_copy(O::data(), (std::byte *)const_cast(src)); } - + /** convenience template for move-constructible T (this is common) **/ template T * std_move_for(T * src) noexcept { @@ -62,28 +62,28 @@ public: } return nullptr; } - + /** forward faceted object pointer in place. Defined in GCObject.hpp to avoid #include cycle **/ template void forward_inplace(obj * p_obj); - + /** another convenience template for forwarding. * Defined in RGCObject.hpp to avoid #include cycle. **/ template void forward_inplace(DRepr ** pp_repr); - + /** convenience template where pointer requires pivot **/ template requires (!std::is_same_v) void forward_pivot_inplace(obj * p_obj); - + /** add root @p p_root **/ template void add_gc_root(obj * p_root) { O::iface()->add_gc_root_poly(O::data(), (obj *)p_root); } - + /** remove root @p p_root **/ template void remove_gc_root(obj * p_root) { diff --git a/include/xo/alloc2/gc/RGCObject.hpp b/include/xo/alloc2/gc/RGCObject.hpp index 673e6e03..f9927282 100644 --- a/include/xo/alloc2/gc/RGCObject.hpp +++ b/include/xo/alloc2/gc/RGCObject.hpp @@ -63,7 +63,7 @@ public: Opaque shallow_move(obj gc) noexcept { return O::iface()->shallow_move(O::data(), gc); } - size_type forward_children(obj gc) noexcept { + void forward_children(obj gc) noexcept { return O::iface()->forward_children(O::data(), gc); } diff --git a/src/alloc2/IGCObject_Any.cpp b/src/alloc2/IGCObject_Any.cpp index a22df0f5..a4415241 100644 --- a/src/alloc2/IGCObject_Any.cpp +++ b/src/alloc2/IGCObject_Any.cpp @@ -42,7 +42,7 @@ IGCObject_Any::shallow_move(Opaque, obj) const noexcept -> Opaque } auto -IGCObject_Any::forward_children(Opaque, obj) const noexcept -> size_type +IGCObject_Any::forward_children(Opaque, obj) const noexcept -> void { _fatal(); }