This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Clean up compiler warnings


I don't know who is supposed to approve such things these days, but
the enclosed patch cleans up some of the compiler warnings (there are
many left :-().

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_threshold
	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.

Index: bcache.c
===================================================================
RCS file: /cvs/src/src/gdb/bcache.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 bcache.c
--- bcache.c	1999/12/07 03:55:58	1.1.1.4
+++ bcache.c	2000/02/07 19:42:54
@@ -85,19 +85,18 @@
     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 @@
 
   /* 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 @@
 
   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 @@
 		   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: bcache.h
===================================================================
RCS file: /cvs/src/src/gdb/bcache.h,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 bcache.h
--- bcache.h	1999/12/07 03:55:58	1.1.1.4
+++ bcache.h	2000/02/07 19:42:54
@@ -95,14 +95,14 @@
   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: c-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/c-lang.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 c-lang.c
--- c-lang.c	2000/02/02 00:21:04	1.1.1.5
+++ c-lang.c	2000/02/07 19:42:54
@@ -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 @@
   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: c-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-valprint.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 c-valprint.c
--- c-valprint.c	2000/02/02 00:21:04	1.1.1.5
+++ c-valprint.c	2000/02/07 19:42:55
@@ -87,7 +87,7 @@
 	         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: ch-exp.c
===================================================================
RCS file: /cvs/src/src/gdb/ch-exp.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 ch-exp.c
--- ch-exp.c	1999/08/09 21:33:19	1.1.1.3
+++ ch-exp.c	2000/02/07 19:42:56
@@ -2192,8 +2192,8 @@
 	    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: ch-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ch-lang.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 ch-lang.c
--- ch-lang.c	2000/02/02 00:21:05	1.1.1.4
+++ ch-lang.c	2000/02/07 19:42:56
@@ -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 @@
   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: coffread.c
===================================================================
RCS file: /cvs/src/src/gdb/coffread.c,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 coffread.c
--- coffread.c	2000/01/11 03:07:19	1.1.1.11
+++ coffread.c	2000/02/07 19:42:58
@@ -219,7 +219,7 @@
 				  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_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 @@
 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: f-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/f-lang.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 f-lang.c
--- f-lang.c	2000/02/02 00:21:06	1.1.1.5
+++ f-lang.c	2000/02/07 19:42:59
@@ -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 @@
   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: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 findvar.c
--- findvar.c	2000/02/01 03:19:06	1.1.1.9
+++ findvar.c	2000/02/07 19:43:00
@@ -1006,7 +1006,7 @@
 #endif
 
 CORE_ADDR
-generic_target_read_pc (pid)
+generic_target_read_pc (int pid)
 {
 #ifdef PC_REGNUM
   if (PC_REGNUM >= 0)
Index: m2-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/m2-lang.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 m2-lang.c
--- m2-lang.c	2000/02/02 00:21:08	1.1.1.4
+++ m2-lang.c	2000/02/07 19:43:00
@@ -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 @@
   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: stabsread.c
===================================================================
RCS file: /cvs/src/src/gdb/stabsread.c,v
retrieving revision 1.1.1.10
diff -u -r1.1.1.10 stabsread.c
--- stabsread.c	1999/12/07 03:56:06	1.1.1.10
+++ stabsread.c	2000/02/07 19:43:05
@@ -294,7 +294,7 @@
 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: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 stack.c
--- stack.c	2000/02/03 04:14:35	1.1.1.9
+++ stack.c	2000/02/07 19:43:06
@@ -1204,7 +1204,7 @@
       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: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.1.1.13
diff -u -r1.1.1.13 symtab.c
--- symtab.c	2000/02/03 04:14:36	1.1.1.13
+++ symtab.c	2000/02/07 19:43:09
@@ -4512,7 +4512,6 @@
   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: valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 valprint.c
--- valprint.c	2000/02/02 00:21:11	1.1.1.6
+++ valprint.c	2000/02/07 19:43:11
@@ -684,7 +684,7 @@
 #define BITS_IN_BYTES 8
 
   unsigned char *p;
-  int i;
+  unsigned int i;
   int b;
 
   /* Declared "int" so it will be signed.
Index: valprint.h
===================================================================
RCS file: /cvs/src/src/gdb/valprint.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 valprint.h
--- valprint.h	2000/02/02 00:21:11	1.1.1.3
+++ valprint.h	2000/02/07 19:43:11
@@ -31,6 +31,11 @@
 
 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? */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]