OSDN Git Service

Unify handling of runtime support functions.
[pf3gnuchains/gcc-fork.git] / gcc / coverage.c
index 065c87c..79d20ab 100644 (file)
@@ -1,7 +1,7 @@
 /* Read and write coverage files, and associated functionality.
    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999,
-   2000, 2001, 2003, 2004, 2005, 2007, 2008 Free Software Foundation,
-   Inc.
+   2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+   Free Software Foundation, Inc.
    Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
    based on some ideas from Dain Samples of UC Berkeley.
    Further mangling by Bob Manson, Cygnus Support.
@@ -47,8 +47,9 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-iterator.h"
 #include "cgraph.h"
 #include "tree-pass.h"
-#include "diagnostic.h"
+#include "diagnostic-core.h"
 #include "intl.h"
+#include "filenames.h"
 
 #include "gcov-io.c"
 
@@ -104,10 +105,6 @@ static htab_t counts_hash = NULL;
 /* Trees representing the counter table arrays.  */
 static GTY(()) tree tree_ctr_tables[GCOV_COUNTERS];
 
-/* The names of the counter tables.  Not used if we're
-   generating counters at tree level.  */
-static GTY(()) rtx ctr_labels[GCOV_COUNTERS];
-
 /* The names of merge functions for counters.  */
 static const char *const ctr_merge_functions[GCOV_COUNTERS] = GCOV_MERGE_FUNCTIONS;
 static const char *const ctr_names[GCOV_COUNTERS] = GCOV_COUNTER_NAMES;
@@ -376,7 +373,7 @@ get_coverage_counts (unsigned counter, unsigned expected,
            inform (input_location, "number of counters is %d instead of %d",
                    entry->summary.num, expected);
          
-         if (!(errorcount || sorrycount)
+         if (!seen_error ()
              && !warned++)
            {
              inform (input_location, "coverage mismatch ignored");
@@ -648,7 +645,7 @@ build_fn_info_type (unsigned int counters)
   /* checksum */
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
 
   array_type = build_int_cst (NULL_TREE, counters - 1);
@@ -658,7 +655,7 @@ build_fn_info_type (unsigned int counters)
   /* counters */
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, array_type);
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
 
   finish_builtin_struct (type, "__gcov_fn_info", fields, NULL_TREE);
@@ -682,13 +679,13 @@ build_fn_info_value (const struct function_list *function, tree type)
   CONSTRUCTOR_APPEND_ELT (v1, fields,
                          build_int_cstu (get_gcov_unsigned_t (),
                                          function->ident));
-  fields = TREE_CHAIN (fields);
+  fields = DECL_CHAIN (fields);
 
   /* checksum */
   CONSTRUCTOR_APPEND_ELT (v1, fields,
                          build_int_cstu (get_gcov_unsigned_t (),
                                          function->checksum));
-  fields = TREE_CHAIN (fields);
+  fields = DECL_CHAIN (fields);
 
   /* counters */
   for (ix = 0; ix != GCOV_COUNTERS; ix++)
@@ -716,13 +713,13 @@ build_ctr_info_type (void)
   /* counters */
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
 
   /* values */
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, gcov_ptr_type);
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
 
   /* merge */
@@ -733,7 +730,7 @@ build_ctr_info_type (void)
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE,
                      build_pointer_type (gcov_merge_fn_type));
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
 
   finish_builtin_struct (type, "__gcov_ctr_info", fields, NULL_TREE);
@@ -756,7 +753,7 @@ build_ctr_info_value (unsigned int counter, tree type)
   CONSTRUCTOR_APPEND_ELT (v, fields,
                          build_int_cstu (get_gcov_unsigned_t (),
                                          prg_n_ctrs[counter]));
-  fields = TREE_CHAIN (fields);
+  fields = DECL_CHAIN (fields);
 
   if (prg_n_ctrs[counter])
     {
@@ -779,7 +776,7 @@ build_ctr_info_value (unsigned int counter, tree type)
     }
   else
     CONSTRUCTOR_APPEND_ELT (v, fields, null_pointer_node);
-  fields = TREE_CHAIN (fields);
+  fields = DECL_CHAIN (fields);
 
   fn = build_decl (BUILTINS_LOCATION,
                   FUNCTION_DECL,
@@ -826,7 +823,7 @@ build_gcov_info (void)
   /* Version ident */
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
   CONSTRUCTOR_APPEND_ELT (v1, field,
                          build_int_cstu (TREE_TYPE (field), GCOV_VERSION));
@@ -834,14 +831,14 @@ build_gcov_info (void)
   /* next -- NULL */
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, build_pointer_type (const_type));
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
   CONSTRUCTOR_APPEND_ELT (v1, field, null_pointer_node);
 
   /* stamp */
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
   CONSTRUCTOR_APPEND_ELT (v1, field,
                          build_int_cstu (TREE_TYPE (field), local_tick));
@@ -851,7 +848,7 @@ build_gcov_info (void)
                                                    TYPE_QUAL_CONST));
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, string_type);
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
   da_file_name_len = strlen (da_file_name);
   filename_string = build_string (da_file_name_len + 1, da_file_name);
@@ -885,7 +882,7 @@ build_gcov_info (void)
   /* number of functions */
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
   CONSTRUCTOR_APPEND_ELT (v1, field,
                          build_int_cstu (get_gcov_unsigned_t (), n_fns));
@@ -893,14 +890,14 @@ build_gcov_info (void)
   /* fn_info table */
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, fn_info_ptr_type);
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
   CONSTRUCTOR_APPEND_ELT (v1, field, fn_info_value);
 
   /* counter_mask */
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
   CONSTRUCTOR_APPEND_ELT (v1, field, 
                          build_int_cstu (get_gcov_unsigned_t (),
@@ -920,7 +917,7 @@ build_gcov_info (void)
 
   field = build_decl (BUILTINS_LOCATION,
                      FIELD_DECL, NULL_TREE, ctr_info_ary_type);
-  TREE_CHAIN (field) = fields;
+  DECL_CHAIN (field) = fields;
   fields = field;
   CONSTRUCTOR_APPEND_ELT (v1, field, ctr_info_value);
 
@@ -986,7 +983,7 @@ coverage_init (const char *filename)
   /* + 1 for extra '/', in case prefix doesn't end with /.  */
   int prefix_len;
 
-  if (profile_data_prefix == 0 && filename[0] != '/')
+  if (profile_data_prefix == 0 && !IS_ABSOLUTE_PATH(&filename[0]))
     profile_data_prefix = getpwd ();
 
   prefix_len = (profile_data_prefix) ? strlen (profile_data_prefix) + 1 : 0;