cmake: apply -Werror to generated test TUs and fix exposed warnings (X-QA-01)

This commit is contained in:
faumaray committed 2026-12-03 16:57:22 +03:00
1 parent 65185f251c
commit 77a2bce73f
3 files changed
+16 -1

No files matched your search

+3 -1
View File
@@ -253,7 +253,9 @@ namespace Void::Meta
out += "?";
}
out += '{';
bool first = true;
// Reflectable types with no members (e.g. std::optional) leave this
// unread; the diagnostic is about a deliberately empty loop body.
[[maybe_unused]] bool first = true;
template for (constexpr auto m : members_v<T>)
{
if (!first) {
+12
View File
@@ -114,6 +114,18 @@ endforeach()
if(_all_generated)
add_executable(VoidTests ${_all_generated})
# The generated test translation units belong to VoidTests, not to a module
# target, so the warnings-as-errors policy from void_add_module does not
# reach them unless it is applied here explicitly (X-QA-01).
if(VOID_WARNINGS_AS_ERRORS)
target_compile_options(VoidTests PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wall;-Wextra;-Wpedantic;-Werror;-Wno-missing-field-initializers>>"
# Test helpers live in anonymous namespaces and are captured by
# coroutine frames; GCC's subobject-linkage diagnostic is noise for
# that pattern, not a defect in the test code.
"$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-Wno-subobject-linkage>>")
endif()
# Disable auto-sweep: we already applied the scanner manually above.
set_target_properties(VoidTests PROPERTIES VOID_TESTING_NO_AUTO_SCAN TRUE)
+1
View File
@@ -35,6 +35,7 @@ Void::Testing::Test bench_run_total_positive()
const auto r = run("work", 100, [] {
volatile int x = 0;
for (int i = 0; i < 100; ++i) x += i;
do_not_optimize(x);
}, 0);
Void::Testing::expect(r.total.count() >= 0);
}