]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
coverage.c (coverage_compute_profile_id): Return non-0; also handle symbols with...
authorJan Hubicka <hubicka@ucw.cz>
Wed, 20 Aug 2014 16:33:20 +0000 (18:33 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 20 Aug 2014 16:33:20 +0000 (16:33 +0000)
* coverage.c (coverage_compute_profile_id): Return non-0;
also handle symbols with unique name.
(coverage_end_function): Do not skip DECL_EXTERNAL functions.

From-SVN: r214232

gcc/ChangeLog
gcc/coverage.c

index 5960aeb7f3623ff0b8141e11b4c26d01211f51b8..40c0a99a09d5a98327f49238d9561b966cd79d5f 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-20  Jan Hubicka  <hubicka@ucw.cz>
+
+       * coverage.c (coverage_compute_profile_id): Return non-0;
+       also handle symbols with unique name.
+       (coverage_end_function): Do not skip DECL_EXTERNAL functions.
+
 2014-08-20  Steve Ellcey  <sellcey@mips.com>
 
        PR middle-end/49191
index dd7655d80adea58157e23425d856f894c79e7ba6..34f975de8630b3256d74aa80fe6ccf9e41a341dd 100644 (file)
@@ -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];