summaryrefslogtreecommitdiff
path: root/gcc/coverage.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-20 16:33:20 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-20 16:33:20 +0000
commit64f3d828ae6402c43abae532540f69dfc2e1879c (patch)
tree98875495707657caef6dd3469a5bf5e5aa680935 /gcc/coverage.c
parent9872e76f4260ec10946c92a4f51cee8646b2a6a8 (diff)
downloadgcc-64f3d828ae6402c43abae532540f69dfc2e1879c.tar.gz
* coverage.c (coverage_compute_profile_id): Return non-0;
also handle symbols with unique name. (coverage_end_function): Do not skip DECL_EXTERNAL functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214232 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r--gcc/coverage.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c
index dd7655d80ad..34f975de863 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -579,7 +579,7 @@ coverage_compute_profile_id (struct cgraph_node *n)
unsigned chksum;
/* Externally visible symbols have unique name. */
- if (TREE_PUBLIC (n->decl) || DECL_EXTERNAL (n->decl))
+ if (TREE_PUBLIC (n->decl) || DECL_EXTERNAL (n->decl) || n->unique_name)
{
chksum = coverage_checksum_string
(0, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl)));
@@ -601,8 +601,10 @@ coverage_compute_profile_id (struct cgraph_node *n)
(chksum, aux_base_name);
}
- /* Non-negative integers are hopefully small enough to fit in all targets. */
- return chksum & 0x7fffffff;
+ /* Non-negative integers are hopefully small enough to fit in all targets.
+ Gcov file formats wants non-zero function IDs. */
+ chksum = chksum & 0x7fffffff;
+ return chksum + (!chksum);
}
/* Compute cfg checksum for the function FN given as argument.
@@ -692,30 +694,24 @@ coverage_end_function (unsigned lineno_checksum, unsigned cfg_checksum)
{
struct coverage_data *item = 0;
- /* If the function is extern (i.e. extern inline), then we won't
- be outputting it, so don't chain it onto the function
- list. */
- if (!DECL_EXTERNAL (current_function_decl))
- {
- item = ggc_alloc<coverage_data> ();
+ item = ggc_alloc<coverage_data> ();
- if (PARAM_VALUE (PARAM_PROFILE_FUNC_INTERNAL_ID))
- item->ident = current_function_funcdef_no + 1;
- else
- {
- gcc_assert (coverage_node_map_initialized_p ());
- item->ident = cgraph_node::get (cfun->decl)->profile_id;
- }
-
- item->lineno_checksum = lineno_checksum;
- item->cfg_checksum = cfg_checksum;
-
- item->fn_decl = current_function_decl;
- item->next = 0;
- *functions_tail = item;
- functions_tail = &item->next;
+ if (PARAM_VALUE (PARAM_PROFILE_FUNC_INTERNAL_ID))
+ item->ident = current_function_funcdef_no + 1;
+ else
+ {
+ gcc_assert (coverage_node_map_initialized_p ());
+ item->ident = cgraph_node::get (cfun->decl)->profile_id;
}
+ item->lineno_checksum = lineno_checksum;
+ item->cfg_checksum = cfg_checksum;
+
+ item->fn_decl = current_function_decl;
+ item->next = 0;
+ *functions_tail = item;
+ functions_tail = &item->next;
+
for (i = 0; i != GCOV_COUNTERS; i++)
{
tree var = fn_v_ctrs[i];