summaryrefslogtreecommitdiff
path: root/gprof
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-12-11 13:41:59 +0000
committerNick Clifton <nickc@redhat.com>2009-12-11 13:41:59 +0000
commit5413b5486ba77949122a8bfd6067d31626e330f3 (patch)
tree6956d71f05d79d40e52fed28668bf9db104a4a04 /gprof
parentf28844f209b0de6783df75e402dd1c26f3edb0c7 (diff)
downloadbinutils-redhat-5413b5486ba77949122a8bfd6067d31626e330f3.tar.gz
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')
-rw-r--r--gprof/ChangeLog9
-rw-r--r--gprof/Makefile.in2
-rw-r--r--gprof/cg_arcs.c118
-rw-r--r--gprof/cg_dfn.c6
-rw-r--r--gprof/cg_print.c170
-rwxr-xr-xgprof/configure2
-rw-r--r--gprof/hist.c36
7 files changed, 171 insertions, 172 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index e9ae218f45..acc8697dcb 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,12 @@
+2009-12-11 Nick Clifton <nickc@redhat.com>
+
+ * Makefile.in: Regenerate.
+ * cg_arcs.c: Fix shadowed variable warnings.
+ * cg_dfn.c: Likewise.
+ * cg_print.c: Likewise.
+ * configure: Likewise.
+ * hist.c: Likewise.
+
2009-11-30 Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
diff --git a/gprof/Makefile.in b/gprof/Makefile.in
index c67e91392c..291c018e58 100644
--- a/gprof/Makefile.in
+++ b/gprof/Makefile.in
@@ -47,9 +47,11 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/warning.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/plugins.m4 \
$(top_srcdir)/../config/po.m4 \
$(top_srcdir)/../config/progtest.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
diff --git a/gprof/cg_arcs.c b/gprof/cg_arcs.c
index 10f3f973ab..1fa619dbd8 100644
--- a/gprof/cg_arcs.c
+++ b/gprof/cg_arcs.c
@@ -437,13 +437,13 @@ inherit_flags (Sym *child)
static void
propagate_flags (Sym **symbols)
{
- int index;
+ int sym_index;
Sym *old_head, *child;
old_head = 0;
- for (index = symtab.len - 1; index >= 0; --index)
+ for (sym_index = symtab.len - 1; sym_index >= 0; --sym_index)
{
- child = symbols[index];
+ child = symbols[sym_index];
/*
* If we haven't done this function or cycle, inherit things
* from parent. This way, we are linear in the number of arcs
@@ -587,23 +587,20 @@ cmp_total (const PTR lp, const PTR rp)
}
-/*
- * Topologically sort the graph (collapsing cycles), and propagates
- * time bottom up and flags top down.
- */
+/* Topologically sort the graph (collapsing cycles), and propagates
+ time bottom up and flags top down. */
+
Sym **
-cg_assemble ()
+cg_assemble (void)
{
Sym *parent, **time_sorted_syms, **top_sorted_syms;
- unsigned int index;
+ unsigned int sym_index;
Arc *arc;
- /*
- * initialize various things:
- * zero out child times.
- * count self-recursive calls.
- * indicate that nothing is on cycles.
- */
+ /* Initialize various things:
+ Zero out child times.
+ Count self-recursive calls.
+ Indicate that nothing is on cycles. */
for (parent = symtab.base; parent < symtab.limit; parent++)
{
parent->cg.child_time = 0.0;
@@ -626,80 +623,65 @@ cg_assemble ()
parent->cg.cyc.head = parent;
parent->cg.cyc.next = 0;
if (ignore_direct_calls)
- {
- find_call (parent, parent->addr, (parent + 1)->addr);
- }
+ find_call (parent, parent->addr, (parent + 1)->addr);
}
- /*
- * Topologically order things. If any node is unnumbered, number
- * it and any of its descendents.
- */
+
+ /* Topologically order things. If any node is unnumbered, number
+ it and any of its descendents. */
for (parent = symtab.base; parent < symtab.limit; parent++)
{
if (parent->cg.top_order == DFN_NAN)
- {
- cg_dfn (parent);
- }
+ cg_dfn (parent);
}
- /* link together nodes on the same cycle: */
+ /* Link together nodes on the same cycle. */
cycle_link ();
- /* sort the symbol table in reverse topological order: */
+ /* Sort the symbol table in reverse topological order. */
top_sorted_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *));
- for (index = 0; index < symtab.len; ++index)
- {
- top_sorted_syms[index] = &symtab.base[index];
- }
+ for (sym_index = 0; sym_index < symtab.len; ++sym_index)
+ top_sorted_syms[sym_index] = &symtab.base[sym_index];
+
qsort (top_sorted_syms, symtab.len, sizeof (Sym *), cmp_topo);
DBG (DFNDEBUG,
printf ("[cg_assemble] topological sort listing\n");
- for (index = 0; index < symtab.len; ++index)
- {
- printf ("[cg_assemble] ");
- printf ("%d:", top_sorted_syms[index]->cg.top_order);
- print_name (top_sorted_syms[index]);
- printf ("\n");
- }
+ for (sym_index = 0; sym_index < symtab.len; ++sym_index)
+ {
+ printf ("[cg_assemble] ");
+ printf ("%d:", top_sorted_syms[sym_index]->cg.top_order);
+ print_name (top_sorted_syms[sym_index]);
+ printf ("\n");
+ }
);
- /*
- * Starting from the topological top, propagate print flags to
- * children. also, calculate propagation fractions. this happens
- * before time propagation since time propagation uses the
- * fractions.
- */
+
+ /* Starting from the topological top, propagate print flags to
+ children. also, calculate propagation fractions. this happens
+ before time propagation since time propagation uses the
+ fractions. */
propagate_flags (top_sorted_syms);
- /*
- * Starting from the topological bottom, propogate children times
- * up to parents.
- */
+ /* Starting from the topological bottom, propogate children times
+ up to parents. */
cycle_time ();
- for (index = 0; index < symtab.len; ++index)
- {
- propagate_time (top_sorted_syms[index]);
- }
+ for (sym_index = 0; sym_index < symtab.len; ++sym_index)
+ propagate_time (top_sorted_syms[sym_index]);
free (top_sorted_syms);
- /*
- * Now, sort by CG.PROP.SELF + CG.PROP.CHILD. Sorting both the regular
- * function names and cycle headers.
- */
+ /* Now, sort by CG.PROP.SELF + CG.PROP.CHILD. Sorting both the regular
+ function names and cycle headers. */
time_sorted_syms = (Sym **) xmalloc ((symtab.len + num_cycles) * sizeof (Sym *));
- for (index = 0; index < symtab.len; index++)
- {
- time_sorted_syms[index] = &symtab.base[index];
- }
- for (index = 1; index <= num_cycles; index++)
- {
- time_sorted_syms[symtab.len + index - 1] = &cycle_header[index];
- }
+ for (sym_index = 0; sym_index < symtab.len; sym_index++)
+ time_sorted_syms[sym_index] = &symtab.base[sym_index];
+
+ for (sym_index = 1; sym_index <= num_cycles; sym_index++)
+ time_sorted_syms[symtab.len + sym_index - 1] = &cycle_header[sym_index];
+
qsort (time_sorted_syms, symtab.len + num_cycles, sizeof (Sym *),
cmp_total);
- for (index = 0; index < symtab.len + num_cycles; index++)
- {
- time_sorted_syms[index]->cg.index = index + 1;
- }
+
+ for (sym_index = 0; sym_index < symtab.len + num_cycles; sym_index++)
+ time_sorted_syms[sym_index]->cg.index = sym_index + 1;
+
return time_sorted_syms;
}
diff --git a/gprof/cg_dfn.c b/gprof/cg_dfn.c
index 6ded5564f0..1da4c66b84 100644
--- a/gprof/cg_dfn.c
+++ b/gprof/cg_dfn.c
@@ -92,7 +92,7 @@ find_cycle (Sym *child)
Sym *head = 0;
Sym *tail;
int cycle_top;
- int index;
+ int cycle_index;
for (cycle_top = dfn_depth; cycle_top > 0; --cycle_top)
{
@@ -169,9 +169,9 @@ find_cycle (Sym *child)
print_name (head);
printf ("\n"));
}
- for (index = cycle_top + 1; index <= dfn_depth; ++index)
+ for (cycle_index = cycle_top + 1; cycle_index <= dfn_depth; ++cycle_index)
{
- child = dfn_stack[index].sym;
+ child = dfn_stack[cycle_index].sym;
if (child->cg.cyc.head == child)
{
/*
diff --git a/gprof/cg_print.c b/gprof/cg_print.c
index 0b2e989c2a..c1cb400681 100644
--- a/gprof/cg_print.c
+++ b/gprof/cg_print.c
@@ -499,7 +499,7 @@ print_line (Sym *np)
void
cg_print (Sym ** timesortsym)
{
- unsigned int index;
+ unsigned int sym_index;
Sym *parent;
if (print_descriptions && bsd_style_output)
@@ -507,9 +507,9 @@ cg_print (Sym ** timesortsym)
print_header ();
- for (index = 0; index < symtab.len + num_cycles; ++index)
+ for (sym_index = 0; sym_index < symtab.len + num_cycles; ++sym_index)
{
- parent = timesortsym[index];
+ parent = timesortsym[sym_index];
if ((ignore_zeros && parent->ncalls == 0
&& parent->cg.self_calls == 0 && parent->cg.prop.self == 0
@@ -560,7 +560,7 @@ cmp_name (const PTR left, const PTR right)
void
cg_print_index ()
{
- unsigned int index;
+ unsigned int sym_index;
unsigned int nnames, todo, i, j;
int col, starting_col;
Sym **name_sorted_syms, *sym;
@@ -572,30 +572,30 @@ cg_print_index ()
alphabetically to create an index. */
name_sorted_syms = (Sym **) xmalloc ((symtab.len + num_cycles) * sizeof (Sym *));
- for (index = 0, nnames = 0; index < symtab.len; index++)
+ for (sym_index = 0, nnames = 0; sym_index < symtab.len; sym_index++)
{
- if (ignore_zeros && symtab.base[index].ncalls == 0
- && symtab.base[index].hist.time == 0)
+ if (ignore_zeros && symtab.base[sym_index].ncalls == 0
+ && symtab.base[sym_index].hist.time == 0)
continue;
- name_sorted_syms[nnames++] = &symtab.base[index];
+ name_sorted_syms[nnames++] = &symtab.base[sym_index];
}
qsort (name_sorted_syms, nnames, sizeof (Sym *), cmp_name);
- for (index = 1, todo = nnames; index <= num_cycles; index++)
- name_sorted_syms[todo++] = &cycle_header[index];
+ for (sym_index = 1, todo = nnames; sym_index <= num_cycles; sym_index++)
+ name_sorted_syms[todo++] = &cycle_header[sym_index];
printf ("\f\n");
printf (_("Index by function name\n\n"));
- index = (todo + 2) / 3;
+ sym_index = (todo + 2) / 3;
- for (i = 0; i < index; i++)
+ for (i = 0; i < sym_index; i++)
{
col = 0;
starting_col = 0;
- for (j = i; j < todo; j += index)
+ for (j = i; j < todo; j += sym_index)
{
sym = name_sorted_syms[j];
@@ -771,9 +771,11 @@ cmp_fun_nuses (const PTR left, const PTR right)
of function ordering). */
void
-cg_print_function_ordering ()
+cg_print_function_ordering (void)
{
- unsigned long index, used, unused, scratch_index;
+ unsigned long sym_index;
+ unsigned long arc_index;
+ unsigned long used, unused, scratch_index;
unsigned long unplaced_arc_count, high_arc_count, scratch_arc_count;
#ifdef __GNUC__
unsigned long long total_arcs, tmp_arcs_count;
@@ -783,7 +785,7 @@ cg_print_function_ordering ()
Sym **unused_syms, **used_syms, **scratch_syms;
Arc **unplaced_arcs, **high_arcs, **scratch_arcs;
- index = 0;
+ sym_index = 0;
used = 0;
unused = 0;
scratch_index = 0;
@@ -801,20 +803,20 @@ cg_print_function_ordering ()
/* Walk through all the functions; mark those which are never
called as placed (we'll emit them as a group later). */
- for (index = 0, used = 0, unused = 0; index < symtab.len; index++)
+ for (sym_index = 0, used = 0, unused = 0; sym_index < symtab.len; sym_index++)
{
- if (symtab.base[index].ncalls == 0)
+ if (symtab.base[sym_index].ncalls == 0)
{
- unused_syms[unused++] = &symtab.base[index];
- symtab.base[index].has_been_placed = 1;
+ unused_syms[unused++] = &symtab.base[sym_index];
+ symtab.base[sym_index].has_been_placed = 1;
}
else
{
- used_syms[used++] = &symtab.base[index];
- symtab.base[index].has_been_placed = 0;
- symtab.base[index].next = 0;
- symtab.base[index].prev = 0;
- symtab.base[index].nuses = 0;
+ used_syms[used++] = &symtab.base[sym_index];
+ symtab.base[sym_index].has_been_placed = 0;
+ symtab.base[sym_index].next = 0;
+ symtab.base[sym_index].prev = 0;
+ symtab.base[sym_index].nuses = 0;
}
}
@@ -827,26 +829,26 @@ cg_print_function_ordering ()
Overflow is much less likely when this file is compiled
with GCC as it can double-wide integers via long long. */
total_arcs = 0;
- for (index = 0; index < numarcs; index++)
+ for (arc_index = 0; arc_index < numarcs; arc_index++)
{
- total_arcs += arcs[index]->count;
- arcs[index]->has_been_placed = 0;
+ total_arcs += arcs[arc_index]->count;
+ arcs[arc_index]->has_been_placed = 0;
}
/* We want to pull out those functions which are referenced
by many highly used arcs and emit them as a group. This
could probably use some tuning. */
tmp_arcs_count = 0;
- for (index = 0; index < numarcs; index++)
+ for (arc_index = 0; arc_index < numarcs; arc_index++)
{
- tmp_arcs_count += arcs[index]->count;
+ tmp_arcs_count += arcs[arc_index]->count;
/* Count how many times each parent and child are used up
to our threshhold of arcs (90%). */
if ((double)tmp_arcs_count / (double)total_arcs > 0.90)
break;
- arcs[index]->child->nuses++;
+ arcs[arc_index]->child->nuses++;
}
/* Now sort a temporary symbol table based on the number of
@@ -856,9 +858,9 @@ cg_print_function_ordering ()
/* Now pick out those symbols we're going to emit as
a group. We take up to 1.25% of the used symbols. */
- for (index = 0; index < used / 80; index++)
+ for (sym_index = 0; sym_index < used / 80; sym_index++)
{
- Sym *sym = scratch_syms[index];
+ Sym *sym = scratch_syms[sym_index];
Arc *arc;
/* If we hit symbols that aren't used from many call sites,
@@ -897,7 +899,7 @@ cg_print_function_ordering ()
}
/* Keep track of how many symbols we're going to place. */
- scratch_index = index;
+ scratch_index = sym_index;
/* A lie, but it makes identifying
these functions easier later. */
@@ -906,16 +908,16 @@ cg_print_function_ordering ()
/* Now walk through the temporary arcs and copy
those we care about into the high arcs array. */
- for (index = 0; index < scratch_arc_count; index++)
+ for (arc_index = 0; arc_index < scratch_arc_count; arc_index++)
{
- Arc *arc = scratch_arcs[index];
+ Arc *arc = scratch_arcs[arc_index];
/* If this arc refers to highly used functions, then
then we want to keep it. */
if (arc->child->has_been_placed
&& arc->parent->has_been_placed)
{
- high_arcs[high_arc_count++] = scratch_arcs[index];
+ high_arcs[high_arc_count++] = scratch_arcs[arc_index];
/* We need to turn of has_been_placed since we're going to
use the main arc placement algorithm on these arcs. */
@@ -926,10 +928,10 @@ cg_print_function_ordering ()
/* Dump the multi-site high usage functions which are not
going to be ordered by the main ordering algorithm. */
- for (index = 0; index < scratch_index; index++)
+ for (sym_index = 0; sym_index < scratch_index; sym_index++)
{
- if (scratch_syms[index]->has_been_placed)
- printf ("%s\n", scratch_syms[index]->name);
+ if (scratch_syms[sym_index]->has_been_placed)
+ printf ("%s\n", scratch_syms[sym_index]->name);
}
/* Now we can order the multi-site high use
@@ -948,13 +950,13 @@ cg_print_function_ordering ()
scratch_arcs, &scratch_arc_count);
/* Output any functions not emitted by the order_and_dump calls. */
- for (index = 0; index < used; index++)
- if (used_syms[index]->has_been_placed == 0)
- printf("%s\n", used_syms[index]->name);
+ for (sym_index = 0; sym_index < used; sym_index++)
+ if (used_syms[sym_index]->has_been_placed == 0)
+ printf("%s\n", used_syms[sym_index]->name);
/* Output the unused functions. */
- for (index = 0; index < unused; index++)
- printf("%s\n", unused_syms[index]->name);
+ for (sym_index = 0; sym_index < unused; sym_index++)
+ printf("%s\n", unused_syms[sym_index]->name);
unused_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *));
used_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *));
@@ -992,7 +994,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
#else
unsigned long tmp_arcs, total_arcs;
#endif
- unsigned int index;
+ unsigned int arc_index;
/* If needed, compute the total arc count.
@@ -1000,27 +1002,27 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
if (! all)
{
total_arcs = 0;
- for (index = 0; index < arc_count; index++)
- total_arcs += the_arcs[index]->count;
+ for (arc_index = 0; arc_index < arc_count; arc_index++)
+ total_arcs += the_arcs[arc_index]->count;
}
else
total_arcs = 0;
tmp_arcs = 0;
- for (index = 0; index < arc_count; index++)
+ for (arc_index = 0; arc_index < arc_count; arc_index++)
{
Sym *sym1, *sym2;
Sym *child, *parent;
- tmp_arcs += the_arcs[index]->count;
+ tmp_arcs += the_arcs[arc_index]->count;
/* Ignore this arc if it's already been placed. */
- if (the_arcs[index]->has_been_placed)
+ if (the_arcs[arc_index]->has_been_placed)
continue;
- child = the_arcs[index]->child;
- parent = the_arcs[index]->parent;
+ child = the_arcs[arc_index]->child;
+ parent = the_arcs[arc_index]->parent;
/* If we're not using all arcs, and this is a rarely used
arc, then put it on the unplaced_arc list. Similarly
@@ -1028,7 +1030,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
if ((! all && (double)tmp_arcs / (double)total_arcs > MOST)
|| child->has_been_placed || parent->has_been_placed)
{
- unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index];
continue;
}
@@ -1038,7 +1040,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
algorithm can use it to place function chains. */
if (parent->next && parent->prev && child->next && child->prev)
{
- unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index];
continue;
}
@@ -1093,7 +1095,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
{
/* Couldn't find anywhere to attach the functions,
put the arc on the unplaced arc list. */
- unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index];
continue;
}
@@ -1118,7 +1120,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
&& sym2 == parent)
{
/* This would tie two ends together. */
- unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index];
continue;
}
@@ -1130,7 +1132,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
/* parent-prev and child-next */
parent->prev = child;
child->next = parent;
- the_arcs[index]->has_been_placed = 1;
+ the_arcs[arc_index]->has_been_placed = 1;
}
}
else if (parent->prev)
@@ -1141,7 +1143,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
/* parent-next and child-prev */
parent->next = child;
child->prev = parent;
- the_arcs[index]->has_been_placed = 1;
+ the_arcs[arc_index]->has_been_placed = 1;
}
}
else
@@ -1153,27 +1155,27 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
/* parent-prev and child-next. */
parent->prev = child;
child->next = parent;
- the_arcs[index]->has_been_placed = 1;
+ the_arcs[arc_index]->has_been_placed = 1;
}
else
{
/* parent-next and child-prev. */
parent->next = child;
child->prev = parent;
- the_arcs[index]->has_been_placed = 1;
+ the_arcs[arc_index]->has_been_placed = 1;
}
}
}
/* Dump the chains of functions we've made. */
- for (index = 0; index < arc_count; index++)
+ for (arc_index = 0; arc_index < arc_count; arc_index++)
{
Sym *sym;
- if (the_arcs[index]->parent->has_been_placed
- || the_arcs[index]->child->has_been_placed)
+ if (the_arcs[arc_index]->parent->has_been_placed
+ || the_arcs[arc_index]->child->has_been_placed)
continue;
- sym = the_arcs[index]->parent;
+ sym = the_arcs[arc_index]->parent;
/* If this symbol isn't attached to any other
symbols, then we've got a rarely used arc.
@@ -1199,14 +1201,14 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
/* If we want to place all the arcs, then output
those which weren't placed by the main algorithm. */
if (all)
- for (index = 0; index < arc_count; index++)
+ for (arc_index = 0; arc_index < arc_count; arc_index++)
{
Sym *sym;
- if (the_arcs[index]->parent->has_been_placed
- || the_arcs[index]->child->has_been_placed)
+ if (the_arcs[arc_index]->parent->has_been_placed
+ || the_arcs[arc_index]->child->has_been_placed)
continue;
- sym = the_arcs[index]->parent;
+ sym = the_arcs[arc_index]->parent;
sym->has_been_placed = 1;
printf ("%s\n", sym->name);
@@ -1230,42 +1232,44 @@ cmp_symbol_map (const void * l, const void * r)
void
cg_print_file_ordering (void)
{
- unsigned long scratch_arc_count, index;
+ unsigned long scratch_arc_count;
+ unsigned long arc_index;
+ unsigned long sym_index;
Arc **scratch_arcs;
char *last;
scratch_arc_count = 0;
scratch_arcs = (Arc **) xmalloc (numarcs * sizeof (Arc *));
- for (index = 0; index < numarcs; index++)
+ for (arc_index = 0; arc_index < numarcs; arc_index++)
{
- if (! arcs[index]->parent->mapped
- || ! arcs[index]->child->mapped)
- arcs[index]->has_been_placed = 1;
+ if (! arcs[arc_index]->parent->mapped
+ || ! arcs[arc_index]->child->mapped)
+ arcs[arc_index]->has_been_placed = 1;
}
order_and_dump_functions_by_arcs (arcs, numarcs, 0,
scratch_arcs, &scratch_arc_count);
/* Output .o's not handled by the main placement algorithm. */
- for (index = 0; index < symtab.len; index++)
+ for (sym_index = 0; sym_index < symtab.len; sym_index++)
{
- if (symtab.base[index].mapped
- && ! symtab.base[index].has_been_placed)
- printf ("%s\n", symtab.base[index].name);
+ if (symtab.base[sym_index].mapped
+ && ! symtab.base[sym_index].has_been_placed)
+ printf ("%s\n", symtab.base[sym_index].name);
}
qsort (symbol_map, symbol_map_count, sizeof (struct function_map), cmp_symbol_map);
/* Now output any .o's that didn't have any text symbols. */
last = NULL;
- for (index = 0; index < symbol_map_count; index++)
+ for (sym_index = 0; sym_index < symbol_map_count; sym_index++)
{
unsigned int index2;
/* Don't bother searching if this symbol
is the same as the previous one. */
- if (last && !strcmp (last, symbol_map[index].file_name))
+ if (last && !strcmp (last, symbol_map[sym_index].file_name))
continue;
for (index2 = 0; index2 < symtab.len; index2++)
@@ -1273,14 +1277,14 @@ cg_print_file_ordering (void)
if (! symtab.base[index2].mapped)
continue;
- if (!strcmp (symtab.base[index2].name, symbol_map[index].file_name))
+ if (!strcmp (symtab.base[index2].name, symbol_map[sym_index].file_name))
break;
}
/* If we didn't find it in the symbol table, then it must
be a .o with no text symbols. Output it last. */
if (index2 == symtab.len)
- printf ("%s\n", symbol_map[index].file_name);
- last = symbol_map[index].file_name;
+ printf ("%s\n", symbol_map[sym_index].file_name);
+ last = symbol_map[sym_index].file_name;
}
}
diff --git a/gprof/configure b/gprof/configure
index f45fa4243f..60b2d1800f 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -11883,7 +11883,7 @@ fi
-GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow"
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
diff --git a/gprof/hist.c b/gprof/hist.c
index 6f4ead83a6..25364b215e 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);