From 6884292bca2e51858c049389cb150318b96892f4 Mon Sep 17 00:00:00 2001 From: Henry Cox Date: Thu, 22 May 2025 20:01:20 -0400 Subject: [PATCH 1/4] Bugfix: incorrect 'end line' calculation when deleted function found and end of file. See #408. Signed-off-by: Henry Cox --- bin/genhtml | 3 +++ example/methods/iterate.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/bin/genhtml b/bin/genhtml index 2aa17ad9..dd229d8a 100755 --- a/bin/genhtml +++ b/bin/genhtml @@ -5646,6 +5646,9 @@ sub _synthesize if ($lcovutil::func_coverage) { while (my ($fnName, $funcEntry) = each(%{$fileCovInfo->functionMap()})) { + my $tla = $funcEntry->hit()->[1]; + # deleted function doesn't count + next if grep(/^$tla$/, ('DUB', 'DCB')); my $line = $funcEntry->line(); my $end = $funcEntry->end_line(); $last_line = $line if $line > $last_line; diff --git a/example/methods/iterate.c b/example/methods/iterate.c index 03c33405..e98d8a6f 100644 --- a/example/methods/iterate.c +++ b/example/methods/iterate.c @@ -16,11 +16,14 @@ #include #include "iterate.h" +void test_data_logging(int, int); int iterate_get_sum (int min, int max) { int i, total; + test_data_logging(min, max); + total = 0; /* This is where we loop over each number in the range, including @@ -44,3 +47,11 @@ int iterate_get_sum (int min, int max) return total; } + +void +test_data_logging(int min, int max) +{ + (void)min; /* quiet compiler complaints */ + (void)max; + printf("this is some debug data logging code that gets removed in the final product\n"); +} From 87340e0462bd5e0902564d50c90fe96616d87ee5 Mon Sep 17 00:00:00 2001 From: Henry Cox Date: Thu, 22 May 2025 20:02:54 -0400 Subject: [PATCH 2/4] Bugfix: handle case that string 'user' is part of run directory full path. See #383. Signed-off-by: Henry Cox --- tests/lcov/extract/extract.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lcov/extract/extract.sh b/tests/lcov/extract/extract.sh index 810eb441..0f551184 100755 --- a/tests/lcov/extract/extract.sh +++ b/tests/lcov/extract/extract.sh @@ -226,7 +226,7 @@ if [ 0 != $? ] ; then exit 1 fi fi -grep user context.info +grep user: context.info if [ 0 == $? ] ; then echo "Error: did not expect to find context field in info" if [ $KEEP_GOING == 0 ] ; then From b1151d786ed58719266be4938d75e7f52e24c5ff Mon Sep 17 00:00:00 2001 From: Henry Cox Date: Thu, 22 May 2025 20:04:23 -0400 Subject: [PATCH 3/4] Bugfix: match full pathname element (partial match can break depending on 'readdir' order). Signed-off-by: Henry Cox --- tests/gendiffcov/insensitive/annotate.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/gendiffcov/insensitive/annotate.sh b/tests/gendiffcov/insensitive/annotate.sh index eaaf4a26..65503446 100755 --- a/tests/gendiffcov/insensitive/annotate.sh +++ b/tests/gendiffcov/insensitive/annotate.sh @@ -33,7 +33,7 @@ OUTER: while ($dir && if (opendir(my $d, $dir)) { foreach my $name (readdir($d)) { - if ($name =~ /$f/i) { + if ($name =~ /^$f$/i) { push(@stack, $name); last OUTER; } @@ -46,7 +46,7 @@ while (1 < scalar(@stack)) { my $f = pop(@stack); opendir(my $d, $path) or die("cannot read dir $path"); foreach my $name (readdir($d)) { - if ($name =~ /$f/i) { + if ($name =~ /^$f$/i) { $path = File::Spec->catdir($path, $name); last; } @@ -61,9 +61,9 @@ $f = pop(@stack) my $annotated = File::Spec->catfile($path, $f . ".annotated"); opendir my $d, $path or die("cannot read $path"); foreach my $name (readdir($d)) { - if ($name =~ /$f\.annotated/i) { + if ($name =~ /^$f\.annotated$/i) { $annotated = File::Spec->catfile($path, $name); - } elsif ($name =~ /$f/i) { # case insensitive match + } elsif ($name =~ /^$f$/i) { # case insensitive match $file = File::Spec->catfile($path, $name); } } From 753b46c15d15ff8c9f304b00e7b16e02c01f259c Mon Sep 17 00:00:00 2001 From: Henry Cox Date: Thu, 22 May 2025 20:05:21 -0400 Subject: [PATCH 4/4] Cleanup: 'checkstyle' wants different spacing. Sigh. Signed-off-by: Henry Cox --- bin/geninfo | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/geninfo b/bin/geninfo index 4361b7b5..bec7e001 100755 --- a/bin/geninfo +++ b/bin/geninfo @@ -1073,7 +1073,9 @@ sub _process_one_chunk($$$$) # "name" will be .gcno if "$initial" else will be $gcda my $name = defined($gcda_file) ? $gcda_file : $gcno_file; - info(1, "Processing $name%s\n", defined($pid) ? " in child $pid" : "" . "\n"); + info(1, + "Processing $name%s\n", + defined($pid) ? " in child $pid" : "" . "\n"); my $context = MessageContext->new("capturing from $name"); # multiple gcda files may refer to the same source - so generate the @@ -1516,8 +1518,8 @@ sub gen_info(@) $lcovutil::maxParallelism = 1; if ($chunk->[0]) { my $num = scalar(@{$chunk->[1]}); - lcovutil::info("Processing $num file" . - ($num == 1 ? '' : 's') . + lcovutil::info( + "Processing $num file" . ($num == 1 ? '' : 's') . " from chunk 0 serially\n"); } my $now = Time::HiRes::gettimeofday();