Files

1.8 KiB

P0 Compiler, Reflection, and Sanitizer Capability Probes

Task ID: X-BASE-04 Phase: P0 Status: APPROVED

1. Context and baseline

CMakeLists.txt defines ASan/UBSan/Coverage options without verifying compiler+linker support or mutual exclusion with TSan, and lacks feature probes for C++26 reflection (<meta>, ^^int) and std::expected.

2. Deliverables

  • cmake/Capabilities.cmake: check_cxx_source_compiles probes for VOID_HAS_CXX26_REFLECTION, VOID_HAS_STD_EXPECTED, and requested sanitizer options (VOID_ENABLE_ASAN, VOID_ENABLE_UBSAN, VOID_ENABLE_TSAN), plus void_report_capabilities().
  • Mutual-exclusion guard (ASAN + TSAN) and VOID_ENABLE_TSAN wiring in CMakeLists.txt and cmake/Module.cmake.

3. Exact files and interfaces

  • cmake/Capabilities.cmake
  • CMakeLists.txt
  • cmake/Module.cmake

4. Edge cases

  • Probes must respect existing -freflection flags on GNU >= 16.
  • Unsupported sanitizer flags fail configure cleanly with a clear diagnostic rather than silently skipping checks.

5. Acceptance criteria

  • Full Debug ASan+UBSan+-Werror build compiles cleanly and passes VoidTests with detect_leaks=1:halt_on_error=1.
  • TSan subset (Async;Time;Core;Functional;Testing) configures, compiles, and passes tests.

6. Verification commands

cmake -S . -B /tmp/void-p0-asan -G Ninja -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Debug \
  -DVOID_ENABLE_ASAN=ON -DVOID_ENABLE_UBSAN=ON -DVOID_WARNINGS_AS_ERRORS=ON -DVOID_ENABLE_TESTING=ON \
  -DFETCHCONTENT_FULLY_DISCONNECTED=ON -DFETCHCONTENT_SOURCE_DIR_BOOST=/home/faumaray/Projects/VoidLibrary/build/_deps/boost-src
cmake --build /tmp/void-p0-asan --parallel 4
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 /tmp/void-p0-asan/tests/VoidTests