public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Cc: "Jørgen Kvalsvik" <j@lambda.is>, "GCC Development" <gcc@gcc.gnu.org>
Subject: [PATCH] gcov: fix file and function summary information
Date: Mon, 22 Aug 2022 21:25:58 +0200	[thread overview]
Message-ID: <643928f9-d0e0-e099-6846-d3548f14b455@suse.cz> (raw)
In-Reply-To: <3c93e70d-293e-2190-125b-f840c31d2087@lambda.is>

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Jorgen: Can you please test it before I'll install it?

Thanks,
Martin

gcc/ChangeLog:

	* gcov.cc (add_line_counts): Add group functions to coverage
	summary.
	(accumulate_line_counts): Similarly for files.

Co-Authored-By: Jørgen Kvalsvik <j@lambda.is>
---
 gcc/gcov.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/gcov.cc b/gcc/gcov.cc
index 27be5ff0911..9cf1071166f 100644
--- a/gcc/gcov.cc
+++ b/gcc/gcov.cc
@@ -2694,6 +2694,13 @@ add_line_counts (coverage_info *coverage, function_info *fn)
 		{
 		  gcc_assert (lines[j] - fn->start_line < fn->lines.size ());
 		  line = &(fn->lines[lines[j] - fn->start_line]);
+		  if (coverage)
+		    {
+		      if (!line->exists)
+			coverage->lines++;
+		      if (!line->count && block->count)
+			coverage->lines_executed++;
+		    }
 		  line->exists = 1;
 		  if (!block->exceptional)
 		    {
@@ -2815,7 +2822,7 @@ accumulate_line_counts (source_info *src)
 	   it2 != fn->lines.end (); it2++)
 	  {
 	    line_info *line = &(*it2);
-	    accumulate_line_info (line, src, false);
+	    accumulate_line_info (line, src, true);
 	  }
     }
 
-- 
2.37.2


       reply	other threads:[~2022-08-22 19:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3c93e70d-293e-2190-125b-f840c31d2087@lambda.is>
2022-08-22 19:25 ` Martin Liška [this message]
2022-08-24  7:12   ` Jørgen Kvalsvik
2022-08-24  7:31     ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=643928f9-d0e0-e099-6846-d3548f14b455@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=j@lambda.is \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).