From 12b9c64f8d77af4c1d938e2a3e278b9ee41ca19f Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Tue, 19 Mar 2002 19:00:04 +0000 Subject: [PATCH] * coffread.c: Remove redundant static declarations. Replace occurrences of `PTR' with `void *'. * elfread.c, mdebugread.c, minsyms.c, mipsread.c: Likewise. * top.h (quit_cover): Likewise. * defs.h (catch_errors): Likewise. --- gdb/ChangeLog | 8 ++++++ gdb/coffread.c | 43 +++++---------------------- gdb/defs.h | 2 +- gdb/elfread.c | 37 ++++++------------------ gdb/mdebugread.c | 75 +++++++++++++++++------------------------------- gdb/minsyms.c | 12 +------- gdb/mipsread.c | 6 ++-- gdb/top.h | 2 +- 8 files changed, 54 insertions(+), 131 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index da160458504..8bcab443efb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2002-03-19 Alexandre Oliva + + * coffread.c: Remove redundant static declarations. Replace + occurrences of `PTR' with `void *'. + * elfread.c, mdebugread.c, minsyms.c, mipsread.c: Likewise. + * top.h (quit_cover): Likewise. + * defs.h (catch_errors): Likewise. + 2002-03-18 Andrew Cagney * defs.h (XMALLOC): Define. diff --git a/gdb/coffread.c b/gdb/coffread.c index 97ca2e942c7..84b3761cf55 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -192,8 +192,6 @@ static struct symbol *process_coff_symbol (struct coff_symbol *, static void patch_opaque_types (struct symtab *); -static void patch_type (struct type *, struct type *); - static void enter_linenos (long, int, int, struct objfile *); static void free_linetab (void); @@ -216,32 +214,6 @@ static void read_one_sym (struct coff_symbol *, struct internal_syment *, union internal_auxent *); static void coff_symtab_read (long, unsigned int, struct objfile *); - -static void find_linenos (bfd *, sec_ptr, PTR); - -static void coff_symfile_init (struct objfile *); - -static void coff_new_init (struct objfile *); - -static void coff_symfile_read (struct objfile *, int); - -static void coff_symfile_finish (struct objfile *); - -static void record_minimal_symbol (char *, CORE_ADDR, - enum minimal_symbol_type, - struct objfile *); - -static void coff_end_symtab (struct objfile *); - -static void complete_symtab (char *, CORE_ADDR, unsigned int); - -static void coff_start_symtab (char *); - -static struct type *coff_alloc_type (int); - -static struct type **coff_lookup_type (int); - -static void coff_locate_sections (bfd *, asection *, PTR); /* We are called once per section from coff_symfile_read. We need to examine each section we are passed, check to see @@ -254,7 +226,7 @@ static void coff_locate_sections (bfd *, asection *, PTR); -kingdon). */ static void -coff_locate_sections (bfd *abfd, asection *sectp, PTR csip) +coff_locate_sections (bfd *abfd, asection *sectp, void *csip) { register struct coff_symfile_info *csi; const char *name; @@ -312,10 +284,8 @@ struct find_targ_sec_arg asection **resultp; }; -static void find_targ_sec (bfd *, asection *, PTR); - static void -find_targ_sec (bfd *abfd, asection *sect, PTR obj) +find_targ_sec (bfd *abfd, asection *sect, void *obj) { struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj; if (sect->target_index == args->targ_index) @@ -509,7 +479,8 @@ coff_symfile_init (struct objfile *objfile) objfile->sym_stab_info = (struct dbx_symfile_info *) xmmalloc (objfile->md, sizeof (struct dbx_symfile_info)); - memset ((PTR) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info)); + memset (objfile->sym_stab_info, 0, + sizeof (struct dbx_symfile_info)); /* Allocate struct to keep track of the symfile */ objfile->sym_private = xmmalloc (objfile->md, @@ -531,7 +502,7 @@ coff_symfile_init (struct objfile *objfile) /* ARGSUSED */ static void -find_linenos (bfd *abfd, sec_ptr asect, PTR vpinfo) +find_linenos (bfd *abfd, sec_ptr asect, void *vpinfo) { struct coff_symfile_info *info; int size, count; @@ -625,7 +596,7 @@ coff_symfile_read (struct objfile *objfile, int mainline) /* Read the line number table, all at once. */ info->min_lineno_offset = 0; info->max_lineno_offset = 0; - bfd_map_over_sections (abfd, find_linenos, (PTR) info); + bfd_map_over_sections (abfd, find_linenos, (void *) info); make_cleanup (free_linetab_cleanup, 0 /*ignore*/); val = init_lineno (abfd, info->min_lineno_offset, @@ -662,7 +633,7 @@ coff_symfile_read (struct objfile *objfile, int mainline) install_minimal_symbols (objfile); - bfd_map_over_sections (abfd, coff_locate_sections, (PTR) info); + bfd_map_over_sections (abfd, coff_locate_sections, (void *) info); if (info->stabsects) { diff --git a/gdb/defs.h b/gdb/defs.h index 455eb661e15..a3ee3348ab9 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -953,7 +953,7 @@ extern int catch_exceptions (struct ui_out *uiout, This function is superseeded by catch_exceptions(). */ typedef int (catch_errors_ftype) (PTR); -extern int catch_errors (catch_errors_ftype *, PTR, char *, return_mask); +extern int catch_errors (catch_errors_ftype *, void *, char *, return_mask); /* Template to catch_errors() that wraps calls to command functions. */ diff --git a/gdb/elfread.c b/gdb/elfread.c index 4615cb1b9e6..e76cd0d4a35 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -66,29 +66,7 @@ struct complaint stab_info_mismatch_complaint = struct complaint stab_info_questionable_complaint = {"elf/stab section information questionable for %s", 0, 0}; -static void elf_symfile_init (struct objfile *); - -static void elf_new_init (struct objfile *); - -static void elf_symfile_read (struct objfile *, int); - -static void elf_symfile_finish (struct objfile *); - -static void elf_symtab_read (struct objfile *, int); - -static void free_elfinfo (PTR); - -static struct minimal_symbol *record_minimal_symbol_and_info (char *, - CORE_ADDR, - enum - minimal_symbol_type, - char *, - asection * - bfd_section, - struct objfile - *); - -static void elf_locate_sections (bfd *, asection *, PTR); +static void free_elfinfo (void *); /* We are called once per section from elf_symfile_read. We need to examine each section we are passed, check to see @@ -110,7 +88,7 @@ static void elf_locate_sections (bfd *, asection *, PTR); -kingdon). */ static void -elf_locate_sections (bfd *ignore_abfd, asection *sectp, PTR eip) +elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip) { register struct elfinfo *ei; @@ -443,7 +421,8 @@ elf_symtab_read (struct objfile *objfile, int dynamic) { sectinfo = (struct stab_section_info *) xmmalloc (objfile->md, sizeof (*sectinfo)); - memset ((PTR) sectinfo, 0, sizeof (*sectinfo)); + memset (sectinfo, 0, + sizeof (*sectinfo)); if (filesym == NULL) { complain (§ion_info_complaint, @@ -511,7 +490,7 @@ elf_symtab_read (struct objfile *objfile, int dynamic) size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size; msym = record_minimal_symbol_and_info ((char *) sym->name, symaddr, - ms_type, (PTR) size, sym->section, objfile); + ms_type, (void *) size, sym->section, objfile); #ifdef SOFUN_ADDRESS_MAYBE_MISSING if (msym != NULL) msym->filename = filesymname; @@ -572,7 +551,7 @@ elf_symfile_read (struct objfile *objfile, int mainline) objfile->sym_stab_info = (struct dbx_symfile_info *) xmmalloc (objfile->md, sizeof (struct dbx_symfile_info)); memset ((char *) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info)); - make_cleanup (free_elfinfo, (PTR) objfile); + make_cleanup (free_elfinfo, (void *) objfile); /* Process the normal ELF symbol table first. This may write some chain of info into the dbx_symfile_info in objfile->sym_stab_info, @@ -597,7 +576,7 @@ elf_symfile_read (struct objfile *objfile, int mainline) } /* We first have to find them... */ - bfd_map_over_sections (abfd, elf_locate_sections, (PTR) & ei); + bfd_map_over_sections (abfd, elf_locate_sections, (void *) & ei); /* ELF debugging information is inserted into the psymtab in the order of least informative first - most informative last. Since @@ -667,7 +646,7 @@ elf_symfile_read (struct objfile *objfile, int mainline) stab_section_info's, that might be dangling from it. */ static void -free_elfinfo (PTR objp) +free_elfinfo (void *objp) { struct objfile *objfile = (struct objfile *) objp; struct dbx_symfile_info *dbxinfo = objfile->sym_stab_info; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 629fa9a3264..1bc9eef786e 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -327,30 +327,15 @@ static int found_ecoff_debugging_info; /* Forward declarations */ -static void add_pending (FDR *, char *, struct type *); - -static struct mdebug_pending *is_pending_symbol (FDR *, char *); - -static void pop_parse_stack (void); - -static void push_parse_stack (void); - -static char *fdr_name (FDR *); - -static void mdebug_psymtab_to_symtab (struct partial_symtab *); - -static int -upgrade_type (int, struct type **, int, union aux_ext *, int, char *); +static int upgrade_type (int, struct type **, int, union aux_ext *, + int, char *); static void parse_partial_symbols (struct objfile *); -static FDR * get_rfd (int, int); - static int has_opaque_xref (FDR *, SYMR *); -static int -cross_ref (int, union aux_ext *, struct type **, enum type_code, - char **, int, char *); +static int cross_ref (int, union aux_ext *, struct type **, enum type_code, + char **, int, char *); static struct symbol *new_symbol (char *); @@ -364,10 +349,6 @@ static struct linetable *new_linetable (int); static struct blockvector *new_bvect (int); -static int -parse_symbol (SYMR *, union aux_ext *, char *, int, struct section_offsets *, - struct objfile *); - static struct type *parse_type (int, union aux_ext *, unsigned int, int *, int, char *); @@ -376,12 +357,8 @@ static struct symbol *mylookup_symbol (char *, struct block *, namespace_enum, static struct block *shrink_block (struct block *, struct symtab *); -static PTR xzalloc (unsigned int); - static void sort_blocks (struct symtab *); -static int compare_blocks (const PTR, const PTR); - static struct partial_symtab *new_psymtab (char *, struct objfile *); static void psymtab_to_symtab_1 (struct partial_symtab *, char *); @@ -394,8 +371,8 @@ static int add_line (struct linetable *, int, CORE_ADDR, int); static struct linetable *shrink_linetable (struct linetable *); -static void -handle_psymbol_enumerators (struct objfile *, FDR *, int, CORE_ADDR); +static void handle_psymbol_enumerators (struct objfile *, FDR *, int, + CORE_ADDR); static char *mdebug_next_symbol_text (struct objfile *); @@ -405,10 +382,10 @@ CORE_ADDR sigtramp_address, sigtramp_end; /* Allocate zeroed memory */ -static PTR +static void * xzalloc (unsigned int size) { - PTR p = xmalloc (size); + void *p = xmalloc (size); memset (p, 0, size); return p; @@ -698,7 +675,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, struct section_offsets *section_offsets, struct objfile *objfile) { const bfd_size_type external_sym_size = debug_swap->external_sym_size; - void (*const swap_sym_in) (bfd *, PTR, SYMR *) = debug_swap->swap_sym_in; + void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in; char *name; struct symbol *s; struct block *b; @@ -1137,7 +1114,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, enum_sym = ((struct symbol *) obstack_alloc (¤t_objfile->symbol_obstack, sizeof (struct symbol))); - memset ((PTR) enum_sym, 0, sizeof (struct symbol)); + memset (enum_sym, 0, sizeof (struct symbol)); SYMBOL_NAME (enum_sym) = obsavestring (f->name, strlen (f->name), ¤t_objfile->symbol_obstack); @@ -1235,7 +1212,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, e = ((struct mips_extra_func_info *) obstack_alloc (¤t_objfile->symbol_obstack, sizeof (struct mips_extra_func_info))); - memset ((PTR) e, 0, sizeof (struct mips_extra_func_info)); + memset (e, 0, sizeof (struct mips_extra_func_info)); SYMBOL_VALUE (s) = (long) e; e->numargs = top_stack->numargs; e->pdr.framereg = -1; @@ -2230,9 +2207,9 @@ parse_partial_symbols (struct objfile *objfile) const bfd_size_type external_sym_size = debug_swap->external_sym_size; const bfd_size_type external_rfd_size = debug_swap->external_rfd_size; const bfd_size_type external_ext_size = debug_swap->external_ext_size; - void (*const swap_ext_in) (bfd *, PTR, EXTR *) = debug_swap->swap_ext_in; - void (*const swap_sym_in) (bfd *, PTR, SYMR *) = debug_swap->swap_sym_in; - void (*const swap_rfd_in) (bfd *, PTR, RFDT *) = debug_swap->swap_rfd_in; + void (*const swap_ext_in) (bfd *, void *, EXTR *) = debug_swap->swap_ext_in; + void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in; + void (*const swap_rfd_in) (bfd *, void *, RFDT *) = debug_swap->swap_rfd_in; int f_idx, s_idx; HDRR *hdr = &debug_info->symbolic_header; /* Running pointers */ @@ -2319,7 +2296,7 @@ parse_partial_symbols (struct objfile *objfile) ((struct mdebug_pending **) obstack_alloc (&objfile->psymbol_obstack, hdr->ifdMax * sizeof (struct mdebug_pending *))); - memset ((PTR) pending_list, 0, + memset (pending_list, 0, hdr->ifdMax * sizeof (struct mdebug_pending *)); /* Pass 0 over external syms: swap them in. */ @@ -2522,7 +2499,7 @@ parse_partial_symbols (struct objfile *objfile) pst->read_symtab_private = ((char *) obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc))); - memset ((PTR) pst->read_symtab_private, 0, sizeof (struct symloc)); + memset (pst->read_symtab_private, 0, sizeof (struct symloc)); save_pst = pst; TEXTLOW (pst) = pst->textlow; @@ -3673,7 +3650,7 @@ handle_psymbol_enumerators (struct objfile *objfile, FDR *fh, int stype, CORE_ADDR svalue) { const bfd_size_type external_sym_size = debug_swap->external_sym_size; - void (*const swap_sym_in) (bfd *, PTR, SYMR *) = debug_swap->swap_sym_in; + void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in; char *ext_sym = ((char *) debug_info->external_sym + ((fh->isymBase + cur_sdx + 1) * external_sym_size)); SYMR sh; @@ -3764,8 +3741,8 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) { bfd_size_type external_sym_size; bfd_size_type external_pdr_size; - void (*swap_sym_in) (bfd *, PTR, SYMR *); - void (*swap_pdr_in) (bfd *, PTR, PDR *); + void (*swap_sym_in) (bfd *, void *, SYMR *); + void (*swap_pdr_in) (bfd *, void *, PDR *); int i; struct symtab *st = NULL; FDR *fh; @@ -3918,7 +3895,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) sizeof (struct mips_extra_func_info))); struct symbol *s = new_symbol (MIPS_EFI_SYMBOL_NAME); - memset ((PTR) e, 0, sizeof (struct mips_extra_func_info)); + memset (e, 0, sizeof (struct mips_extra_func_info)); SYMBOL_NAMESPACE (s) = LABEL_NAMESPACE; SYMBOL_CLASS (s) = LOC_CONST; SYMBOL_TYPE (s) = mdebug_type_void; @@ -4467,7 +4444,7 @@ add_block (struct block *b, struct symtab *s) { struct blockvector *bv = BLOCKVECTOR (s); - bv = (struct blockvector *) xrealloc ((PTR) bv, + bv = (struct blockvector *) xrealloc ((void *) bv, (sizeof (struct blockvector) + BLOCKVECTOR_NBLOCKS (bv) * sizeof (bv->block))); @@ -4515,7 +4492,7 @@ add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last) /* Blocks with a smaller low bound should come first */ static int -compare_blocks (const PTR arg1, const PTR arg2) +compare_blocks (const void *arg1, const void *arg2) { register int addr_diff; struct block **b1 = (struct block **) arg1; @@ -4617,7 +4594,7 @@ new_psymtab (char *name, struct objfile *objfile) psymtab->read_symtab_private = ((char *) obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc))); - memset ((PTR) psymtab->read_symtab_private, 0, sizeof (struct symloc)); + memset (psymtab->read_symtab_private, 0, sizeof (struct symloc)); CUR_BFD (psymtab) = cur_bfd; DEBUG_SWAP (psymtab) = debug_swap; DEBUG_INFO (psymtab) = debug_info; @@ -4654,7 +4631,7 @@ static struct linetable * shrink_linetable (struct linetable *lt) { - return (struct linetable *) xrealloc ((PTR) lt, + return (struct linetable *) xrealloc ((void *) lt, (sizeof (struct linetable) + ((lt->nitems - 1) * sizeof (lt->item)))); @@ -4698,7 +4675,7 @@ shrink_block (struct block *b, struct symtab *s) /* Just reallocate it and fix references to the old one */ - new = (struct block *) xrealloc ((PTR) b, + new = (struct block *) xrealloc ((void *) b, (sizeof (struct block) + ((BLOCK_NSYMS (b) - 1) * sizeof (struct symbol *)))); @@ -4724,7 +4701,7 @@ new_symbol (char *name) obstack_alloc (¤t_objfile->symbol_obstack, sizeof (struct symbol))); - memset ((PTR) s, 0, sizeof (*s)); + memset (s, 0, sizeof (*s)); SYMBOL_NAME (s) = obsavestring (name, strlen (name), ¤t_objfile->symbol_obstack); SYMBOL_LANGUAGE (s) = psymtab_language; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 36d695acaab..a4997bffda6 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -75,16 +75,6 @@ static int msym_bunch_index; static int msym_count; -/* Prototypes for local functions. */ - -static int compare_minimal_symbols (const PTR, const PTR); - -static int -compact_minimal_symbols (struct minimal_symbol *, int, struct objfile *); - -static void add_minsym_to_demangled_hash_table (struct minimal_symbol *sym, - struct minimal_symbol **table); - /* Compute a hash code based using the same criteria as `strcmp_iw'. */ unsigned int @@ -688,7 +678,7 @@ prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address, Within groups with the same address, sort by name. */ static int -compare_minimal_symbols (const PTR fn1p, const PTR fn2p) +compare_minimal_symbols (const void *fn1p, const void *fn2p) { register const struct minimal_symbol *fn1; register const struct minimal_symbol *fn2; diff --git a/gdb/mipsread.c b/gdb/mipsread.c index 17a8fb7427e..1f869f4b015 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -185,15 +185,13 @@ struct alphacoff_dynsecinfo asection *got_sect; /* Section pointer for .got section */ }; -static void alphacoff_locate_sections (bfd *, asection *, PTR); - /* We are called once per section from read_alphacoff_dynamic_symtab. We need to examine each section we are passed, check to see if it is something we are interested in processing, and if so, stash away some access information for the section. */ static void -alphacoff_locate_sections (bfd *ignore_abfd, asection *sectp, PTR sip) +alphacoff_locate_sections (bfd *ignore_abfd, asection *sectp, void *sip) { register struct alphacoff_dynsecinfo *si; @@ -252,7 +250,7 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets, /* Locate the dynamic symbols sections and read them in. */ memset ((char *) &si, 0, sizeof (si)); - bfd_map_over_sections (abfd, alphacoff_locate_sections, (PTR) & si); + bfd_map_over_sections (abfd, alphacoff_locate_sections, (void *) & si); if (si.sym_sect == NULL || si.str_sect == NULL || si.dyninfo_sect == NULL diff --git a/gdb/top.h b/gdb/top.h index 49a32a9bb32..ca0b3d13dc6 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -44,7 +44,7 @@ extern void simplified_command_loop (char *(*read_input_func) (char *), extern int quit_confirm (void); extern void quit_force (char *, int); extern void quit_command (char *, int); -extern int quit_cover (PTR); +extern int quit_cover (void *); extern void execute_command (char *, int); /* This function returns a pointer to the string that is used -- 2.30.2