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.
This commit is contained in:
Ian Lance Taylor 1998-03-29 04:15:29 +00:00
parent c246596af7
commit 6b84886ad5
10 changed files with 55 additions and 24 deletions

View File

@ -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:

View File

@ -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;
/*

View File

@ -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 */

View File

@ -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. */

View File

@ -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",

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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];
}

View File

@ -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 */
}

View File

@ -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);
}