From 745b8ca0fc4d987837a24d1ed5f53006478d2716 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Tue, 8 Feb 2000 04:39:02 +0000 Subject: [PATCH] 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. --- gdb/ChangeLog | 14 ++++++++++++++ gdb/bcache.c | 13 ++++++------- gdb/bcache.h | 4 ++-- gdb/c-lang.c | 3 +-- gdb/c-valprint.c | 2 +- gdb/ch-exp.c | 4 ++-- gdb/ch-lang.c | 3 +-- gdb/coffread.c | 6 +++--- gdb/f-lang.c | 3 +-- gdb/findvar.c | 2 +- gdb/m2-lang.c | 3 +-- gdb/stabsread.c | 2 +- gdb/stack.c | 2 +- gdb/symtab.c | 1 - gdb/valprint.c | 2 +- gdb/valprint.h | 5 +++++ 16 files changed, 41 insertions(+), 28 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2f28b00c89..85770640ee 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2000-02-07 Jim Kingdon + + 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 * config/arm/tm-arm.h (LOWEST_PC): Define. diff --git a/gdb/bcache.c b/gdb/bcache.c index 8ac330583e..766aff9c3b 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -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); diff --git a/gdb/bcache.h b/gdb/bcache.h index 1350bea66a..4735af71cd 100644 --- a/gdb/bcache.h +++ b/gdb/bcache.h @@ -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 */ diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 35f86a8939..2211acb2e0 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -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 diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 10bcda7eb8..07289de0a9 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -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; diff --git a/gdb/ch-exp.c b/gdb/ch-exp.c index 1b22e257b9..78924756ef 100644 --- a/gdb/ch-exp.c +++ b/gdb/ch-exp.c @@ -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; } } diff --git a/gdb/ch-lang.c b/gdb/ch-lang.c index d56a2dcb20..cf6325755b 100644 --- a/gdb/ch-lang.c +++ b/gdb/ch-lang.c @@ -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) { diff --git a/gdb/coffread.c b/gdb/coffread.c index 4fb426c343..b3c191b7b3 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -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; diff --git a/gdb/f-lang.c b/gdb/f-lang.c index ddcefd0c53..53d92ec150 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -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) { diff --git a/gdb/findvar.c b/gdb/findvar.c index 4a5a3a0d27..9c8e313ab5 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -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) diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index e1136a7de3..64e07cca44 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -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) { diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 464fce1701..48eef6236c 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -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])); } diff --git a/gdb/stack.c b/gdb/stack.c index f0cae6e14e..c586f4573d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -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]); diff --git a/gdb/symtab.c b/gdb/symtab.c index ceaa108e0b..62857b332a 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -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. */ diff --git a/gdb/valprint.c b/gdb/valprint.c index cc1432be97..e1414792b7 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -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. diff --git a/gdb/valprint.h b/gdb/valprint.h index a6a3cfa7dc..5bea657b20 100644 --- a/gdb/valprint.h +++ b/gdb/valprint.h @@ -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? */ -- 2.34.1