public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: Richard Biener <richard.guenther@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] gcov: add info about "calls" to JSON output format
Date: Thu, 4 May 2023 10:32:01 +0200	[thread overview]
Message-ID: <3818e146-c74b-e9ac-6e07-3bbf553623c5@suse.cz> (raw)
In-Reply-To: <f055fae0-c048-307d-d22b-13f56be3834e@suse.cz>

[-- Attachment #1: Type: text/plain, Size: 204 bytes --]

Hello.

After discussion with the consumers of the format:
https://github.com/gcovr/gcovr/issues/282#issuecomment-1534239536

I'm going to push a patch that prints JSON version in gcov -v.

Thanks,
Martin

[-- Attachment #2: 0001-gcov-add-GCOV-format-version-to-gcov-v.patch --]
[-- Type: text/x-patch, Size: 1567 bytes --]

From d879d68eb309561d266ddf734ab8c69f4fef3874 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 4 May 2023 10:27:55 +0200
Subject: [PATCH] gcov: add GCOV format version to gcov -v

gcc/ChangeLog:

	* gcov.cc (GCOV_JSON_FORMAT_VERSION): New definition.
	(print_version): Use it.
	(generate_results): Likewise.
---
 gcc/gcov.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/gcov.cc b/gcc/gcov.cc
index d96b4f77e3b..2fad6aa7ede 100644
--- a/gcc/gcov.cc
+++ b/gcc/gcov.cc
@@ -58,6 +58,8 @@ using namespace std;
 #include "gcov-io.h"
 #include "gcov-io.cc"
 
+#define GCOV_JSON_FORMAT_VERSION "2"
+
 /* The gcno file is generated by -ftest-coverage option. The gcda file is
    generated by a program compiled with -fprofile-arcs. Their formats
    are documented in gcov-io.h.  */
@@ -964,6 +966,7 @@ static void
 print_version (void)
 {
   fnotice (stdout, "gcov %s%s\n", pkgversion_string, version_string);
+  fnotice (stdout, "JSON format version: %s\n", GCOV_JSON_FORMAT_VERSION);
   fprintf (stdout, "Copyright %s 2023 Free Software Foundation, Inc.\n",
 	   _("(C)"));
   fnotice (stdout,
@@ -1546,7 +1549,7 @@ generate_results (const char *file_name)
   gcov_intermediate_filename = get_gcov_intermediate_filename (file_name);
 
   json::object *root = new json::object ();
-  root->set ("format_version", new json::string ("2"));
+  root->set ("format_version", new json::string (GCOV_JSON_FORMAT_VERSION));
   root->set ("gcc_version", new json::string (version_string));
 
   if (bbg_cwd != NULL)
-- 
2.40.1


      reply	other threads:[~2023-05-04  8:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 13:58 Martin Liška
2023-04-11  9:23 ` Richard Biener
2023-04-12  7:20   ` Martin Liška
2023-04-14 12:34     ` Jan Hubicka
2023-04-25 11:05       ` Martin Liška
2023-05-04  8:32         ` Martin Liška [this message]

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=3818e146-c74b-e9ac-6e07-3bbf553623c5@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=richard.guenther@gmail.com \
    /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).