diff options
author | Nick Clifton <nickc@redhat.com> | 2009-12-11 13:42:17 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-12-11 13:42:17 +0000 |
commit | 91d6fa6a035cc7d0b7be5c99c194a64cb80924b0 (patch) | |
tree | 214507c313b77d619b52afcae2af0b02c9fa700b /gprof/hist.c | |
parent | 01fe1b4183324882e88e8c64748bffdc69ea3a9c (diff) | |
download | gdb-91d6fa6a035cc7d0b7be5c99c194a64cb80924b0.zip gdb-91d6fa6a035cc7d0b7be5c99c194a64cb80924b0.tar.gz gdb-91d6fa6a035cc7d0b7be5c99c194a64cb80924b0.tar.bz2 |
Add -Wshadow to the gcc command line options used when compiling the binutils.
Fix up all warnings generated by the addition of this switch.
Diffstat (limited to 'gprof/hist.c')
-rw-r--r-- | gprof/hist.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/gprof/hist.c b/gprof/hist.c index 6f4ead8..25364b2 100644 --- a/gprof/hist.c +++ b/gprof/hist.c @@ -366,7 +366,7 @@ hist_assign_samples_1 (histogram *r) bfd_vma overlap, addr; unsigned int bin_count; unsigned int i, j; - double time, credit; + double count_time, credit; bfd_vma lowpc = r->lowpc / sizeof (UNIT); @@ -379,7 +379,7 @@ hist_assign_samples_1 (histogram *r) bin_low_pc = lowpc + (bfd_vma) (hist_scale * i); bin_high_pc = lowpc + (bfd_vma) (hist_scale * (i + 1)); - time = bin_count; + count_time = bin_count; DBG (SAMPLEDEBUG, printf ( @@ -387,7 +387,7 @@ hist_assign_samples_1 (histogram *r) (unsigned long) (sizeof (UNIT) * bin_low_pc), (unsigned long) (sizeof (UNIT) * bin_high_pc), bin_count)); - total_time += time; + total_time += count_time; /* Credit all symbols that are covered by bin I. */ for (j = j - 1; j < symtab.len; ++j) @@ -414,11 +414,11 @@ hist_assign_samples_1 (histogram *r) "[assign_samples] [0x%lx,0x%lx) %s gets %f ticks %ld overlap\n", (unsigned long) symtab.base[j].addr, (unsigned long) (sizeof (UNIT) * sym_high_pc), - symtab.base[j].name, overlap * time / hist_scale, + symtab.base[j].name, overlap * count_time / hist_scale, (long) overlap)); addr = symtab.base[j].addr; - credit = overlap * time / hist_scale; + credit = overlap * count_time / hist_scale; /* Credit symbol if it appears in INCL_FLAT or that table is empty and it does not appear it in @@ -563,9 +563,9 @@ void hist_print () { Sym **time_sorted_syms, *top_dog, *sym; - unsigned int index; + unsigned int sym_index; unsigned log_scale; - double top_time, time; + double top_time; bfd_vma addr; if (first_output) @@ -592,8 +592,8 @@ hist_print () and tertiary keys). */ time_sorted_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *)); - for (index = 0; index < symtab.len; ++index) - time_sorted_syms[index] = &symtab.base[index]; + for (sym_index = 0; sym_index < symtab.len; ++sym_index) + time_sorted_syms[sym_index] = &symtab.base[sym_index]; qsort (time_sorted_syms, symtab.len, sizeof (Sym *), cmp_time); @@ -609,18 +609,20 @@ hist_print () top_dog = 0; top_time = 0.0; - for (index = 0; index < symtab.len; ++index) + for (sym_index = 0; sym_index < symtab.len; ++sym_index) { - sym = time_sorted_syms[index]; + sym = time_sorted_syms[sym_index]; if (sym->ncalls != 0) { - time = (sym->hist.time + sym->cg.child_time) / sym->ncalls; + double call_time; - if (time > top_time) + call_time = (sym->hist.time + sym->cg.child_time) / sym->ncalls; + + if (call_time > top_time) { top_dog = sym; - top_time = time; + top_time = call_time; } } } @@ -644,16 +646,16 @@ hist_print () I-cache misses etc.). */ print_header (SItab[log_scale].prefix); - for (index = 0; index < symtab.len; ++index) + for (sym_index = 0; sym_index < symtab.len; ++sym_index) { - addr = time_sorted_syms[index]->addr; + addr = time_sorted_syms[sym_index]->addr; /* Print symbol if its in INCL_FLAT table or that table is empty and the symbol is not in EXCL_FLAT. */ if (sym_lookup (&syms[INCL_FLAT], addr) || (syms[INCL_FLAT].len == 0 && !sym_lookup (&syms[EXCL_FLAT], addr))) - print_line (time_sorted_syms[index], SItab[log_scale].scale); + print_line (time_sorted_syms[sym_index], SItab[log_scale].scale); } free (time_sorted_syms); |