From 996ccb3043d9237ea8e6e79d6a7c6121b15f9e61 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Thu, 2 Sep 1993 01:41:40 +0000 Subject: [PATCH] * symtab.c, symfile.c, c-exp.y, ch-exp.y, m2-exp.y, buildsym.c, symfile.h, stabsread.c, minsyms.c, solib.c, nlmread.c, dwarfread.c partial-stab.h, symmisc.c, gdbtypes.c: Lint. Remove (or put inside #if) unused variables and labels. Fix unclosed comment. Deal with enumeration values unhandled in switch statements. Make sure non-void functions return values. Include appropriate headers. * dbxread.c (elfstab_build_psymtabs): Don't check for unsigned value < 0. --- gdb/ChangeLog | 12 ++++++++++++ gdb/buildsym.c | 4 ++-- gdb/c-exp.y | 1 + gdb/ch-exp.y | 2 +- gdb/dbxread.c | 4 +--- gdb/dwarfread.c | 1 - gdb/gdbtypes.c | 2 ++ gdb/m2-exp.y | 3 +++ gdb/minsyms.c | 1 - gdb/nlmread.c | 1 - gdb/partial-stab.h | 2 ++ gdb/stabsread.c | 9 ++------- gdb/symfile.c | 4 ++-- gdb/symmisc.c | 6 ++++-- gdb/symtab.c | 3 --- 15 files changed, 32 insertions(+), 23 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6f181d22c80..1d6a856d674 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +Wed Sep 1 19:31:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * symtab.c, symfile.c, c-exp.y, ch-exp.y, m2-exp.y, buildsym.c, + symfile.h, stabsread.c, minsyms.c, solib.c, nlmread.c, dwarfread.c + partial-stab.h, symmisc.c, gdbtypes.c: Lint. Remove (or put + inside #if) unused variables and labels. Fix unclosed comment. + Deal with enumeration values unhandled in switch statements. Make + sure non-void functions return values. Include appropriate + headers. + * dbxread.c (elfstab_build_psymtabs): Don't check for unsigned + value < 0. + Wed Sep 1 14:36:00 1993 K. Richard Pixley (rich@sendai.cygnus.com) * i960-tdep.c, ns32k-pinsn.c, remote-adapt.c, xcoffread.c: diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 4ba512f998e..48b1a823742 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -432,8 +432,8 @@ start_subfile (name, dirname) p = strrchr (subfile->name, '.'); if (p != NULL - && (p[1] == 'C' && p[2] == '\0' - || p[1] == 'c' && p[2] == 'c' && p[3] == '\0')) + && ((p[1] == 'C' && p[2] == '\0') + || (p[1] == 'c' && p[2] == 'c' && p[3] == '\0'))) for (s = subfiles; s != NULL; s = s->next) if (s->language == language_c) s->language = language_cplus; diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 0b19ed5f163..edfa63ef70a 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -665,6 +665,7 @@ variable: name_not_typename case LOC_ARG: case LOC_REF_ARG: case LOC_REGPARM: + case LOC_REGPARM_ADDR: case LOC_LOCAL: case LOC_LOCAL_ARG: case LOC_BASEREG: diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y index 895113329e3..b6370f3241f 100644 --- a/gdb/ch-exp.y +++ b/gdb/ch-exp.y @@ -1214,7 +1214,6 @@ match_float_literal () char *tokptr = lexptr; char *buf; char *copy; - char ch; double dval; extern double strtod (); @@ -1929,6 +1928,7 @@ yylex () case LOC_ARG: case LOC_REF_ARG: case LOC_REGPARM: + case LOC_REGPARM_ADDR: case LOC_LOCAL: case LOC_LOCAL_ARG: case LOC_BASEREG: diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 42bd4b4ceda..e50cd049493 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1356,7 +1356,6 @@ read_ofile_symtab (pst) unsigned char type; unsigned max_symnum; register bfd *abfd; - struct symtab *rtn; struct objfile *objfile; int sym_offset; /* Offset to start of symbols to read */ int sym_size; /* Size of symbols to read */ @@ -2077,8 +2076,7 @@ elfstab_build_psymtabs (objfile, section_offsets, mainline, DBX_STRINGTAB_SIZE (objfile) = stabstrsize; DBX_SYMTAB_OFFSET (objfile) = staboffset; - if (stabstrsize < 0 /* FIXME: stabstrsize is unsigned; never true! */ - || stabstrsize > bfd_get_size (sym_bfd)) + if (stabstrsize > bfd_get_size (sym_bfd)) error ("ridiculous string table size: %d bytes", stabstrsize); DBX_STRINGTAB (objfile) = (char *) obstack_alloc (&objfile->psymbol_obstack, stabstrsize+1); diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 076f1759908..3cad3def735 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -2171,7 +2171,6 @@ locval (loc) auto long stack[64]; int stacki; char *end; - long regno; int loc_atom_code; int loc_value_size; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index b2d004707df..cdd7343608e 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -684,7 +684,9 @@ lookup_struct_elt_type (type, name, noerr) int noerr; { int i; +#if 0 char *typename; +#endif if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF) diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 1d7e80116f8..13b93a0f0df 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -606,6 +606,7 @@ variable: NAME case LOC_LOCAL: case LOC_REF_ARG: case LOC_REGPARM: + case LOC_REGPARM_ADDR: case LOC_LOCAL_ARG: case LOC_BASEREG: case LOC_BASEREG_ARG: @@ -1119,12 +1120,14 @@ yylex () case LOC_ARG: case LOC_REF_ARG: case LOC_REGPARM: + case LOC_REGPARM_ADDR: case LOC_LOCAL: case LOC_LOCAL_ARG: case LOC_BASEREG: case LOC_BASEREG_ARG: case LOC_CONST: case LOC_CONST_BYTES: + case LOC_OPTIMIZED_OUT: return NAME; case LOC_TYPEDEF: diff --git a/gdb/minsyms.c b/gdb/minsyms.c index d8488f221cf..3665380f27b 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -490,7 +490,6 @@ install_minimal_symbols (objfile) register struct minimal_symbol *msymbols; int alloc_count; register char leading_char; - char *demangled_name; if (msym_count > 0) { diff --git a/gdb/nlmread.c b/gdb/nlmread.c index 54e91aa8171..fde3af24932 100644 --- a/gdb/nlmread.c +++ b/gdb/nlmread.c @@ -121,7 +121,6 @@ nlm_symtab_read (abfd, addr, objfile) asymbol **symbol_table; unsigned int number_of_symbols; unsigned int i; - int index; struct cleanup *back_to; CORE_ADDR symaddr; enum minimal_symbol_type ms_type; diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h index 35d0193742c..e511599b641 100644 --- a/gdb/partial-stab.h +++ b/gdb/partial-stab.h @@ -286,7 +286,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ continue; } +#ifdef DBXREAD_ONLY record_include_file: +#endif psymtab_include_list[includes_used++] = namestring; if (includes_used >= includes_allocated) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 2a5b972377b..1841a76793d 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1275,11 +1275,7 @@ read_type (pp, objfile) /* Name including "struct", etc. */ char *type_name; - /* Name without "struct", etc. */ - char *type_name_only; - { - char *prefix; char *from, *to; /* Set the type code according to the following letter. */ @@ -2005,7 +2001,6 @@ read_cpp_abbrev (fip, pp, type, objfile) struct objfile *objfile; { register char *p; - const char *prefix; char *name; char cpp_abbrev; struct type *context; @@ -3112,7 +3107,7 @@ read_huge_number (pp, end, bits) { if (bits != NULL) *bits = -1; - return; + return 0; } } else @@ -3127,7 +3122,7 @@ read_huge_number (pp, end, bits) count how many bits are in them). */ if (bits != NULL) *bits = -1; - return; + return 0; } /* -0x7f is the same as 0x80. So deal with it by adding one to diff --git a/gdb/symfile.c b/gdb/symfile.c index 72c6efa22b1..d68ac203432 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1169,8 +1169,8 @@ clear_symtab_users () discarded if symbol reading is successful. */ #if 0 - /* FIXME: As free_named_symtabs is currently a big noop this function - is no longer needed. +/* FIXME: As free_named_symtabs is currently a big noop this function + is no longer needed. */ static void clear_symtab_users_once PARAMS ((void)); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index fec7120f30f..f81fcdc40fd 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -437,7 +437,8 @@ maintenance_print_symbols (args, from_tty) /* Print symbol ARGS->SYMBOL on ARGS->OUTFILE. ARGS->DEPTH says how far to indent. ARGS is really a struct print_symbol_args *, but is - declared as char * to get it past catch_errors. */ + declared as char * to get it past catch_errors. Returns 0 for error, + 1 for success. */ static int print_symbol (args) @@ -452,7 +453,7 @@ print_symbol (args) { fprintf (outfile, "label %s at 0x%x\n", SYMBOL_SOURCE_NAME (symbol), SYMBOL_VALUE_ADDRESS (symbol)); - return; + return 1; } if (SYMBOL_NAMESPACE (symbol) == STRUCT_NAMESPACE) { @@ -573,6 +574,7 @@ print_symbol (args) } } fprintf (outfile, "\n"); + return 1; } void diff --git a/gdb/symtab.c b/gdb/symtab.c index 6830be4750b..9765e0bbae7 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -436,8 +436,6 @@ lookup_symbol (name, block, namespace, is_a_field_of_this, symtab) register struct objfile *objfile; register struct block *b; register struct minimal_symbol *msymbol; - char *temp; - extern char *gdb_completer_word_break_characters; /* Search specified block and its superiors. */ @@ -1964,7 +1962,6 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) if ((copy[0] == copy [p - *argptr - 1]) && strchr (gdb_completer_quote_characters, copy[0]) != NULL) { - char *temp; copy [p - *argptr - 1] = '\0'; copy++; } -- 2.30.2