Clean up compiler warnings:
authorJim Kingdon <jkingdon@engr.sgi.com>
Tue, 8 Feb 2000 04:39:02 +0000 (04:39 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Tue, 8 Feb 2000 04:39:02 +0000 (04:39 +0000)
* bcache.h, bcache.c, c-valprint.c, coffread.c, stabsread.c,
stack.c, valprint.c: Change variables to unsigned.
* bcache.c: Rearrange to avoid warnings about variables not being set.
* c-lang.c, ch-lang.c, f-lang.c, m2-lang.c: Include valprint.h
rather than declaring print_max and repeat_count_threashold
ourselves (incorrectly).
* valprint.h: Do declare repeat_count_threashold.
* ch-exp.c: Use default case for internal error.
* findvar.c: Don't omit argument type.
* symtab.c: Remove unused variable.

16 files changed:
gdb/ChangeLog
gdb/bcache.c
gdb/bcache.h
gdb/c-lang.c
gdb/c-valprint.c
gdb/ch-exp.c
gdb/ch-lang.c
gdb/coffread.c
gdb/f-lang.c
gdb/findvar.c
gdb/m2-lang.c
gdb/stabsread.c
gdb/stack.c
gdb/symtab.c
gdb/valprint.c
gdb/valprint.h

index 2f28b00..8577064 100644 (file)
@@ -1,3 +1,17 @@
+2000-02-07  Jim Kingdon  <kingdon@redhat.com>
+
+       Clean up compiler warnings:
+       * bcache.h, bcache.c, c-valprint.c, coffread.c, stabsread.c,
+       stack.c, valprint.c: Change variables to unsigned.
+       * bcache.c: Rearrange to avoid warnings about variables not being set.
+       * c-lang.c, ch-lang.c, f-lang.c, m2-lang.c: Include valprint.h
+       rather than declaring print_max and repeat_count_threashold
+       ourselves (incorrectly).
+       * valprint.h: Do declare repeat_count_threashold.
+       * ch-exp.c: Use default case for internal error.
+       * findvar.c: Don't omit argument type.
+       * symtab.c: Remove unused variable.
+
 2000-02-04  Nick Clifton  <nickc@cygnus.com>
 
        * config/arm/tm-arm.h (LOWEST_PC): Define.
index 8ac3305..766aff9 100644 (file)
@@ -85,19 +85,18 @@ expand_hash_table (struct bcache *bcache)
     4194301, 8388617, 16777213, 33554467, 67108859, 134217757,
     268435459, 536870923, 1073741827, 2147483659UL
   };
-  int new_num_buckets;
+  unsigned int new_num_buckets;
   struct bstring **new_buckets;
-  int i;
+  unsigned int i;
 
   /* Find the next size.  */
+  new_num_buckets = bcache->num_buckets * 2;
   for (i = 0; i < (sizeof (sizes) / sizeof (sizes[0])); i++)
     if (sizes[i] > bcache->num_buckets)
       {
        new_num_buckets = sizes[i];
        break;
       }
