Don't cast when you could get it right in the first place

Jim Blandy jimb@cygnus.com
Thu Jul 29 21:05:00 GMT 1999


I'm committing this change without approval, because it's so dumb.  If
I've stepped on anything here, I'll feel real dumb.

1999-07-29  Jim Blandy  <jimb@cris.red-bean.com>

	Rather than casting every single use of really_free_pendings to 
	make_cleanup_func, why not actually make it have that type?  Golly!
	* buildsym.c (really_free_pendings): Change argument type to PTR.
	buildsym.h (really_free_pendings): Fix declaration.
	* dbxread.c (dbx_symfile_read, dbx_psymtab_to_symtab_1),
	dwarf2read.c (psymtab_to_symtab_1), dwarfread
	(psymtab_to_symtab_1), hp-psymtab-read.c (hpread_build_psymtabs),
	os9kread.c (os9k_symfile_read, os9k_psymtab_to_symtab_1),
	xcoffread.c (xcoff_psymtab_to_symtab_1, xcoff_initial_scan):
	Remove casts.

Index: buildsym.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/buildsym.c,v
retrieving revision 2.99
diff -c -c -r2.99 buildsym.c
*** buildsym.c	1999/07/07 23:51:03	2.99
--- buildsym.c	1999/07/30 03:59:32
***************
*** 148,154 ****
  
  /* ARGSUSED */
  void
! really_free_pendings (int foo)
  {
    struct pending *next, *next1;
  
--- 148,154 ----
  
  /* ARGSUSED */
  void
! really_free_pendings (PTR dummy)
  {
    struct pending *next, *next1;
  
Index: buildsym.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/buildsym.h,v
retrieving revision 2.29
diff -c -c -r2.29 buildsym.h
*** buildsym.h	1999/07/07 23:51:03	2.29
--- buildsym.h	1999/07/30 03:59:33
***************
*** 243,249 ****
  			  CORE_ADDR start, CORE_ADDR end,
  			  struct objfile *objfile);
  
! extern void really_free_pendings (int foo);
  
  extern void start_subfile (char *name, char *dirname);
  
--- 243,249 ----
  			  CORE_ADDR start, CORE_ADDR end,
  			  struct objfile *objfile);
  
! extern void really_free_pendings (PTR dummy);
  
  extern void start_subfile (char *name, char *dirname);
  
Index: dbxread.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/dbxread.c,v
retrieving revision 1.237
diff -c -c -r1.237 dbxread.c
*** dbxread.c	1999/07/07 23:51:05	1.237
--- dbxread.c	1999/07/30 03:59:39
***************
*** 623,629 ****
    symbol_table_offset = DBX_SYMTAB_OFFSET (objfile);
  
    free_pending_blocks ();
!   back_to = make_cleanup ((make_cleanup_func) really_free_pendings, 0);
  
    init_minimal_symbol_collection ();
    make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
--- 623,629 ----
    symbol_table_offset = DBX_SYMTAB_OFFSET (objfile);
  
    free_pending_blocks ();
!   back_to = make_cleanup (really_free_pendings, 0);
  
    init_minimal_symbol_collection ();
    make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
***************
*** 1664,1670 ****
        /* Init stuff necessary for reading in symbols */
        stabsread_init ();
        buildsym_init ();
!       old_chain = make_cleanup ((make_cleanup_func) really_free_pendings, 0);
        file_string_table_offset = FILE_STRING_OFFSET (pst);
        symbol_size = SYMBOL_SIZE (pst);
  
--- 1664,1670 ----
        /* Init stuff necessary for reading in symbols */
        stabsread_init ();
        buildsym_init ();
!       old_chain = make_cleanup (really_free_pendings, 0);
        file_string_table_offset = FILE_STRING_OFFSET (pst);
        symbol_size = SYMBOL_SIZE (pst);
  
Index: dwarf2read.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/dwarf2read.c,v
retrieving revision 2.26
diff -c -c -r2.26 dwarf2read.c
*** dwarf2read.c	1999/07/07 23:51:05	2.26
--- dwarf2read.c	1999/07/30 03:59:49
***************
*** 1327,1333 ****
    back_to = make_cleanup (dwarf2_free_tmp_obstack, NULL);
  
    buildsym_init ();
!   make_cleanup ((make_cleanup_func) really_free_pendings, NULL);
  
    /* read in the comp_unit header  */
    cu_header.length = read_4_bytes (abfd, info_ptr);
--- 1327,1333 ----
    back_to = make_cleanup (dwarf2_free_tmp_obstack, NULL);
  
    buildsym_init ();
