xo-alloc: nix-build + compiler nits

This commit is contained in:
Roland Conybeare 2026-02-26 12:20:34 +11:00
commit 51543ad3d3
5 changed files with 74 additions and 3 deletions

View file

@ -141,6 +141,7 @@ let
xo-arena = self.callPackage pkgs/xo-arena.nix { buildDocs = true; };
xo-facet = self.callPackage pkgs/xo-facet.nix {};
xo-allocutil = self.callPackage pkgs/xo-allocutil.nix {};
xo-alloc = self.callPackage pkgs/xo-alloc.nix {}; # buildDocs = true;
xo-refcnt = self.callPackage pkgs/xo-refcnt.nix {};
xo-ordinaltree = self.callPackage pkgs/xo-ordinaltree.nix {};
xo-flatstring = self.callPackage pkgs/xo-flatstring.nix { buildDocs = true; buildExamples = true; };
@ -479,13 +480,14 @@ in
pkgs = pkgs;
xo = {
cmake = pkgs.xo-cmake;
# facet = pkgs.xo-facet;
indentlog = pkgs.xo-indentlog;
refcnt = pkgs.xo-refcnt;
subsys = pkgs.xo-subsys;
randomgen = pkgs.xo-randomgen;
arena = pkgs.xo-arena;
facet = pkgs.xo-facet;
allocutil = pkgs.xo-allocutil;
alloc = pkgs.xo-alloc;
ordinaltree = pkgs.xo-ordinaltree;
flatstring = pkgs.xo-flatstring;
pyutil = pkgs.xo-pyutil;

64
pkgs/xo-alloc.nix Normal file
View file

@ -0,0 +1,64 @@
{
# nixpkgs dependencies
lib, stdenv, cmake, catch2,
doxygen,
python3Packages,
sphinx, graphviz,
# xo dependencies
xo-callback,
xo-unit,
xo-reflect,
# xo-randomgen,
xo-reflectutil,
xo-indentlog,
xo-allocutil,
xo-cmake,
buildDocs ? false,
doCheck ? true,
} :
stdenv.mkDerivation (finalattrs:
{
name = "xo-alloc";
src = ../xo-alloc;
cmakeFlags = ["-DCMAKE_MODULE_PATH=${xo-cmake}/share/cmake"]
++ lib.optionals buildDocs ["-DXO_ENABLE_DOCS=on"]
++ ["-DENABLE_TESTING=1"];
inherit buildDocs;
inherit doCheck;
postBuild = lib.optionalString buildDocs ''
cmake --build . -- docs
'';
nativeBuildInputs = [
cmake
catch2
xo-cmake
# xo-randomgen
] ++ lib.optionals buildDocs [
doxygen
sphinx
graphviz
python3Packages.sphinx-rtd-theme
python3Packages.breathe
python3Packages.sphinxcontrib-ditaa
python3Packages.sphinxcontrib-plantuml
python3Packages.pillow
];
propagatedBuildInputs = [
xo-callback
xo-unit
xo-reflect
xo-allocutil
xo-reflectutil
xo-indentlog
];
})

View file

@ -3,6 +3,7 @@
stdenv, cmake, catch2,
# xo dependencies
xo-allocutil,
xo-cmake,
# xo-randomgen,
# xo-reflectutil,

View file

@ -390,8 +390,10 @@ namespace xo {
/* word size for alignment */
constexpr uint32_t c_bpw = sizeof(std::uintptr_t);
(void)c_bpw;
std::uintptr_t free_u64 = reinterpret_cast<std::uintptr_t>(free_ptr_);
(void)free_u64;
assert(free_u64 % c_bpw == 0ul);

View file

@ -974,11 +974,13 @@ namespace xo {
from_entry.fixup_parent_child_moved(child_to);
#ifndef NDEBUG
{
// verify fixup was effective
IObject * child_from2 = from_entry.child();
assert(child_from2 == child_to);
}
#endif
// P->C', loc(C') in {N1', T'}