The stl_tree_node, list_node and unordered_node class templates only mimic the layout of the standard library's container nodes, so that sizeof yields an estimate of the memory they use. Their fields are never accessed.
Since llvm/llvm-project#237374, Clang 24 diagnoses these fields with -Wunused-private-field:
$ cmake --build build
[308/655] Building CXX object src/util/CMakeFiles/bitcoin_util.dir/__/logging.cpp.o
In file included from ../src/logging.cpp:7:
../src/memusage.h:169:11: warning: private field 'ptr_next' is not used [-Wunused-private-field]
169 | void* ptr_next;
| ^
../src/memusage.h:170:11: warning: private field 'ptr_prev' is not used [-Wunused-private-field]
170 | void* ptr_prev;
| ^
2 warnings generated.
[355/655] Building CXX object src/CMakeFiles/bitcoin_node.dir/kernel/disconnected_transactions.cpp.o
In file included from ../src/kernel/disconnected_transactions.cpp:8:
In file included from ../src/core_memusage.h:10:
../src/memusage.h:184:11: warning: private field 'ptr' is not used [-Wunused-private-field]
184 | void* ptr;
| ^
../src/memusage.h:169:11: warning: private field 'ptr_next' is not used [-Wunused-private-field]
169 | void* ptr_next;
| ^
../src/memusage.h:170:11: warning: private field 'ptr_prev' is not used [-Wunused-private-field]
170 | void* ptr_prev;
| ^
3 warnings generated.
[424/655] Building CXX object src/CMakeFiles/bitcoin_node.dir/txgraph.cpp.o
In file included from ../src/txgraph.cpp:7:
In file included from ../src/cluster_linearize.h:17:
../src/memusage.h:72:9: warning: private field 'color' is not used [-Wunused-private-field]
72 | int color;
| ^
../src/memusage.h:73:11: warning: private field 'parent' is not used [-Wunused-private-field]
73 | void* parent;
| ^
../src/memusage.h:74:11: warning: private field 'left' is not used [-Wunused-private-field]
74 | void* left;
| ^
../src/memusage.h:75:11: warning: private field 'right' is not used [-Wunused-private-field]
75 | void* right;
| ^
4 warnings generated.
[425/655] Building CXX object src/CMakeFiles/bitcoin_node.dir/txmempool.cpp.o
In file included from ../src/txmempool.cpp:6:
In file included from ../src/txmempool.h:9:
In file included from ../src/coins.h:11:
In file included from ../src/core_memusage.h:10:
../src/memusage.h:72:9: warning: private field 'color' is not used [-Wunused-private-field]
72 | int color;
| ^
../src/memusage.h:73:11: warning: private field 'parent' is not used [-Wunused-private-field]
73 | void* parent;
| ^
../src/memusage.h:74:11: warning: private field 'left' is not used [-Wunused-private-field]
74 | void* left;
| ^
../src/memusage.h:75:11: warning: private field 'right' is not used [-Wunused-private-field]
75 | void* right;
| ^
../src/memusage.h:72:9: warning: private field 'color' is not used [-Wunused-private-field]
72 | int color;
| ^
../src/memusage.h:73:11: warning: private field 'parent' is not used [-Wunused-private-field]
73 | void* parent;
| ^
../src/memusage.h:74:11: warning: private field 'left' is not used [-Wunused-private-field]
74 | void* left;
| ^
../src/memusage.h:75:11: warning: private field 'right' is not used [-Wunused-private-field]
75 | void* right;
| ^
../src/memusage.h:72:9: warning: private field 'color' is not used [-Wunused-private-field]
72 | int color;
| ^
../src/memusage.h:73:11: warning: private field 'parent' is not used [-Wunused-private-field]
73 | void* parent;
| ^
../src/memusage.h:74:11: warning: private field 'left' is not used [-Wunused-private-field]
74 | void* left;
| ^
../src/memusage.h:75:11: warning: private field 'right' is not used [-Wunused-private-field]
75 | void* right;
| ^
12 warnings generated.
[535/655] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/disconnected_transactions.cpp.o
In file included from ../src/test/disconnected_transactions.cpp:6:
In file included from ../src/core_memusage.h:10:
../src/memusage.h:184:11: warning: private field 'ptr' is not used [-Wunused-private-field]
184 | void* ptr;
| ^
1 warning generated.
[566/655] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/pool_tests.cpp.o
In file included from ../src/test/pool_tests.cpp:5:
../src/memusage.h:184:11: warning: private field 'ptr' is not used [-Wunused-private-field]
184 | void* ptr;
| ^
1 warning generated.
[655/655] Linking CXX executable bin/test_bitcoin
This PR drops the private: access specifiers. It does not affect the size or alignment of the structs, as all their fields keep the same access control, and it is consistent with stl_shared_counter.