summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-30 18:22:16 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-30 18:22:16 +0000
commitf938168e5ef1866e292d0daa68617a699bc2e009 (patch)
treeb11bd63164779cb7109aa20e284752f589cab45c /gcc
parent6071b85b2e8962bbb12dc6cad177c19a440e84d8 (diff)
downloadgcc-f938168e5ef1866e292d0daa68617a699bc2e009.tar.gz
* gcov.c (total_lines, total_executed): New global vars.
(generate_results): Call executed_summary. (executed_summary): New function, broken out of ... (function_summary): ... here. Call it. * coverage.c (coverage_finish): Also check for local_tick == -1. * gcov-dump (tag_function): Correct labelling typo. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182744 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/coverage.c2
-rw-r--r--gcc/gcov-dump.c2
-rw-r--r--gcc/gcov.c30
4 files changed, 33 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ce5276c1224..d4ee25a0b9f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2011-12-30 Nathan Sidwell <nathan@acm.org>
+
+ * gcov.c (total_lines, total_executed): New global vars.
+ (generate_results): Call executed_summary.
+ (executed_summary): New function, broken out of ...
+ (function_summary): ... here. Call it.
+ * coverage.c (coverage_finish): Also check for local_tick == -1.
+ * gcov-dump (tag_function): Correct labelling typo.
+
2011-12-29 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/51623
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 58a76cafadd..091e7e3e8c5 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -1119,7 +1119,7 @@ coverage_finish (void)
if (bbg_file_name && gcov_close ())
unlink (bbg_file_name);
- if (!local_tick)
+ if (!local_tick || local_tick == (unsigned)-1)
/* Only remove the da file, if we cannot stamp it. If we can
stamp it, libgcov will DTRT. */
unlink (da_file_name);
diff --git a/gcc/gcov-dump.c b/gcc/gcov-dump.c
index 4c2913b4d96..da0aa59d176 100644
--- a/gcc/gcov-dump.c
+++ b/gcc/gcov-dump.c
@@ -286,7 +286,7 @@ tag_function (const char *filename ATTRIBUTE_UNUSED,
{
printf (" ident=%u", gcov_read_unsigned ());
printf (", lineno_checksum=0x%08x", gcov_read_unsigned ());
- printf (", cfg_checksum_checksum=0x%08x", gcov_read_unsigned ());
+ printf (", cfg_checksum=0x%08x", gcov_read_unsigned ());
if (gcov_position () - pos < length)
{
diff --git a/gcc/gcov.c b/gcc/gcov.c
index d3cb4d09585..da9f85c780a 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -278,6 +278,9 @@ static unsigned a_names; /* Allocated names */
static unsigned object_runs;
static unsigned program_count;
+static unsigned total_lines;
+static unsigned total_executed;
+
/* Modification time of graph file. */
static time_t bbg_file_time;
@@ -380,6 +383,7 @@ static void solve_flow_graph (function_t *);
static void find_exception_blocks (function_t *);
static void add_branch_counts (coverage_t *, const arc_t *);
static void add_line_counts (coverage_t *, function_t *);
+static void executed_summary (unsigned, unsigned);
static void function_summary (const coverage_t *, const char *);
static const char *format_gcov (gcov_type, gcov_type, int);
static void accumulate_line_counts (source_t *);
@@ -702,6 +706,8 @@ generate_results (const char *file_name)
accumulate_line_counts (src);
function_summary (&src->coverage, "File");
+ total_lines += src->coverage.lines;
+ total_executed += src->coverage.lines_executed;
if (flag_gcov_file && src->coverage.lines)
{
char *gcov_file_name
@@ -724,6 +730,9 @@ generate_results (const char *file_name)
}
fnotice (stdout, "\n");
}
+
+ if (!file_name)
+ executed_summary (total_lines, total_executed);
}
/* Release a function structure */
@@ -1666,20 +1675,25 @@ format_gcov (gcov_type top, gcov_type bottom, int dp)
return buffer;
}
-
-/* Output summary info for a function. */
+/* Summary of execution */
static void
-function_summary (const coverage_t *coverage, const char *title)
+executed_summary (unsigned lines, unsigned executed)
{
- fnotice (stdout, "%s '%s'\n", title, coverage->name);
-
- if (coverage->lines)
+ if (lines)
fnotice (stdout, "Lines executed:%s of %d\n",
- format_gcov (coverage->lines_executed, coverage->lines, 2),
- coverage->lines);
+ format_gcov (executed, lines, 2), lines);
else
fnotice (stdout, "No executable lines\n");
+}
+
+/* Output summary info for a function or file. */
+
+static void
+function_summary (const coverage_t *coverage, const char *title)
+{
+ fnotice (stdout, "%s '%s'\n", title, coverage->name);
+ executed_summary (coverage->lines, coverage->lines_executed);
if (flag_branches)
{