diff options
author | Ian Lance Taylor <ian@airs.com> | 1998-03-29 04:15:29 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1998-03-29 04:15:29 +0000 |
commit | 6b84886ad5e6b53e7b3bb6d8c33685614364b58f (patch) | |
tree | febee5c105a2f24b54b4dcd198f0083f0afc903d /gprof | |
parent | c246596af760bc57c2af7c5a10afbe5ec0dd9fc2 (diff) | |
download | gdb-6b84886ad5e6b53e7b3bb6d8c33685614364b58f.zip gdb-6b84886ad5e6b53e7b3bb6d8c33685614364b58f.tar.gz gdb-6b84886ad5e6b53e7b3bb6d8c33685614364b58f.tar.bz2 |
Fix some gcc -Wall warnings:
* cg_arcs.c (num_cycles): Change to unsigned int.
(numarcs): Likewise.
(arc_add): Change maxarcs to unsigned int.
(cg_assemble): Change index to unsigned int.
* cg_arcs.h (num_cycles, numarcs): Update declarations.
* cg_print.c (cg_print): Change index to unsigned int.
(cg_print_index): Change index, nnames, todo, i, and j to unsigned
int.
(cg_print_file_ordering): Change symbol_count and index2 to
unsigned int.
* core.c (symbol_map_count): Change to unsigned int.
(core_create_function_syms): Change j to unsigned int.
(core_create_line_syms): Add cast to avoid warning.
* hist.c (hist_assign_samples): Change j to unsigned int.
(hist_print): Change index to unsigned i nt. Add cast to avoid
warning.
* sym_ids.c (parse_spec): Add casts to avoid warning.
* symtab.c (symtab_finalize): Change j to unsigned int.
(sym_lookup): Update printf format strings.
* symtab.h (Sym_Table): Change len to unsigned int.
* tahoe.c (tahoe_reladdr): Add casts to avoid warnings.
Diffstat (limited to 'gprof')
-rw-r--r-- | gprof/ChangeLog | 25 | ||||
-rw-r--r-- | gprof/cg_arcs.c | 8 | ||||
-rw-r--r-- | gprof/cg_arcs.h | 4 | ||||
-rw-r--r-- | gprof/cg_print.c | 10 | ||||
-rw-r--r-- | gprof/core.c | 7 | ||||
-rw-r--r-- | gprof/hist.c | 9 | ||||
-rw-r--r-- | gprof/sym_ids.c | 4 | ||||
-rw-r--r-- | gprof/symtab.c | 6 | ||||
-rw-r--r-- | gprof/symtab.h | 2 | ||||
-rw-r--r-- | gprof/tahoe.c | 4 |
10 files changed, 55 insertions, 24 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog index 0139b1d..2ab71bb 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,28 @@ +Sat Mar 28 23:09:08 1998 Ian Lance Taylor <ian@cygnus.com> + + Fix some gcc -Wall warnings: + * cg_arcs.c (num_cycles): Change to unsigned int. + (numarcs): Likewise. + (arc_add): Change maxarcs to unsigned int. + (cg_assemble): Change index to unsigned int. + * cg_arcs.h (num_cycles, numarcs): Update declarations. + * cg_print.c (cg_print): Change index to unsigned int. + (cg_print_index): Change index, nnames, todo, i, and j to unsigned + int. + (cg_print_file_ordering): Change symbol_count and index2 to + unsigned int. + * core.c (symbol_map_count): Change to unsigned int. + (core_create_function_syms): Change j to unsigned int. + (core_create_line_syms): Add cast to avoid warning. + * hist.c (hist_assign_samples): Change j to unsigned int. + (hist_print): Change index to unsigned i nt. Add cast to avoid + warning. + * sym_ids.c (parse_spec): Add casts to avoid warning. + * symtab.c (symtab_finalize): Change j to unsigned int. + (sym_lookup): Update printf format strings. + * symtab.h (Sym_Table): Change len to unsigned int. + * tahoe.c (tahoe_reladdr): Add casts to avoid warnings. + Tue Mar 24 19:00:11 1998 Ian Lance Taylor <ian@cygnus.com> Add --demangle and --no-demangle options: diff --git a/gprof/cg_arcs.c b/gprof/cg_arcs.c index f341a8f..d14238d 100644 --- a/gprof/cg_arcs.c +++ b/gprof/cg_arcs.c @@ -26,9 +26,9 @@ #include "sym_ids.h" Sym *cycle_header; -int num_cycles; +unsigned int num_cycles; Arc **arcs; -int numarcs; +unsigned int numarcs; /* * Return TRUE iff PARENT has an arc to covers the address @@ -67,7 +67,7 @@ void DEFUN (arc_add, (parent, child, count), Sym * parent AND Sym * child AND int count) { - static int maxarcs = 0; + static unsigned int maxarcs = 0; Arc *arc, **newarcs; DBG (TALLYDEBUG, printf ("[arc_add] %d arcs from %s to %s\n", @@ -575,7 +575,7 @@ Sym ** DEFUN_VOID (cg_assemble) { Sym *parent, **time_sorted_syms, **top_sorted_syms; - long index; + unsigned int index; Arc *arc; /* diff --git a/gprof/cg_arcs.h b/gprof/cg_arcs.h index 132ee73..b9c3a36 100644 --- a/gprof/cg_arcs.h +++ b/gprof/cg_arcs.h @@ -24,13 +24,13 @@ typedef struct arc } Arc; -extern int num_cycles; /* number of cycles discovered */ +extern unsigned int num_cycles; /* number of cycles discovered */ extern Sym *cycle_header; /* cycle headers */ extern void arc_add PARAMS ((Sym * parent, Sym * child, int count)); extern Arc *arc_lookup PARAMS ((Sym * parent, Sym * child)); extern Sym **cg_assemble PARAMS ((void)); extern Arc **arcs; -extern int numarcs; +extern unsigned int numarcs; #endif /* cg_arcs_h */ diff --git a/gprof/cg_print.c b/gprof/cg_print.c index 093b956..2a7bc83 100644 --- a/gprof/cg_print.c +++ b/gprof/cg_print.c @@ -497,7 +497,7 @@ DEFUN (print_line, (np), Sym * np) void DEFUN (cg_print, (timesortsym), Sym ** timesortsym) { - int index; + unsigned int index; Sym *parent; if (print_descriptions && bsd_style_output) @@ -557,7 +557,9 @@ DEFUN (cmp_name, (left, right), const PTR left AND const PTR right) void DEFUN_VOID (cg_print_index) { - int index, nnames, todo, i, j, col, starting_col; + unsigned int index; + unsigned int nnames, todo, i, j; + int col, starting_col; Sym **name_sorted_syms, *sym; const char *filename; char buf[20]; @@ -1220,7 +1222,7 @@ DEFUN_VOID (cg_print_file_ordering) unsigned long scratch_arc_count, index; Arc **scratch_arcs; extern struct function_map *symbol_map; - extern int symbol_map_count; + extern unsigned int symbol_map_count; char *last; scratch_arc_count = 0; @@ -1248,7 +1250,7 @@ DEFUN_VOID (cg_print_file_ordering) last = NULL; for (index = 0; index < symbol_map_count; index++) { - int index2; + unsigned int index2; /* Don't bother searching if this symbol is the same as the previous one. */ diff --git a/gprof/core.c b/gprof/core.c index 597355e..22c89dc 100644 --- a/gprof/core.c +++ b/gprof/core.c @@ -19,7 +19,7 @@ struct function_map { }; struct function_map *symbol_map; -int symbol_map_count; +unsigned int symbol_map_count; extern void i386_find_call PARAMS ((Sym *, bfd_vma, bfd_vma)); extern void alpha_find_call PARAMS ((Sym *, bfd_vma, bfd_vma)); @@ -396,7 +396,8 @@ DEFUN (core_create_function_syms, (core_bfd), bfd * core_bfd) { bfd_vma min_vma = ~0, max_vma = 0; int class; - long i, j, found, skip; + long i, found, skip; + unsigned int j; /* pass 1 - determine upper bound on number of function names: */ symtab.len = 0; @@ -719,7 +720,7 @@ DEFUN (core_create_line_syms, (core_bfd), bfd * core_bfd) memcpy (ltab.limit, symtab.base, symtab.len * sizeof (Sym)); ltab.limit += symtab.len; - if (ltab.limit - ltab.base != ltab.len) + if ((unsigned int) (ltab.limit - ltab.base) != ltab.len) { fprintf (stderr, "%s: somebody miscounted: ltab.len=%d instead of %ld\n", diff --git a/gprof/hist.c b/gprof/hist.c index e87d846..094051a 100644 --- a/gprof/hist.c +++ b/gprof/hist.c @@ -281,7 +281,8 @@ DEFUN_VOID (hist_assign_samples) bfd_vma bin_low_pc, bin_high_pc; bfd_vma sym_low_pc, sym_high_pc; bfd_vma overlap, addr; - int bin_count, i, j; + int bin_count, i; + unsigned int j; double time, credit; /* read samples and assign to symbols: */ @@ -492,7 +493,8 @@ void DEFUN_VOID (hist_print) { Sym **time_sorted_syms, *top_dog, *sym; - int index, log_scale; + unsigned int index; + int log_scale; double top_time, time; bfd_vma addr; @@ -559,7 +561,8 @@ DEFUN_VOID (hist_print) { top_time /= hz; while (SItab[log_scale].scale * top_time < 1000.0 - && log_scale < sizeof (SItab) / sizeof (SItab[0]) - 1) + && ((size_t) log_scale + < sizeof (SItab) / sizeof (SItab[0]) - 1)) { ++log_scale; } diff --git a/gprof/sym_ids.c b/gprof/sym_ids.c index 9c809b6..24814e8 100644 --- a/gprof/sym_ids.c +++ b/gprof/sym_ids.c @@ -101,7 +101,7 @@ DEFUN (parse_spec, (spec, sym), char *spec AND Sym * sym) spec = colon + 1; if (strlen (spec)) { - if (isdigit (spec[0])) + if (isdigit ((unsigned char) spec[0])) { sym->line_num = atoi (spec); } @@ -122,7 +122,7 @@ DEFUN (parse_spec, (spec, sym), char *spec AND Sym * sym) sym->file = &non_existent_file; } } - else if (isdigit (*spec)) + else if (isdigit ((unsigned char) *spec)) { sym->line_num = atoi (spec); } diff --git a/gprof/symtab.c b/gprof/symtab.c index 0b6a4af..1ac61cc 100644 --- a/gprof/symtab.c +++ b/gprof/symtab.c @@ -150,7 +150,7 @@ DEFUN (symtab_finalize, (tab), Sym_Table * tab) tab->len = tab->limit - tab->base; DBG (AOUTDEBUG | IDDEBUG, - int j; + unsigned int j; for (j = 0; j < tab->len; ++j) { @@ -237,7 +237,7 @@ DEFUN (sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma address) else { DBG (LOOKUPDEBUG, - printf ("[sym_lookup] %d probes (symtab->len=%d)\n", + printf ("[sym_lookup] %d probes (symtab->len=%u)\n", probes, symtab->len - 1)); return &sym[mid]; } @@ -260,7 +260,7 @@ DEFUN (sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma address) } else { - DBG (LOOKUPDEBUG, printf ("[sym_lookup] %d (%d) probes, fall off\n", + DBG (LOOKUPDEBUG, printf ("[sym_lookup] %d (%u) probes, fall off\n", probes, symtab->len - 1)); return &sym[mid + 1]; } diff --git a/gprof/symtab.h b/gprof/symtab.h index f3b49a9..1ffbc6e 100644 --- a/gprof/symtab.h +++ b/gprof/symtab.h @@ -94,7 +94,7 @@ Sym; */ typedef struct { - int len; /* # of symbols in this table */ + unsigned int len; /* # of symbols in this table */ Sym *base; /* first element in symbol table */ Sym *limit; /* limit = base + len */ } diff --git a/gprof/tahoe.c b/gprof/tahoe.c index a9585df..3bcd3c5 100644 --- a/gprof/tahoe.c +++ b/gprof/tahoe.c @@ -202,11 +202,11 @@ tahoe_reladdr (modep) case byterel: return (bfd_vma) (cp + sizeof *cp + *cp); case wordrel: - for (i = 0; i < sizeof *sp; i++) + for (i = 0; (size_t) i < sizeof *sp; i++) value = (value << 8) + (cp[i] & 0xff); return (bfd_vma) (cp + sizeof *sp + value); case longrel: - for (i = 0; i < sizeof *lp; i++) + for (i = 0; (size_t) i < sizeof *lp; i++) value = (value << 8) + (cp[i] & 0xff); return (bfd_vma) (cp + sizeof *lp + value); } |