OSDN Git Service

* config/avr/avr.md ("andsi3"): Fix wrong cc attribute.
[pf3gnuchains/gcc-fork.git] / gcc / coverage.c
index cd1c13e..b2ac876 100644 (file)
@@ -1,6 +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 Free Software Foundation, Inc.
+   2000, 2001, 2003, 2004, 2005, 2007, 2008 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.
@@ -37,12 +38,14 @@ along with GCC; see the file COPYING3.  If not see
 #include "expr.h"
 #include "function.h"
 #include "toplev.h"
+#include "tm_p.h"
 #include "ggc.h"
 #include "coverage.h"
 #include "langhooks.h"
 #include "hashtab.h"
 #include "tree-iterator.h"
 #include "cgraph.h"
+#include "tree-pass.h"
 
 #include "gcov-io.c"
 
@@ -139,7 +142,7 @@ get_gcov_unsigned_t (void)
 static hashval_t
 htab_counts_entry_hash (const void *of)
 {
-  const counts_entry_t *entry = of;
+  const counts_entry_t *const entry = (const counts_entry_t *) of;
 
   return entry->ident * GCOV_COUNTERS + entry->ctr;
 }
@@ -147,8 +150,8 @@ htab_counts_entry_hash (const void *of)
 static int
 htab_counts_entry_eq (const void *of1, const void *of2)
 {
-  const counts_entry_t *entry1 = of1;
-  const counts_entry_t *entry2 = of2;
+  const counts_entry_t *const entry1 = (const counts_entry_t *) of1;
+  const counts_entry_t *const entry2 = (const counts_entry_t *) of2;
 
   return entry1->ident == entry2->ident && entry1->ctr == entry2->ctr;
 }
@@ -156,7 +159,7 @@ htab_counts_entry_eq (const void *of1, const void *of2)
 static void
 htab_counts_entry_del (void *of)
 {
-  counts_entry_t *entry = of;
+  counts_entry_t *const entry = (counts_entry_t *) of;
 
   free (entry->counts);
   free (entry);
@@ -332,7 +335,7 @@ get_coverage_counts (unsigned counter, unsigned expected,
       static int warned = 0;
 
       if (!warned++)
-       inform ((flag_guess_branch_prob
+       inform (input_location, (flag_guess_branch_prob
                 ? "file %s not found, execution counts estimated"
                 : "file %s not found, execution counts assumed to be zero"),
                da_file_name);
@@ -341,7 +344,7 @@ get_coverage_counts (unsigned counter, unsigned expected,
 
   elt.ident = current_function_funcdef_no + 1;
   elt.ctr = counter;
-  entry = htab_find (counts_hash, &elt);
+  entry = (counts_entry_t *) htab_find (counts_hash, &elt);
   if (!entry)
     {
       warning (0, "no coverage for function %qs found", IDENTIFIER_POINTER
@@ -367,9 +370,9 @@ get_coverage_counts (unsigned counter, unsigned expected,
       if (!inhibit_warnings)
        {
          if (entry->checksum != checksum)
-           inform ("checksum is %x instead of %x", entry->checksum, checksum);
+           inform (input_location, "checksum is %x instead of %x", entry->checksum, checksum);
          else
-           inform ("number of counters is %d instead of %d",
+           inform (input_location, "number of counters is %d instead of %d",
                    entry->summary.num, expected);
        }
 
@@ -377,12 +380,12 @@ get_coverage_counts (unsigned counter, unsigned expected,
          && !inhibit_warnings
          && !warned++)
        {
-         inform ("coverage mismatch ignored due to -Wcoverage-mismatch");
-         inform (flag_guess_branch_prob
+         inform (input_location, "coverage mismatch ignored due to -Wcoverage-mismatch");
+         inform (input_location, flag_guess_branch_prob
                  ? "execution counts estimated"
                  : "execution counts assumed to be zero");
          if (!flag_guess_branch_prob)
-           inform ("this can result in poorly optimized code");
+           inform (input_location, "this can result in poorly optimized code");
        }
 
       return NULL;
@@ -421,6 +424,9 @@ coverage_counter_alloc (unsigned counter, unsigned num)
       ASM_GENERATE_INTERNAL_LABEL (buf, "LPBX", counter + 1);
       DECL_NAME (tree_ctr_tables[counter]) = get_identifier (buf);
       DECL_ALIGN (tree_ctr_tables[counter]) = TYPE_ALIGN (gcov_type_node);
+
+      if (dump_file)
+       fprintf (dump_file, "Using data file %s\n", da_file_name);
     }
   fn_b_ctrs[counter] = fn_n_ctrs[counter];
   fn_n_ctrs[counter] += num;
@@ -485,7 +491,7 @@ coverage_checksum_string (unsigned chksum, const char *string)
          _GLOBAL__N_<filename>_<wrongmagicnumber>_<magicnumber>functionname
        since filename might contain extra underscores there seems
        to be no better chance then walk all possible offsets looking
-       for magicnuber.  */
+       for magicnumber.  */
       if (offset)
        {
          for (i = i + offset; string[i]; i++)