Tests that cannot be automatized should occasionally be run manually.
Unused code, in particular unused functions, can be detected with the tool xunused.
cd build
cmake .. -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
emacs compile_commands.json # remove generated/third-party entries if needed
xunused compile_commands.json 2>&1 >/dev/null | tee /io/unused.txt
Use judgement: not all currently unused functions must be removed.
cd debug
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug -DBA_TIDY=ON -DBA_PYTHON=OFF
ninja
Experimental (jul25)
cd debug
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBA_SANITIZE=ON
ninja
export ASAN_OPTIONS=detect_leaks=1:detect_stack_use_after_return=1:detect_container_overflow=1:malloc_context_size=20:check_initialization_order=1:symbolize=1
ctest --output-on-failure
Valgrind is incompatible with Address Sanitizer.
Compile with debug symbols, then
valgrind --leak-check=full --show-leak-kinds=definite,indirect \
--track-origins=yes --suppressions=/usr/libexec/valgrind/default.supp \
--error-limit=no ./bin/UnitTestBase