From 57040691f63c08fa2a907e76624b65dcaf27b930 Mon Sep 17 00:00:00 2001 From: Zxilly Date: Sun, 27 Sep 2026 11:51:45 +0800 Subject: [PATCH] fix(coverage): use atomic counters for worker threads --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c6678ad..be7ce84d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,7 +124,9 @@ add_compile_options(-fno-omit-frame-pointer -fno-strict-aliasing) # Coverage configuration if (UA2F_ENABLE_COVERAGE) if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") - add_compile_options(--coverage -O0 -g -fno-lto) + # Proxy and NFQUEUE workers share coverage counters. Non-atomic updates + # can lose increments and make gcov reconstruct negative branch counts. + add_compile_options(--coverage -fprofile-update=atomic -O0 -g -fno-lto) add_link_options(--coverage -fno-lto) message(STATUS "Code coverage is enabled.") else()