[gcc(refs/users/giulianob/heads/autopar_rebase2)] gcov: print total_lines summary for all files.

Giuliano Belinassi giulianob@gcc.gnu.org
Mon Aug 17 21:58:30 GMT 2020


https://gcc.gnu.org/g:c04b554273ec8cdabfd92a044f02c80c2186d3f9

commit c04b554273ec8cdabfd92a044f02c80c2186d3f9
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Apr 17 17:19:12 2020 +0200

    gcov: print total_lines summary for all files.
    
    gcc/ChangeLog:
    
    2020-04-17  Martin Liska  <mliska@suse.cz>
    
            PR gcov-profile/94636
            * gcov.c (main): Print total lines summary at the end.
            (generate_results): Expect file_name always being non-null.
            Print newline after intermediate file is printed in order to align with
            what we do for normal files.

Diff:
---
 gcc/gcov.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/gcc/gcov.c b/gcc/gcov.c
index a291bac3e9e..488847231c2 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -874,6 +874,9 @@ main (int argc, char **argv)
 	}
     }
 
+  if (!flag_use_stdout)
+    executed_summary (total_lines, total_executed);
+
   return 0;
 }
 
@@ -1410,17 +1413,13 @@ generate_results (const char *file_name)
     }
 
   name_map needle;
-
-  if (file_name)
-    {
-      needle.name = file_name;
-      vector<name_map>::iterator it = std::find (names.begin (), names.end (),
-						 needle);
-      if (it != names.end ())
-	file_name = sources[it->src].coverage.name;
-      else
-	file_name = canonicalize_name (file_name);
-    }
+  needle.name = file_name;
+  vector<name_map>::iterator it
+    = std::find (names.begin (), names.end (), needle);
+  if (it != names.end ())
+    file_name = sources[it->src].coverage.name;
+  else
+    file_name = canonicalize_name (file_name);
 
   gcov_intermediate_filename = get_gcov_intermediate_filename (file_name);
 
@@ -1462,7 +1461,11 @@ generate_results (const char *file_name)
       if (flag_gcov_file)
 	{
 	  if (flag_json_format)
-	    output_json_intermediate_file (json_files, src);
+	    {
+	      output_json_intermediate_file (json_files, src);
+	      if (!flag_use_stdout)
+		fnotice (stdout, "\n");
+	    }
 	  else
 	    {
 	      if (flag_use_stdout)
@@ -1509,9 +1512,6 @@ generate_results (const char *file_name)
 	    }
 	}
     }
-
-  if (!file_name)
-    executed_summary (total_lines, total_executed);
 }
 
 /* Release all memory used.  */


More information about the Gcc-cvs mailing list