Adjust so that `make coverage` completes for coreutils.
There is no coverage for lib/parse-datetime.y
but everything else is fine.

* top/maint.mk (COVERAGE_CCOPTS): Since we're overriding CFLAGS,
add -Wno-error to relax warning requirements.  Projects usually default
to -O2, and changing from that can very well induce new warnings.
(build-coverage, gen-coverage): Keep going on non-fatal errors.
---
 ChangeLog    | 8 ++++++++
 top/maint.mk | 5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 013d9833c6..487dd00e78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-09-09  Pádraig Brady  <[email protected]>
+
+       maintainer-makefile: relax coverage requirements
+       * top/maint.mk (COVERAGE_CCOPTS): Since we're overriding CFLAGS,
+       add -Wno-error to relax warning requirements.  Projects usually default
+       to -O2, and changing from that can very well induce new warnings.
+       (build-coverage, gen-coverage): Keep going on non-fatal errors.
+
 2025-09-09  Paul Eggert  <[email protected]>
 
        gettext-h: support overriding "gnulib"
diff --git a/top/maint.mk b/top/maint.mk
index 1a6511b4f8..9a943eacab 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -1733,7 +1733,7 @@ init-coverage:
        $(MAKE) $(AM_MAKEFLAGS) clean
        lcov --directory . --zerocounters
 
-COVERAGE_CCOPTS ?= "-g --coverage"
+COVERAGE_CCOPTS ?= "-g --coverage -Wno-error"
 COVERAGE_OUT ?= doc/coverage
 
 build-coverage:
@@ -1741,12 +1741,13 @@ build-coverage:
        $(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) 
CXXFLAGS=$(COVERAGE_CCOPTS) check
        mkdir -p $(COVERAGE_OUT)
        lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \
-               --capture
+               --capture --ignore-errors negative,source
 
 gen-coverage:
        genhtml --output-directory $(COVERAGE_OUT) \
                $(COVERAGE_OUT)/$(PACKAGE).info \
                --frames --legend \
+               --ignore-errors source --synthesize-missing \
                --title "$(PACKAGE_NAME)"
 
 coverage:
-- 
2.50.1


Reply via email to