-  if (i >= (sizeof (sizes) / sizeof (sizes[0])))
-    new_num_buckets = bcache->num_buckets * 2;
 
   /* Allocate the new table.  */
   {
@@ -233,7 +232,7 @@ print_bcache_statistics (struct bcache *c, char *type)
 
   /* Count the number of occupied buckets, and measure chain lengths.  */
   {
-    int b;
+    unsigned int b;
     int *chain_length
       = (int *) alloca (c->num_buckets * sizeof (*chain_length));
 
@@ -275,7 +274,7 @@ print_bcache_statistics (struct bcache *c, char *type)
 
   printf_filtered ("  Cached '%s' statistics:\n", type);
   printf_filtered ("    Total object count:  %ld\n", c->total_count);
-  printf_filtered ("    Unique object count: %ld\n", c->unique_count);
+  printf_filtered ("    Unique object count: %lu\n", c->unique_count);
   printf_filtered ("    Percentage of duplicates, by count: ");
   print_percentage (c->total_count - c->unique_count, c->total_count);
   printf_filtered ("\n");
@@ -301,7 +300,7 @@ print_bcache_statistics (struct bcache *c, char *type)
                   median_chain_length);
   printf_filtered ("    Average hash chain length: ");
   if (c->num_buckets > 0)
-    printf_filtered ("%3ld\n", c->unique_count / c->num_buckets);
+    printf_filtered ("%3lu\n", c->unique_count / c->num_buckets);
   else
     printf_filtered ("(not applicable)\n");
   printf_filtered ("    Maximum hash chain length: %3d\n", max_chain_length);
index 1350bea..4735af7 100644 (file)
@@ -95,14 +95,14 @@ struct bcache {
   struct obstack cache;
 
   /* How many hash buckets we're using.  */
-  int num_buckets;
+  unsigned int num_buckets;
   
   /* Hash buckets.  This table is allocated using malloc, so when we
      grow the table we can return the old table to the system.  */
   struct bstring **bucket;
 
   /* Statistics.  */
-  long unique_count;   /* number of unique strings */
+  unsigned long unique_count;  /* number of unique strings */
   long total_count;    /* total number of strings cached, including dups */
   long unique_size;    /* size of unique strings, in bytes */
   long total_size;      /* total number of bytes cached, including dups */
index 35f86a8..2211acb 100644 (file)
@@ -25,6 +25,7 @@
 #include "parser-defs.h"
 #include "language.h"
 #include "c-lang.h"
+#include "valprint.h"
 
 extern void _initialize_c_language PARAMS ((void));
 static void c_emit_char (int c, struct ui_file * stream, int quoter);
@@ -110,8 +111,6 @@ c_printstr (stream, string, length, width, force_ellipses)
   int in_quotes = 0;
   int need_comma = 0;
   extern int inspect_it;
-  extern int repeat_count_threshold;
-  extern int print_max;
 
   /* If the string was not truncated due to `set print elements', and
      the last byte of it is a null, we don't print that, in traditional C
index 10bcda7..07289de 100644 (file)
@@ -87,7 +87,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
                 elements up to it.  */
              if (stop_print_at_null)
                {
-                 int temp_len;
+                 unsigned int temp_len;
 
                  /* Look for a NULL char. */
                  for (temp_len = 0;
index 1b22e25..7892475 100644 (file)
@@ -2192,8 +2192,8 @@ ch_lex ()
            case LOC_OPTIMIZED_OUT:
              error ("Symbol \"%s\" names no location.", inputname);
              break;
-           case LOC_UNRESOLVED:
-             error ("unhandled SYMBOL_CLASS in ch_lex()");
+           default:
+             internal_error ("unhandled SYMBOL_CLASS in ch_lex()");
              break;
            }
        }
index d56a2dc..cf63257 100644 (file)
@@ -26,6 +26,7 @@
 #include "parser-defs.h"
 #include "language.h"
 #include "ch-lang.h"
+#include "valprint.h"
 
 extern void _initialize_chill_language PARAMS ((void));
 
@@ -127,8 +128,6 @@ chill_printstr (stream, string, length, width, force_ellipses)
   int in_control_form = 0;
   int need_slashslash = 0;
   unsigned int c;
-  extern int repeat_count_threshold;
-  extern int print_max;
 
   if (length == 0)
     {
index 4fb426c..b3c191b 100644 (file)
@@ -219,7 +219,7 @@ static void read_one_sym PARAMS ((struct coff_symbol *,
                                  struct internal_syment *,
                                  union internal_auxent *));
 
-static void coff_symtab_read PARAMS ((long, int, struct objfile *));
+static void coff_symtab_read PARAMS ((long, unsigned int, struct objfile *));
 
 static void find_linenos PARAMS ((bfd *, sec_ptr, PTR));
 
@@ -605,7 +605,7 @@ coff_symfile_read (objfile, mainline)
   coff_data_type *cdata = coff_data (abfd);
   char *name = bfd_get_filename (abfd);
   register int val;
-  int num_symbols;
+  unsigned int num_symbols;
   int symtab_offset;
   int stringtab_offset;
   struct cleanup *back_to;
@@ -755,7 +755,7 @@ coff_symfile_finish (objfile)
 static void
 coff_symtab_read (symtab_offset, nsyms, objfile)
      long symtab_offset;
-     int nsyms;
+     unsigned int nsyms;
      struct objfile *objfile;
 {
   register struct context_stack *new;
index ddcefd0..53d92ec 100644 (file)
@@ -28,6 +28,7 @@
 #include "parser-defs.h"
 #include "language.h"
 #include "f-lang.h"
+#include "valprint.h"
 
 /* The built-in types of F77.  FIXME: integer*4 is missing, plain
    logical is missing (builtin_type_logical is logical*4).  */
@@ -175,8 +176,6 @@ f_printstr (stream, string, length, width, force_ellipses)
   int in_quotes = 0;
   int need_comma = 0;
   extern int inspect_it;
-  extern int repeat_count_threshold;
-  extern int print_max;
 
   if (length == 0)
     {
index 4a5a3a0..9c8e313 100644 (file)
@@ -1006,7 +1006,7 @@ supply_register (regno, val)
 #endif
 
 CORE_ADDR
-generic_target_read_pc (pid)
+generic_target_read_pc (int pid)
 {
 #ifdef PC_REGNUM
   if (PC_REGNUM >= 0)
index e1136a7..64e07cc 100644 (file)
@@ -26,6 +26,7 @@
 #include "language.h"
 #include "m2-lang.h"
 #include "c-lang.h"
+#include "valprint.h"
 
 extern void _initialize_m2_language PARAMS ((void));
 static struct type *m2_create_fundamental_type PARAMS ((struct objfile *, int));
@@ -124,8 +125,6 @@ m2_printstr (stream, string, length, width, force_ellipses)
   int in_quotes = 0;
   int need_comma = 0;
   extern int inspect_it;
-  extern int repeat_count_threshold;
-  extern int print_max;
 
   if (length == 0)
     {
index 464fce1..48eef62 100644 (file)
@@ -294,7 +294,7 @@ static void
 os9k_init_type_vector (tv)
      struct type **tv;
 {
-  int i;
+  unsigned int i;
   for (i = 0; i < sizeof (os9k_type_vector) / sizeof (struct type **); i++)
     tv[i] = (os9k_type_vector[i] == 0 ? 0 : *(os9k_type_vector[i]));
 }
index f0cae6e..c586f45 100644 (file)
@@ -1204,7 +1204,7 @@ backtrace_command (arg, from_tty)
       argc = 0;
       for (i = 0; (argv[i] != (char *) NULL); i++)
        {
-         int j;
+         unsigned int j;
 
          for (j = 0; (j < strlen (argv[i])); j++)
            argv[i][j] = tolower (argv[i][j]);
index ceaa108..62857b3 100644 (file)
@@ -4512,7 +4512,6 @@ make_symbol_overload_list (fsym)
   register struct symtab *s;
   register struct partial_symtab *ps;
   register struct objfile *objfile;
-  register struct minimal_symbol *msymbol;
   register struct block *b, *surrounding_static_block = 0;
   register int i;
   /* The name we are completing on. */
index cc1432b..e141479 100644 (file)
@@ -684,7 +684,7 @@ print_binary_chars (stream, valaddr, len)
 #define BITS_IN_BYTES 8
 
   unsigned char *p;
-  int i;
+  unsigned int i;
   int b;
 
   /* Declared "int" so it will be signed.
index a6a3cfa..5bea657 100644 (file)
@@ -31,6 +31,11 @@ extern int objectprint;              /* Controls looking up an object's derived type
 
 extern unsigned int print_max; /* Max # of chars for strings/vectors */
 
+/* Print repeat counts if there are more than this many repetitions of an
+   element in an array.  Referenced by the low level language dependent
+   print routines. */
+extern unsigned int repeat_count_threshold;
+
 extern int output_format;
 
 extern int stop_print_at_null; /* Stop printing at null char? */