GCOV: do not support unexecuted blocks in Ada
authorMartin Liska <mliska@suse.cz>
Fri, 10 Nov 2017 14:40:17 +0000 (15:40 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 10 Nov 2017 14:40:17 +0000 (14:40 +0000)
2017-11-10  Martin Liska  <mliska@suse.cz>

* coverage.c (coverage_init): Stream information about
support of has_unexecuted_blocks.
* doc/gcov.texi: Document that.
* gcov-dump.c (dump_gcov_file): Support it in gcov_dump tool.
* gcov.c (read_graph_file): Likewise.
(output_line_beginning): Fix a small issue with
color output.

From-SVN: r254627

gcc/ChangeLog
gcc/coverage.c
gcc/doc/gcov.texi
gcc/gcov-dump.c
gcc/gcov.c

index 1ed540a29e3ee0144644ac0aa1d6e0588ce7376a..de86f33961bec514867bf2fa6be7ee03e0f32072 100644 (file)
@@ -1,3 +1,13 @@
+2017-11-10  Martin Liska  <mliska@suse.cz>
+
+       * coverage.c (coverage_init): Stream information about
+       support of has_unexecuted_blocks.
+       * doc/gcov.texi: Document that.
+       * gcov-dump.c (dump_gcov_file): Support it in gcov_dump tool.
+       * gcov.c (read_graph_file): Likewise.
+       (output_line_beginning): Fix a small issue with
+       color output.
+
 2017-11-10  Bin Cheng  <bin.cheng@arm.com>
 
        * tree-predcom.c (determine_roots_comp): Avoid memory leak by freeing
index f57897b83143be3d0355cc8cfb8d756b65988340..ea05d94f441f12d1226a5ad997f7af5e1f3b41fc 100644 (file)
@@ -1269,6 +1269,9 @@ coverage_init (const char *filename)
          gcov_write_unsigned (GCOV_NOTE_MAGIC);
          gcov_write_unsigned (GCOV_VERSION);
          gcov_write_unsigned (bbg_file_stamp);
+
+         /* Do not support has_unexecuted_blocks for Ada.  */
+         gcov_write_unsigned (strcmp (lang_hooks.name, "GNU Ada") != 0);
        }
     }
 
index 6f6a92c131a91f168b3a56752ecb5a467aaea94f..8bf422e58d8c845b2f4184d066d6ee47aef2ec85 100644 (file)
@@ -374,7 +374,7 @@ marked @samp{$$$$$} or @samp{%%%%%}, depending on whether a basic block
 is reachable via non-exceptional or exceptional paths.
 Executed basic blocks having a statement with zero @var{execution_count}
 end with @samp{*} character and are colored with magenta color with @option{-k}
-option.
+option.  The functionality is not supported in Ada.
 
 Note that GCC can completely remove the bodies of functions that are
 not needed -- for instance if they are inlined everywhere.  Such functions
index c4e05cd47954617668e5d95d06b9252fce5147fe..e5e649cb18f1716e0ac027a7b7f98e1cc5de4eb4 100644 (file)
@@ -217,6 +217,11 @@ dump_gcov_file (const char *filename)
     printf ("%s:stamp %lu\n", filename, (unsigned long)stamp);
   }
 
+  /* Support for unexecuted basic blocks.  */
+  unsigned support_unexecuted_blocks = gcov_read_unsigned ();
+  if (!support_unexecuted_blocks)
+    printf ("%s: has_unexecuted_block is not supported\n", filename);
+
   while (1)
     {
       gcov_position_t base, position = gcov_position ();
index 846a232619647defb78bde94e2ce546e47f0d474..7152372ef31d745450ea13d32d9f3394775f7354 100644 (file)
@@ -424,6 +424,9 @@ static char *bbg_file_name;
 /* Stamp of the bbg file */
 static unsigned bbg_stamp;
 
+/* Supports has_unexecuted_blocks functionality.  */
+static unsigned bbg_supports_has_unexecuted_blocks;
+
 /* Name and file pointer of the input file for the count data (gcda).  */
 
 static char *da_file_name;
@@ -1492,6 +1495,7 @@ read_graph_file (void)
               bbg_file_name, v, e);
     }
   bbg_stamp = gcov_read_unsigned ();
+  bbg_supports_has_unexecuted_blocks = gcov_read_unsigned ();
 
   while ((tag = gcov_read_unsigned ()))
     {
@@ -2732,7 +2736,8 @@ output_line_beginning (FILE *f, bool exists, bool unexceptional,
       if (count > 0)
        {
          s = format_gcov (count, 0, -1);
-         if (has_unexecuted_block)
+         if (has_unexecuted_block
+             && bbg_supports_has_unexecuted_blocks)
            {
              if (flag_use_colors)
                {