!   make_cleanup (really_free_pendings, NULL);
  
    /* read in the comp_unit header  */
    cu_header.length = read_4_bytes (abfd, info_ptr);
Index: dwarfread.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/dwarfread.c,v
retrieving revision 2.127
diff -c -c -r2.127 dwarfread.c
*** dwarfread.c	1999/07/07 23:51:06	2.127
--- dwarfread.c	1999/07/30 03:59:57
***************
*** 2456,2463 ****
  	  if (DBLENGTH (pst))	/* Otherwise it's a dummy */
  	    {
  	      buildsym_init ();
! 	      old_chain = make_cleanup ((make_cleanup_func)
! 					really_free_pendings, 0);
  	      read_ofile_symtab (pst);
  	      if (info_verbose)
  		{
--- 2456,2462 ----
  	  if (DBLENGTH (pst))	/* Otherwise it's a dummy */
  	    {
  	      buildsym_init ();
! 	      old_chain = make_cleanup (really_free_pendings, 0);
  	      read_ofile_symtab (pst);
  	      if (info_verbose)
  		{
Index: hp-psymtab-read.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/hp-psymtab-read.c,v
retrieving revision 2.6
diff -c -c -r2.6 hp-psymtab-read.c
*** hp-psymtab-read.c	1999/07/07 23:51:09	2.6
--- hp-psymtab-read.c	1999/07/30 04:00:01
***************
*** 1622,1628 ****
  
    /* Just in case the stabs reader left turds lying around.  */
    free_pending_blocks ();
!   make_cleanup ((make_cleanup_func) really_free_pendings, 0);
  
    pst = (struct partial_symtab *) 0;
  
--- 1622,1628 ----
  
    /* Just in case the stabs reader left turds lying around.  */
    free_pending_blocks ();
!   make_cleanup (really_free_pendings, 0);
  
    pst = (struct partial_symtab *) 0;
  
Index: os9kread.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/os9kread.c,v
retrieving revision 2.32
diff -c -c -r2.32 os9kread.c
*** os9kread.c	1999/07/07 23:51:40	2.32
--- os9kread.c	1999/07/30 04:00:05
***************
*** 347,353 ****
      init_psymbol_list (objfile, DBX_SYMCOUNT (objfile));
  
    free_pending_blocks ();
!   back_to = make_cleanup ((make_cleanup_func) really_free_pendings, 0);
  
    make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
    read_minimal_symbols (objfile, section_offsets);
--- 347,353 ----
      init_psymbol_list (objfile, DBX_SYMCOUNT (objfile));
  
    free_pending_blocks ();
!   back_to = make_cleanup (really_free_pendings, 0);
  
    make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
    read_minimal_symbols (objfile, section_offsets);
***************
*** 1248,1254 ****
        /* Init stuff necessary for reading in symbols */
        stabsread_init ();
        buildsym_init ();
!       old_chain = make_cleanup ((make_cleanup_func) really_free_pendings, 0);
  
        /* Read in this file's symbols */
        os9k_read_ofile_symtab (pst);
--- 1248,1254 ----
        /* Init stuff necessary for reading in symbols */
        stabsread_init ();
        buildsym_init ();
!       old_chain = make_cleanup (really_free_pendings, 0);
  
        /* Read in this file's symbols */
        os9k_read_ofile_symtab (pst);
Index: xcoffread.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/xcoffread.c,v
retrieving revision 2.132
diff -c -c -r2.132 xcoffread.c
*** xcoffread.c	1999/07/07 23:52:12	2.132
--- xcoffread.c	1999/07/30 04:00:10
***************
*** 1827,1833 ****
        /* Init stuff necessary for reading in symbols.  */
        stabsread_init ();
        buildsym_init ();
!       old_chain = make_cleanup ((make_cleanup_func) really_free_pendings, 0);
  
        read_xcoff_symtab (pst);
        sort_symtab_syms (pst->symtab);
--- 1827,1833 ----
        /* Init stuff necessary for reading in symbols.  */
        stabsread_init ();
        buildsym_init ();
!       old_chain = make_cleanup (really_free_pendings, 0);
  
        read_xcoff_symtab (pst);
        sort_symtab_syms (pst->symtab);
***************
*** 2743,2749 ****
      init_psymbol_list (objfile, num_symbols);
  
    free_pending_blocks ();
!   back_to = make_cleanup ((make_cleanup_func) really_free_pendings, 0);
  
    init_minimal_symbol_collection ();
    make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
--- 2743,2749 ----
      init_psymbol_list (objfile, num_symbols);
  
    free_pending_blocks ();
!   back_to = make_cleanup (really_free_pendings, 0);
  
    init_minimal_symbol_collection ();
    make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);


More information about the Gdb-patches mailing list