This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add version to intermediate gcov file (PR gcov-profile/83669).


This is small enhancement reported by users of gcov tool. I'm aware of current stage of GCC,
but it's really small change in code. Apart from that, a small fix to documentation is included.

Survives gcov.exp, may I install it?


2018-01-03  Martin Liska  <>

	PR gcov-profile/83669
	* gcov.c (output_intermediate_file): Add version to intermediate
	gcov file.
	* doc/gcov.texi: Document new field 'version' in intermediate
	file format. Fix location of '-k' option of gcov command.
 gcc/doc/gcov.texi | 10 ++++++----
 gcc/gcov.c        |  1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi
index 8bf422e58d8..be7364d9da9 100644
--- a/gcc/doc/gcov.texi
+++ b/gcc/doc/gcov.texi
@@ -187,11 +187,8 @@ be used by @command{lcov} or other tools. The output is a single
 The format of the intermediate @file{.gcov} file is plain text with
 one entry per line
-@item -j
-@itemx --human-readable
-Write counts in human readable format (like 24k).
 lcount:@var{line number},@var{execution_count},@var{has_unexecuted_block}
@@ -212,6 +209,7 @@ times.
 Here is a sample when @option{-i} is used in conjunction with @option{-b} option:
+version: 8.1.0 20180103
@@ -252,6 +250,10 @@ branch:35,nottaken
 @end smallexample
+@item -j
+@itemx --human-readable
+Write counts in human readable format (like 24k).
 @item -k
 @itemx --use-colors
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 24e6da09fcf..3c7881b13fa 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -1035,6 +1035,7 @@ file '' similar to the above example. */
 static void
 output_intermediate_file (FILE *gcov_file, source_info *src)
+  fprintf (gcov_file, "version:%s\n", version_string);
   fprintf (gcov_file, "file:%s\n", src->name);    /* source file name */
   std::sort (src->functions.begin (), src->functions.end (),

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]