Sun Dec 12 10:53:37 2021 UTC ()
make: do not report '?' for fully covered header files


(rillig)
diff -r1.118 -r1.119 src/usr.bin/make/Makefile

cvs diff -r1.118 -r1.119 src/usr.bin/make/Makefile (expand / switch to unified diff)

--- src/usr.bin/make/Makefile 2021/12/12 10:33:03 1.118
+++ src/usr.bin/make/Makefile 2021/12/12 10:53:37 1.119
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.118 2021/12/12 10:33:03 rillig Exp $ 1# $NetBSD: Makefile,v 1.119 2021/12/12 10:53:37 rillig Exp $
2# @(#)Makefile 5.2 (Berkeley) 12/28/90 2# @(#)Makefile 5.2 (Berkeley) 12/28/90
3 3
4PROG= make 4PROG= make
5SRCS= arch.c 5SRCS= arch.c
6SRCS+= buf.c 6SRCS+= buf.c
7SRCS+= compat.c 7SRCS+= compat.c
8SRCS+= cond.c 8SRCS+= cond.c
9SRCS+= dir.c 9SRCS+= dir.c
10SRCS+= for.c 10SRCS+= for.c
11SRCS+= hash.c 11SRCS+= hash.c
12SRCS+= job.c 12SRCS+= job.c
13SRCS+= lst.c 13SRCS+= lst.c
14SRCS+= main.c 14SRCS+= main.c
@@ -24,28 +24,29 @@ SRCS+= var.c @@ -24,28 +24,29 @@ SRCS+= var.c
24SRCS+= util.c 24SRCS+= util.c
25 25
26# Whether to generate a coverage report after running the tests. 26# Whether to generate a coverage report after running the tests.
27USE_COVERAGE?= no # works only with gcc; clang9 fails to link 27USE_COVERAGE?= no # works only with gcc; clang9 fails to link
28.if ${USE_COVERAGE} == "yes" 28.if ${USE_COVERAGE} == "yes"
29GCOV?= gcov 29GCOV?= gcov
30COPTS+= --coverage -O0 -ggdb 30COPTS+= --coverage -O0 -ggdb
31GCOV_PERL= if (/^File '(?:.*\/)?(\S+)'/) { 31GCOV_PERL= if (/^File '(?:.*\/)?(\S+)'/) {
32GCOV_PERL+= $$file = $$1; $$func = ""; 32GCOV_PERL+= $$file = $$1; $$func = "";
33GCOV_PERL+= } elsif (/^Function '(\S+)'/) { 33GCOV_PERL+= } elsif (/^Function '(\S+)'/) {
34GCOV_PERL+= $$func = $$1; 34GCOV_PERL+= $$func = $$1;
35GCOV_PERL+= } elsif (/^Lines executed:(\d+\.\d+)% of (\d+)/ && defined($$file)) { 35GCOV_PERL+= } elsif (/^Lines executed:(\d+\.\d+)% of (\d+)/ && defined($$file)) {
36GCOV_PERL+= my ($$percent, $$lines) = ($$1, $$2); 36GCOV_PERL+= my ($$percent, $$lines) = ($$1, $$2);
37GCOV_PERL+= my $$uncovered = $$file =~ /\.h$$/ 37GCOV_PERL+= my $$uncovered =
38GCOV_PERL+= ? '?' 38GCOV_PERL+= $$percent eq '100.00' ? '0'
 39GCOV_PERL+= : $$file =~ /\.h$$/ ? '?'
39GCOV_PERL+= : `grep -c '\#\#\#\#\#:' < \$$(basename $$file.gcov)`; 40GCOV_PERL+= : `grep -c '\#\#\#\#\#:' < \$$(basename $$file.gcov)`;
40GCOV_PERL+= chomp($$uncovered); 41GCOV_PERL+= chomp($$uncovered);
41GCOV_PERL+= printf("%7.2f %4s/%4d %s%s\n", 42GCOV_PERL+= printf("%7.2f %4s/%4d %s%s\n",
42GCOV_PERL+= $$percent, $$uncovered, $$lines, $$file, $$func); 43GCOV_PERL+= $$percent, $$uncovered, $$lines, $$file, $$func);
43GCOV_PERL+= $$file = undef; 44GCOV_PERL+= $$file = undef;
44GCOV_PERL+= } 45GCOV_PERL+= }
45LDADD+= --coverage 46LDADD+= --coverage
46.endif 47.endif
47CLEANFILES+= *.gcda *.gcno *.gcov 48CLEANFILES+= *.gcda *.gcno *.gcov
48 49
49# Whether to compile using the Undefined Behavior Sanitizer (GCC, Clang). 50# Whether to compile using the Undefined Behavior Sanitizer (GCC, Clang).
50USE_UBSAN?= no 51USE_UBSAN?= no
51.if ${USE_UBSAN} == "yes" 52.if ${USE_UBSAN} == "yes"