]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix some gcc -Wall warnings:
authorIan Lance Taylor <ian@airs.com>
Sun, 29 Mar 1998 04:15:29 +0000 (04:15 +0000)
committerIan Lance Taylor <ian@airs.com>
Sun, 29 Mar 1998 04:15:29 +0000 (04:15 +0000)
* 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.

gprof/ChangeLog
gprof/cg_arcs.c
gprof/cg_arcs.h
gprof/cg_print.c
gprof/core.c
gprof/hist.c
gprof/sym_ids.c
gprof/symtab.c
gprof/symtab.h
gprof/tahoe.c

index 0139b1d1739b401ad00cfeb278721bb268effdc0..2ab71bb27a4329290892cb360916c2c02e72f9c1 100644 (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:
index f341a8f799a76d9595dfb76828f6d00995d7bde6..d14238decc330b439ed0db9685379d94e2d13f01 100644 (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;
 
   /*
index 132ee73667a67d8a8e5ffc0dc3a0aa2b4b5bfd75..b9c3a36cab6ac07aba0411fb3a4ca8dd71f1a922 100644 (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 */
index 093b9563e54079f202e96e7362c72d37452cd330..2a7bc83719cdb56766ef17dafbdbf2d3368c8051 100644 (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.  */
index 597355ed4a3cf43e493aa6683b7b8cc5251984db..22c89dca9a6ce0f3ff19e97aa56d3159c6a2ba8f 100644 (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",
index e87d846a462e26d9d1619856179c56b37f01f459..094051a5459028d4f84fa4beeb9095f9eb06681b 100644 (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;
            }
index 9c809b64cc41206c3d8cf6b4347e7f4c02bd5de4..24814e8a66ef77c88647519708ca9ba04a094609 100644 (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);
        }
index 0b6a4af9a5714c8ef2834d3581679a7ce44daeed..1ac61cc384a1a3062891c5bfa64f9e04689fbaab 100644 (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];
        }
index f3b49a933c63d37166625906e2d334ffd1378adc..1ffbc6e3a7da341b67a360416a8a334fcd57dfc8 100644 (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 */
   }
index a9585df2a73315ac901f94f292767933dca5be2f..3bcd3c571edaefab0f91075c499415fb962a8425 100644 (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);
     }