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]

make_cleanup_func elimination


This patch takes the advice of the comments in defs.h.

I did try a few testsuite runs without obvious disasters, but I needed
to re-do them to get completely good numbers, and I haven't been
getting around to that.  So sending the patch in now seemed better
than just letting it sit around without telling anyone.

2000-03-13  Jim Kingdon  <kingdon@redhat.com>
 
	Fix dubious assumptions about sizes of host pointers and ints and
	such in calling make_cleanup:
	* coffread.c, solib.c, dbxread.c, mipsread.c, os9kread.c,
	elfread.c, nlmread.c, somread.c, xcoffread.c, ax-gdb.c,
	tracepoint.c, dwarf2read.c, command.c, eval.c, top.c, event-top.c,
	top.h, breakpoint.h, breakpoint.c, infrun.c, infcmd.c, varobj.c,
	parse.c, stack.c, printcmd.c, symfile.c, symtab.c, thread.c,
	typeprint.c, valops.c, procfs.c, hp-psymtab-read.c, hppa-tdep.c,
	sparcl-tdep.c, remote-udi.c, procfs.c, remote-e7000.c: Don't cast
	argument to make_cleanup.  Instead give the function we pass the
	right argument type one way or another.  In various cases change
	argument types or add wrapper functions.  In the case of bfd_close
	(many places), close (procfs.c), closedir (procfs.c), chdir
	(top.c), fclose (top.c), add error handling.
	* defs.h (make_cleanup_func): Remove.

Index: ax-gdb.c
===================================================================
RCS file: /cvs/src/src/gdb/ax-gdb.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 ax-gdb.c
--- ax-gdb.c	2000/02/02 00:21:04	1.1.1.7
+++ ax-gdb.c	2000/03/19 21:58:04
@@ -1798,7 +1798,7 @@
   struct agent_expr *ax = new_agent_expr (0);
   union exp_element *pc;
 
-  old_chain = make_cleanup ((make_cleanup_func) free_agent_expr, ax);
+  old_chain = make_cleanup (cleanup_agent_expr, ax);
 
   pc = expr->elts;
   trace_kludge = 0;
@@ -1854,7 +1854,7 @@
   union exp_element *pc;
   struct axs_value value;
 
-  old_chain = make_cleanup ((make_cleanup_func) free_agent_expr, ax);
+  old_chain = make_cleanup (cleanup_agent_expr, ax);
 
   pc = expr->elts;
   trace_kludge = 1;
@@ -1923,9 +1923,9 @@
     error_no_arg ("expression to translate");
 
   expr = parse_expression (exp);
-  old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+  old_chain = make_cleanup (free_current_contents, &expr);
   agent = gen_trace_for_expr (fi->pc, expr);
-  make_cleanup ((make_cleanup_func) free_agent_expr, agent);
+  make_cleanup (cleanup_agent_expr, agent);
   ax_print (gdb_stdout, agent);
 
   /* It would be nice to call ax_reqs here to gather some general info
Index: ax-general.c
===================================================================
RCS file: /cvs/src/src/gdb/ax-general.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 ax-general.c
--- ax-general.c	2000/02/02 00:21:04	1.1.1.5
+++ ax-general.c	2000/03/19 21:58:05
@@ -62,6 +62,12 @@
   free (x);
 }
 
+/* Like free_agent_expr but callable through make_cleanup.  */
+void
+cleanup_agent_expr (void *arg)
+{
+  free_agent_expr ((struct agent_expr *) arg);
+}
 
 /* Make sure that X has room for at least N more bytes.  This doesn't
    affect the length, just the allocated size.  */
Index: ax.h
===================================================================
RCS file: /cvs/src/src/gdb/ax.h,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 ax.h
--- ax.h	2000/02/02 00:21:04	1.1.1.4
+++ ax.h	2000/03/19 21:58:05
@@ -144,6 +144,9 @@
 /* Free a agent expression.  */
 extern void free_agent_expr PARAMS ((struct agent_expr *));
 
+/* Like free_agent_expr but callable through make_cleanup.  */
+extern void cleanup_agent_expr (void *arg);
+
 /* Append a simple operator OP to EXPR.  */
 extern void ax_simple PARAMS ((struct agent_expr * EXPR, enum agent_op OP));
 
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.2
diff -u -r1.2 breakpoint.c
--- breakpoint.c	2000/02/23 00:25:42	1.2
+++ breakpoint.c	2000/03/19 21:58:11
@@ -1895,7 +1895,7 @@
   struct cleanup *old_chain;
   struct ui_stream *stb;
   stb = ui_out_stream_new (uiout);
-  old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb);
+  old_chain = make_cleanup_ui_out_stream_delete (stb);
 #endif /* UI_OUT */
   /* bs->breakpoint_at can be NULL if it was a momentary breakpoint
      which has since been deleted.  */
@@ -3932,7 +3932,7 @@
 }
 
 void
-disable_longjmp_breakpoint ()
+disable_longjmp_breakpoint (void *ignore)
 {
   register struct breakpoint *b;
 
@@ -4396,7 +4396,7 @@
   struct ui_stream *stb;
 
   stb = ui_out_stream_new (uiout);
-  old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb);
+  old_chain = make_cleanup_ui_out_stream_delete, stb);
 #endif /* UI_OUT */
 
   /* FIXME: This is misplaced; mention() is called by things (like hitting a
@@ -5679,10 +5679,9 @@
   breakpoint = set_momentary_breakpoint (sal, selected_frame, bp_until);
 
   if (!event_loop_p || !target_can_async_p ())
-    old_chain = make_cleanup ((make_cleanup_func) delete_breakpoint, 
-			      breakpoint);
+    old_chain = make_cleanup (cleanup_breakpoint, breakpoint);
   else
-    old_chain = make_exec_cleanup ((make_cleanup_func) delete_breakpoint, breakpoint);
+    old_chain = make_exec_cleanup (cleanup_breakpoint, breakpoint);
 
   /* If we are running asynchronously, and the target supports async
      execution, we are not waiting for the target to stop, in the call
@@ -5713,9 +5712,9 @@
       sal.pc = prev_frame->pc;
       breakpoint = set_momentary_breakpoint (sal, prev_frame, bp_until);
       if (!event_loop_p || !target_can_async_p ())
-	make_cleanup ((make_cleanup_func) delete_breakpoint, breakpoint);
+	make_cleanup (cleanup_breakpoint, breakpoint);
       else
-	make_exec_cleanup ((make_cleanup_func) delete_breakpoint, breakpoint);
+	make_exec_cleanup (cleanup_breakpoint, breakpoint);
     }
 
   proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
@@ -6993,6 +6992,12 @@
   bpt->type = bp_none;
 
   free ((PTR) bpt);
+}
+
+void
+cleanup_breakpoint (void *arg)
+{
+  delete_breakpoint (arg);
 }
 
 void
Index: breakpoint.h
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.h,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 breakpoint.h
--- breakpoint.h	2000/02/03 04:14:27	1.1.1.11
+++ breakpoint.h	2000/03/19 21:58:11
@@ -545,6 +545,8 @@
 
 extern void delete_breakpoint PARAMS ((struct breakpoint *));
 
+extern void cleanup_breakpoint (void *);
+
 extern void breakpoint_auto_delete PARAMS ((bpstat));
 
 extern void breakpoint_clear_ignore_counts PARAMS ((void));
@@ -600,7 +602,7 @@
 
 extern void enable_longjmp_breakpoint PARAMS ((void));
 
-extern void disable_longjmp_breakpoint PARAMS ((void));
+extern void disable_longjmp_breakpoint (void *);
 
 extern void set_longjmp_resume_breakpoint PARAMS ((CORE_ADDR,
 						   struct frame_info *));
Index: coffread.c
===================================================================
RCS file: /cvs/src/src/gdb/coffread.c,v
retrieving revision 1.2
diff -u -r1.2 coffread.c
--- coffread.c	2000/02/08 04:39:01	1.2
+++ coffread.c	2000/03/19 21:58:13
@@ -203,7 +203,7 @@
 
 static void enter_linenos PARAMS ((long, int, int, struct objfile *));
 
-static void free_linetab PARAMS ((void));
+static void free_linetab (void *);
 
 static int init_lineno PARAMS ((bfd *, long, int));
 
@@ -211,7 +211,7 @@
 
 static char *coff_getfilename PARAMS ((union internal_auxent *));
 
-static void free_stringtab PARAMS ((void));
+static void free_stringtab (void *);
 
 static int init_stringtab PARAMS ((bfd *, long));
 
@@ -638,7 +638,7 @@
   temp_sym = (char *) xmalloc
     (cdata->local_symesz + cdata->local_auxesz);
   temp_aux = temp_sym + cdata->local_symesz;
-  back_to = make_cleanup ((make_cleanup_func) free_current_contents, &temp_sym);
+  back_to = make_cleanup (free_current_contents, &temp_sym);
 
   /* We need to know whether this is a PE file, because in PE files,
      unlike standard COFF files, symbol values are stored as offsets
@@ -656,7 +656,7 @@
   info->max_lineno_offset = 0;
   bfd_map_over_sections (abfd, find_linenos, (PTR) info);
 
-  make_cleanup ((make_cleanup_func) free_linetab, 0);
+  make_cleanup (free_linetab, NULL);
   val = init_lineno (abfd, info->min_lineno_offset,
 		     info->max_lineno_offset - info->min_lineno_offset);
   if (val < 0)
@@ -664,13 +664,13 @@
 
   /* Now read the string table, all at once.  */
 
-  make_cleanup ((make_cleanup_func) free_stringtab, 0);
+  make_cleanup (free_stringtab, NULL);
   val = init_stringtab (abfd, stringtab_offset);
   if (val < 0)
     error ("\"%s\": can't get string table", name);
 
   init_minimal_symbol_collection ();
-  make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  make_cleanup (discard_minimal_symbols, 0);
 
   /* Now that the executable file is positioned at symbol table,
      process it and define symbols accordingly.  */
@@ -1247,7 +1247,7 @@
   int val;
   unsigned char lengthbuf[4];
 
-  free_stringtab ();
+  free_stringtab (NULL);
 
   /* If the file is stripped, the offset might be zero, indicating no
      string table.  Just return with `stringtab' set to null. */
@@ -1280,7 +1280,7 @@
 }
 
 static void
-free_stringtab ()
+free_stringtab (void *ignore)
 {
   if (stringtab)
     free (stringtab);
@@ -1359,7 +1359,7 @@
   linetab_offset = offset;
   linetab_size = size;
 
-  free_linetab ();
+  free_linetab (NULL);
 
   if (size == 0)
     return 0;
@@ -1381,7 +1381,7 @@
 }
 
 static void
-free_linetab ()
+free_linetab (void *ignore)
 {
   if (linetab)
     free (linetab);
Index: command.c
===================================================================
RCS file: /cvs/src/src/gdb/command.c,v
retrieving revision 1.2
diff -u -r1.2 command.c
--- command.c	2000/02/09 08:52:45	1.2
+++ command.c	2000/03/19 21:58:14
@@ -1370,7 +1370,7 @@
       int quote;
 
       stb = ui_out_stream_new (uiout);
-      old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb);
+      old_chain = make_cleanup_ui_out_stream_delete (stb);
 #endif /* UI_OUT */
 
       /* Print doc minus "show" at start.  */
Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 corelow.c
--- corelow.c	1999/12/08 02:50:37	1.1.1.6
+++ corelow.c	2000/03/19 21:58:15
@@ -32,6 +32,7 @@
 #include "target.h"
 #include "gdbcore.h"
 #include "gdbthread.h"
+#include "symfile.h" /* cleanup_bfd_close */
 
 /* List of all available core_fns.  On gdb startup, each core file register
    reader calls add_core_fns() to register information on each core format it
@@ -207,6 +208,12 @@
   core_vec = NULL;
 }
 
+static void
+cleanup_core_close (void *arg)
+{
+  core_close (0);
+}
+
 #ifdef SOLIB_ADD
 /* Stub function for catch_errors around shared library hacking.  FROM_TTYP
    is really an int * which points to from_tty.  */
@@ -292,10 +299,7 @@
       !gdb_check_format (temp_bfd))
     {
       /* Do it after the err msg */
-      /* FIXME: should be checking for errors from bfd_close (for one thing,
-         on error it does not free all the storage associated with the
-         bfd).  */
-      make_cleanup ((make_cleanup_func) bfd_close, temp_bfd);
+      make_cleanup (cleanup_bfd_close, temp_bfd);
       error ("\"%s\" is not a core dump: %s",
 	     filename, bfd_errmsg (bfd_get_error ()));
     }
@@ -305,7 +309,7 @@
   discard_cleanups (old_chain);	/* Don't free filename any more */
   unpush_target (&core_ops);
   core_bfd = temp_bfd;
-  old_chain = make_cleanup ((make_cleanup_func) core_close, core_bfd);
+  old_chain = make_cleanup (cleanup_core_close, NULL);
 
   /* Find a suitable core file handler to munch on core_bfd */
   core_vec = sniff_core_bfd (core_bfd);
@@ -488,10 +492,7 @@
   if (!bfd_check_format (temp_bfd, bfd_core))
     {
       /* Do it after the err msg */
-      /* FIXME: should be checking for errors from bfd_close (for one thing,
-         on error it does not free all the storage associated with the
-         bfd).  */
-      make_cleanup ((make_cleanup_func) bfd_close, temp_bfd);
+      make_cleanup (cleanup_bfd_close, temp_bfd);
       error ("\"%s\" is not a core dump: %s",
 	     core, bfd_errmsg (bfd_get_error ()));
     }
Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.1.1.10
diff -u -r1.1.1.10 dbxread.c
--- dbxread.c	2000/01/06 03:06:36	1.1.1.10
+++ dbxread.c	2000/03/19 21:58:17
@@ -624,7 +624,7 @@
   back_to = make_cleanup (really_free_pendings, 0);
 
   init_minimal_symbol_collection ();
-  make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  make_cleanup (discard_minimal_symbols, 0);
 
   /* Read stabs data from executable file and define symbols. */
 
@@ -1094,6 +1094,12 @@
   bincls_allocated = 0;
 }
 
+static void
+cleanup_bincl_list (void *arg)
+{
+  free_bincl_list (arg);
+}
+
 /* Scan a SunOs dynamic symbol table for symbols of interest and
    add them to the minimal symbol table.  */
 
@@ -1295,7 +1301,7 @@
 
   /* Init bincl list */
   init_bincl_list (20, objfile);
-  back_to = make_cleanup ((make_cleanup_func) free_bincl_list, objfile);
+  back_to = make_cleanup (cleanup_bincl_list, objfile);
 
   last_source_file = NULL;
 
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.11
diff -u -r1.11 defs.h
--- defs.h	2000/03/13 07:30:00	1.11
+++ defs.h	2000/03/19 21:58:18
@@ -293,13 +293,6 @@
 extern void discard_exec_error_cleanups (struct cleanup *);
 extern void discard_my_cleanups (struct cleanup **, struct cleanup *);
 
-/* DEPRECATED: cagney/2000-03-04: Do not use this typedef to cast
-   function pointers so that they match the argument to the various
-   cleanup functions.  Post GDB 5.0, this typedef will be
-   deleted. [Editors note: cagney was the person that added most of
-   those type casts] */
-typedef void (*make_cleanup_func) (void *);
-
 /* NOTE: cagney/2000-03-04: This typedef is strictly for the
    make_cleanup function declarations below. Do not use this typedef
    as a cast when passing functions into the make_cleanup() code.
@@ -332,7 +325,7 @@
 extern void restore_final_cleanups (struct cleanup *);
 extern void restore_my_cleanups (struct cleanup **, struct cleanup *);
 
-extern void free_current_contents (char **);
+extern void free_current_contents (void *);
 
 extern void null_cleanup (void *);
 
@@ -618,6 +611,7 @@
 extern struct command_line *read_command_lines (char *, int);
 
 extern void free_command_lines (struct command_line **);
+extern void cleanup_command_lines (void *);
 
 /* To continue the execution commands when running gdb asynchronously. 
    A continuation structure contains a pointer to a function to be called 
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.3
diff -u -r1.3 dwarf2read.c
--- dwarf2read.c	2000/02/29 05:10:04	1.3
+++ dwarf2read.c	2000/03/19 21:58:22
@@ -717,6 +717,7 @@
 struct die_info *read_comp_unit PARAMS ((char *, bfd *));
 
 static void free_die_list PARAMS ((struct die_info *));
+static void cleanup_die_list (void *);
 
 static void process_die PARAMS ((struct die_info *, struct objfile *));
 
@@ -1342,7 +1343,7 @@
 
   dies = read_comp_unit (info_ptr, abfd);
 
-  make_cleanup ((make_cleanup_func) free_die_list, dies);
+  make_cleanup (cleanup_die_list, dies);
 
   /* Do line number decoding in read_file_scope () */
   process_die (dies, objfile);
@@ -2018,7 +2019,7 @@
 		      (fip->nfnfields + DW_FIELD_ALLOC_CHUNK)
 		      * sizeof (struct fnfieldlist));
 	  if (fip->nfnfields == 0)
-	    make_cleanup ((make_cleanup_func) free_current_contents,
+	    make_cleanup (free_current_contents,
 			  &fip->fnfieldlists);
 	}
       flp = &fip->fnfieldlists[fip->nfnfields];
@@ -2526,7 +2527,7 @@
 		xrealloc (range_types, (ndim + DW_FIELD_ALLOC_CHUNK)
 			  * sizeof (struct type *));
 	      if (ndim == 0)
-		make_cleanup ((make_cleanup_func) free_current_contents,
+		make_cleanup (free_current_contents,
 			      &range_types);
 	    }
 	  range_types[ndim++] = create_range_type (NULL, index_type, low, high);
@@ -2978,6 +2979,13 @@
     }
 }
 
+static void
+cleanup_die_list (arg)
+     void *arg;
+{
+  free_die_list (arg);
+}
+
 /* Read the contents of the section at OFFSET and of size SIZE from the
    object file specified by OBJFILE into the psymbol_obstack and return it.  */
 
@@ -3789,7 +3797,7 @@
   line_ptr += 1;
   lh.standard_opcode_lengths = (unsigned char *)
     xmalloc (lh.opcode_base * sizeof (unsigned char));
-  back_to = make_cleanup ((make_cleanup_func) free_current_contents,
+  back_to = make_cleanup (free_current_contents,
 			  &lh.standard_opcode_lengths);
 
   lh.standard_opcode_lengths[0] = 1;
@@ -3809,7 +3817,7 @@
 	    xrealloc (dirs.dirs,
 		      (dirs.num_dirs + DIR_ALLOC_CHUNK) * sizeof (char *));
 	  if (dirs.num_dirs == 0)
-	    make_cleanup ((make_cleanup_func) free_current_contents, &dirs.dirs);
+	    make_cleanup (free_current_contents, &dirs.dirs);
 	}
       dirs.dirs[dirs.num_dirs++] = cur_dir;
     }
@@ -3826,7 +3834,7 @@
 		      (files.num_files + FILE_ALLOC_CHUNK)
 		      * sizeof (struct fileinfo));
 	  if (files.num_files == 0)
-	    make_cleanup ((make_cleanup_func) free_current_contents,
+	    make_cleanup (free_current_contents,
 			  &files.files);
 	}
       files.files[files.num_files].name = cur_file;
@@ -3902,7 +3910,7 @@
 				  (files.num_files + FILE_ALLOC_CHUNK)
 				  * sizeof (struct fileinfo));
 		      if (files.num_files == 0)
-			make_cleanup ((make_cleanup_func) free_current_contents,
+			make_cleanup (free_current_contents,
 				      &files.files);
 		    }
 		  files.files[files.num_files].name = cur_file;
Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.4
diff -u -r1.4 elfread.c
--- elfread.c	2000/02/15 04:48:23	1.4
+++ elfread.c	2000/03/19 21:58:22
@@ -593,7 +593,7 @@
   CORE_ADDR offset;
 
   init_minimal_symbol_collection ();
-  back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  back_to = make_cleanup (discard_minimal_symbols, 0);
 
   memset ((char *) &ei, 0, sizeof (ei));
 
Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 eval.c
--- eval.c	1999/12/14 01:05:30	1.1.1.7
+++ eval.c	2000/03/19 21:58:24
@@ -82,7 +82,7 @@
   struct expression *expr = parse_expression (exp);
   register CORE_ADDR addr;
   register struct cleanup *old_chain =
-  make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+  make_cleanup (free_current_contents, &expr);
 
   addr = value_as_pointer (evaluate_expression (expr));
   do_cleanups (old_chain);
@@ -99,7 +99,7 @@
   struct expression *expr = parse_exp_1 (expptr, (struct block *) 0, 0);
   register CORE_ADDR addr;
   register struct cleanup *old_chain =
-  make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+  make_cleanup (free_current_contents, &expr);
 
   addr = value_as_pointer (evaluate_expression (expr));
   do_cleanups (old_chain);
@@ -113,7 +113,7 @@
   struct expression *expr = parse_expression (exp);
   register value_ptr val;
   register struct cleanup *old_chain
-  = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+  = make_cleanup (free_current_contents, &expr);
 
   val = evaluate_expression (expr);
   do_cleanups (old_chain);
@@ -131,7 +131,7 @@
   struct expression *expr = parse_exp_1 (expp, (struct block *) 0, 1);
   register value_ptr val;
   register struct cleanup *old_chain
-  = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+  = make_cleanup (free_current_contents, &expr);
 
   val = evaluate_expression (expr);
   do_cleanups (old_chain);
Index: event-top.c
===================================================================
RCS file: /cvs/src/src/gdb/event-top.c,v
retrieving revision 1.3
diff -u -r1.3 event-top.c
--- event-top.c	2000/03/03 15:37:09	1.3
+++ event-top.c	2000/03/19 21:58:25
@@ -487,7 +487,7 @@
   quit_flag = 0;
   if (instream == stdin && stdin_is_tty)
     reinitialize_more_filter ();
-  old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
+  old_chain = make_cleanup (command_loop_marker, 0);
 
 #if defined(TUI)
   insert_mode = 0;
Index: hp-psymtab-read.c
===================================================================
RCS file: /cvs/src/src/gdb/hp-psymtab-read.c,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 hp-psymtab-read.c
--- hp-psymtab-read.c	1999/12/22 21:45:06	1.1.1.6
+++ hp-psymtab-read.c	2000/03/19 21:58:27
@@ -1628,7 +1628,7 @@
     (struct partial_symtab **) alloca (dependencies_allocated *
 				       sizeof (struct partial_symtab *));
 
-  old_chain = make_cleanup ((make_cleanup_func) free_objfile, objfile);
+  old_chain = make_cleanup (cleanup_objfile, objfile);
 
   last_source_file = 0;
 
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.2
diff -u -r1.2 hppa-tdep.c
--- hppa-tdep.c	2000/02/09 08:52:45	1.2
+++ hppa-tdep.c	2000/03/19 21:58:31
@@ -1618,7 +1618,7 @@
       breakpoint->silent = 1;
 
       /* So we can clean things up.  */
-      old_chain = make_cleanup ((make_cleanup_func) delete_breakpoint, breakpoint);
+      old_chain = make_cleanup (cleanup_breakpoint, breakpoint);
 
       /* Start up the inferior.  */
       clear_proceed_status ();
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.2
diff -u -r1.2 infcmd.c
--- infcmd.c	2000/02/23 15:53:33	1.2
+++ infcmd.c	2000/03/19 21:58:32
@@ -489,10 +489,9 @@
     {
       enable_longjmp_breakpoint ();
       if (!event_loop_p || !target_can_async_p ())
-	cleanups = make_cleanup ((make_cleanup_func) disable_longjmp_breakpoint,
-				 0);
+	cleanups = make_cleanup (disable_longjmp_breakpoint, NULL);
       else
-        make_exec_cleanup ((make_cleanup_func) disable_longjmp_breakpoint, 0);
+        make_exec_cleanup (disable_longjmp_breakpoint, NULL);
     }
 
   /* In synchronous case, all is well, just use the regular for loop. */
@@ -1194,9 +1193,9 @@
   breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
 
   if (!event_loop_p || !target_can_async_p ())
-    old_chain = make_cleanup ((make_cleanup_func) delete_breakpoint, breakpoint);
+    old_chain = make_cleanup (cleanup_breakpoint, breakpoint);
   else
-    old_chain = make_exec_cleanup ((make_cleanup_func) delete_breakpoint, breakpoint);
+    old_chain = make_exec_cleanup (cleanup_breakpoint, breakpoint);
 
   /* Find the function we will return from.  */
 
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.2
diff -u -r1.2 inferior.h
--- inferior.h	2000/02/29 13:53:59	1.2
+++ inferior.h	2000/03/19 21:58:32
@@ -40,7 +40,7 @@
 
 extern struct inferior_status *save_inferior_status PARAMS ((int));
 
-extern void restore_inferior_status PARAMS ((struct inferior_status *));
+extern void restore_inferior_status (void *);
 
 extern void discard_inferior_status PARAMS ((struct inferior_status *));
 
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.4
diff -u -r1.4 infrun.c
--- infrun.c	2000/02/29 07:17:15	1.4
+++ infrun.c	2000/03/19 21:58:36
@@ -46,7 +46,7 @@
 
 static void sig_print_header (void);
 
-static void resume_cleanups (int);
+static void resume_cleanups (void *);
 
 static int hook_stop_stub (void *);
 
@@ -745,7 +745,7 @@
 /* Things to clean up if we QUIT out of resume ().  */
 /* ARGSUSED */
 static void
-resume_cleanups (int arg)
+resume_cleanups (void *arg)
 {
   normal_stop ();
 }
@@ -784,8 +784,7 @@
 resume (int step, enum target_signal sig)
 {
   int should_resume = 1;
-  struct cleanup *old_cleanups = make_cleanup ((make_cleanup_func)
-					       resume_cleanups, 0);
+  struct cleanup *old_cleanups = make_cleanup (resume_cleanups, NULL);
   QUIT;
 
 #ifdef CANNOT_STEP_BREAKPOINT
@@ -2271,7 +2270,7 @@
 	  /* If we hit the breakpoint at longjmp, disable it for the
 	     duration of this command.  Then, install a temporary
 	     breakpoint at the target of the jmp_buf. */
-	  disable_longjmp_breakpoint ();
+	  disable_longjmp_breakpoint (NULL);
 	  remove_breakpoints ();
 	  breakpoints_inserted = 0;
 	  if (!GET_LONGJMP_TARGET (&jmp_buf_pc))
@@ -2322,7 +2321,7 @@
 	      return;
 	    }
 #endif /* 0 */
-	  disable_longjmp_breakpoint ();
+	  disable_longjmp_breakpoint (NULL);
 	  ecs->handling_longjmp = 0;	/* FIXME */
 	  if (what.main_action == BPSTAT_WHAT_CLEAR_LONGJMP_RESUME)
 	    break;
@@ -4014,8 +4013,10 @@
 }
 
 void
-restore_inferior_status (struct inferior_status *inf_status)
+restore_inferior_status (void *arg)
 {
+  struct inferior_status *inf_status = (struct inferior_status *) arg;
+
   stop_signal = inf_status->stop_signal;
   stop_pc = inf_status->stop_pc;
   stop_step = inf_status->stop_step;
Index: minsyms.c
===================================================================
RCS file: /cvs/src/src/gdb/minsyms.c,v
retrieving revision 1.3
diff -u -r1.3 minsyms.c
--- minsyms.c	2000/03/09 22:58:49	1.3
+++ minsyms.c	2000/03/19 21:58:37
@@ -728,8 +728,7 @@
 
 /* ARGSUSED */
 void
-discard_minimal_symbols (foo)
-     int foo;
+discard_minimal_symbols (void *arg)
 {
   register struct msym_bunch *next;
 
Index: mipsread.c
===================================================================
RCS file: /cvs/src/src/gdb/mipsread.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 mipsread.c
--- mipsread.c	1999/09/08 23:59:22	1.1.1.5
+++ mipsread.c	2000/03/19 21:58:37
@@ -94,7 +94,7 @@
   struct cleanup *back_to;
 
   init_minimal_symbol_collection ();
-  back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  back_to = make_cleanup (discard_minimal_symbols, 0);
 
   /* Now that the executable file is positioned at symbol table,
      process it and define symbols accordingly.  */
Index: nlmread.c
===================================================================
RCS file: /cvs/src/src/gdb/nlmread.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 nlmread.c
--- nlmread.c	1999/08/09 21:33:43	1.1.1.4
+++ nlmread.c	2000/03/19 21:58:37
@@ -192,7 +192,7 @@
   struct symbol *mainsym;
 
   init_minimal_symbol_collection ();
-  back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  back_to = make_cleanup (discard_minimal_symbols, 0);
 
   /* FIXME, should take a section_offsets param, not just an offset.  */
 
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.2
diff -u -r1.2 objfiles.c
--- objfiles.c	2000/02/29 12:58:51	1.2
+++ objfiles.c	2000/03/19 21:58:38
@@ -495,6 +495,12 @@
     }
 }
 
+void
+cleanup_objfile (void *arg)
+{
+  free_objfile (arg);
+}
+
 
 /* Free all the object files at once and clean up their users.  */
 
Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.2
diff -u -r1.2 objfiles.h
--- objfiles.h	2000/03/07 04:33:52	1.2
+++ objfiles.h	2000/03/19 21:58:39
@@ -496,6 +496,9 @@
 free_objfile PARAMS ((struct objfile *));
 
 extern void
+cleanup_objfile (void *);
+
+extern void
 free_all_objfiles PARAMS ((void));
 
 extern void
Index: os9kread.c
===================================================================
RCS file: /cvs/src/src/gdb/os9kread.c,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 os9kread.c
--- os9kread.c	1999/09/08 23:59:23	1.1.1.6
+++ os9kread.c	2000/03/19 21:58:40
@@ -342,7 +342,7 @@
   free_pending_blocks ();
   back_to = make_cleanup (really_free_pendings, 0);
 
-  make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  make_cleanup (discard_minimal_symbols, 0);
   read_minimal_symbols (objfile);
 
   /* Now that the symbol table data of the executable file are all in core,
Index: parse.c
===================================================================
RCS file: /cvs/src/src/gdb/parse.c,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 parse.c
--- parse.c	1999/10/12 04:37:23	1.1.1.11
+++ parse.c	2000/03/19 21:58:41
@@ -78,7 +78,7 @@
 extern int hp_som_som_object_present;
 
 static void
-free_funcalls PARAMS ((void));
+free_funcalls (void *);
 
 static void
 prefixify_expression PARAMS ((struct expression *));
@@ -177,7 +177,7 @@
    Used when there is an error inside parsing.  */
 
 static void
-free_funcalls ()
+free_funcalls (void *ignore)
 {
   register struct funcall *call, *next;
 
@@ -1165,7 +1165,7 @@
   if (lexptr == 0 || *lexptr == 0)
     error_no_arg ("expression to compute");
 
-  old_chain = make_cleanup ((make_cleanup_func) free_funcalls, 0);
+  old_chain = make_cleanup (free_funcalls, NULL);
   funcall_chain = 0;
 
   expression_context_block = block ? block : get_selected_block ();
@@ -1176,7 +1176,7 @@
   expout = (struct expression *)
     xmalloc (sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_size));
   expout->language_defn = current_language;
-  make_cleanup ((make_cleanup_func) free_current_contents, &expout);
+  make_cleanup (free_current_contents, &expout);
 
   if (current_language->la_parser ())
     current_language->la_error (NULL);
Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.1.1.8
diff -u -r1.1.1.8 printcmd.c
--- printcmd.c	2000/02/05 07:29:47	1.1.1.8
+++ printcmd.c	2000/03/19 21:58:43
@@ -922,7 +922,7 @@
     {
       struct type *type;
       expr = parse_expression (exp);
-      old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
+      old_chain = make_cleanup (free_current_contents,
 				&expr);
       cleanup = 1;
       val = evaluate_expression (expr);
@@ -1036,7 +1036,7 @@
     }
 
   expr = parse_expression (exp);
-  old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+  old_chain = make_cleanup (free_current_contents, &expr);
 
   val = evaluate_expression (expr);
 
@@ -1060,7 +1060,7 @@
 {
   struct expression *expr = parse_expression (exp);
   register struct cleanup *old_chain
-  = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+    = make_cleanup (free_current_contents, &expr);
   evaluate_expression (expr);
   do_cleanups (old_chain);
 }
@@ -1357,7 +1357,7 @@
          But don't clobber a user-defined command's definition.  */
       if (from_tty)
 	*exp = 0;
-      old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
+      old_chain = make_cleanup (free_current_contents,
 				&expr);
       val = evaluate_expression (expr);
       if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF)
@@ -1840,7 +1840,7 @@
   struct ui_stream *stb;
 
   stb = ui_out_stream_new (uiout);
-  old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb);
+  old_chain = make_cleanup_ui_out_stream_delete (stb);
 #endif /* UI_OUT */
 
   if (func)
@@ -2096,8 +2096,7 @@
   struct cleanup *old_cleanups;
 
   val_args = (value_ptr *) xmalloc (allocated_args * sizeof (value_ptr));
-  old_cleanups = make_cleanup ((make_cleanup_func) free_current_contents,
-			       &val_args);
+  old_cleanups = make_cleanup (free_current_contents, &val_args);
 
   if (s == 0)
     error_no_arg ("format-control string and values to print");
Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.3
diff -u -r1.3 procfs.c
--- procfs.c	2000/02/29 13:53:59	1.3
+++ procfs.c	2000/03/19 21:58:46
@@ -707,6 +707,12 @@
     }
 }
 
+static void
+cleanup_procinfo (void *arg)
+{
+  destroy_procinfo (arg);
+}
+
 enum { NOKILL, KILL };
 
 /*
@@ -2615,6 +2621,20 @@
 #endif
 }
 
+static void
+cleanup_close (void *arg)
+{
+  if (close ((int) arg) < 0)
+    perror ("cleanup_close");
+}
+
+static void
+cleanup_closedir (void *arg)
+{
+  if (closedir ((DIR *) arg) < 0)
+    perror ("cleanup_closedir");
+}
+
 /*
  * Function: proc_iterate_over_mappings
  *
@@ -2657,7 +2677,7 @@
     proc_error (pi, "proc_iterate_over_mappings (open)", __LINE__);
 
   /* Make sure it gets closed again.  */
-  make_cleanup ((make_cleanup_func) close, (void *) map_fd);
+  make_cleanup (cleanup_close, (void *) map_fd);
 
   /* Allocate space for mapping (lifetime only for this function). */
   map = alloca (sizeof (struct prmap));
@@ -2768,7 +2788,7 @@
       return NULL;
     }
   /* Make sure it gets closed again! */
-  old_chain = make_cleanup ((make_cleanup_func) close, (void *) fd);
+  old_chain = make_cleanup (cleanup_close, (void *) fd);
 
   /* Now 'read' thru the table, find a match and return it.  */
   while (read (fd, ldt_entry, sizeof (struct ssd)) == sizeof (struct ssd))
@@ -3075,7 +3095,7 @@
   if ((dirp = opendir (pathname)) == NULL)
     proc_error (pi, "update_threads, opendir", __LINE__);
 
-  old_chain = make_cleanup ((make_cleanup_func) closedir, dirp);
+  old_chain = make_cleanup (cleanup_closedir, dirp);
   while ((direntry = readdir (dirp)) != NULL)
     if (direntry->d_name[0] != '.')		/* skip '.' and '..' */
       {
@@ -5047,7 +5067,7 @@
       if ((argv = buildargv (args)) == NULL)
 	nomem (0);
       else
-	make_cleanup ((make_cleanup_func) freeargv, argv);
+	make_cleanup_freeargv (argv);
     }
   while (argv != NULL && *argv != NULL)
     {
@@ -5081,7 +5101,7 @@
 	   /* No.  So open a procinfo for it, but 
 	      remember to close it again when finished.  */
 	   process = create_procinfo (pid, 0);
-	   make_cleanup ((make_cleanup_func) destroy_procinfo, process);
+	   make_cleanup (cleanup_procinfo, process);
 	   if (!open_procinfo_files (process, FD_CTL))
 	     proc_error (process, "info proc, open_procinfo_files", __LINE__);
 	 }
Index: remote-e7000.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-e7000.c,v
retrieving revision 1.2
diff -u -r1.2 remote-e7000.c
--- remote-e7000.c	2000/02/09 08:52:46	1.2
+++ remote-e7000.c	2000/03/19 21:58:48
@@ -1580,7 +1580,7 @@
       perror_with_name (filename);
       return;
     }
-  old_chain = make_cleanup ((make_cleanup_func) bfd_close, pbfd);
+  old_chain = make_cleanup (cleanup_bfd_close, pbfd);
 
   if (!bfd_check_format (pbfd, bfd_object))
     error ("\"%s\" is not an object file: %s", filename,
Index: remote-udi.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-udi.c,v
retrieving revision 1.2
diff -u -r1.2 remote-udi.c
--- remote-udi.c	2000/02/09 08:52:47	1.2
+++ remote-udi.c	2000/03/19 21:58:49
@@ -1108,7 +1108,7 @@
     error ("Must specify at least a file name with the load command");
 
   filename = tilde_expand (filename);
-  make_cleanup ((make_cleanup_func) free, filename);
+  make_cleanup (free, filename);
 
   while (token = strtok (NULL, " \t"))
     {
@@ -1162,7 +1162,7 @@
   /* FIXME: should be checking for errors from bfd_close (for one thing,
      on error it does not free all the storage associated with the
      bfd).  */
-  make_cleanup ((make_cleanup_func) bfd_close, pbfd);
+  make_cleanup (cleanup_bfd_close, pbfd);
 
   QUIT;
   immediate_quit++;
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.2
diff -u -r1.2 solib.c
--- solib.c	2000/03/06 18:04:56	1.2
+++ solib.c	2000/03/19 21:58:50
@@ -417,7 +417,7 @@
     }
 
   init_minimal_symbol_collection ();
-  make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  make_cleanup (discard_minimal_symbols, 0);
 
   while (rtc_symp)
     {
@@ -943,7 +943,7 @@
       return 0;
     }
 
-  make_cleanup ((make_cleanup_func) free, (void *) filename);
+  make_cleanup (free, filename);
   /* Have a pathname: read the symbol file.  */
   symbol_file_command (filename, from_tty);
 
Index: somread.c
===================================================================
RCS file: /cvs/src/src/gdb/somread.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 somread.c
--- somread.c	1999/10/05 23:08:49	1.1.1.7
+++ somread.c	2000/03/19 21:58:51
@@ -366,7 +366,7 @@
   do_pxdb (symfile_bfd_open (objfile->name));
 
   init_minimal_symbol_collection ();
-  back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  back_to = make_cleanup (discard_minimal_symbols, 0);
 
   /* Read in the import list and the export list.  Currently
      the export list isn't used; the import list is used in
Index: sparcl-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparcl-tdep.c,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 sparcl-tdep.c
--- sparcl-tdep.c	1999/08/31 01:06:04	1.1.1.6
+++ sparcl-tdep.c	2000/03/19 21:58:51
@@ -44,7 +44,7 @@
 
 static serial_t open_tty PARAMS ((char *name));
 static int send_resp PARAMS ((serial_t desc, char c));
-static void close_tty PARAMS ((int ignore));
+static void close_tty (void *);
 #ifdef HAVE_SOCKETS
 static int recv_udp_buf PARAMS ((int fd, unsigned char *buf, int len, int timeout));
 static int send_udp_buf PARAMS ((int fd, unsigned char *buf, int len));
@@ -358,8 +358,7 @@
 }
 
 static void
-close_tty (ignore)
-     int ignore;
+close_tty (void *arg)
 {
   if (!remote_desc)
     return;
@@ -480,7 +479,7 @@
     {
       remote_desc = open_tty (p);
 
-      old_chain = make_cleanup ((make_cleanup_func) close_tty, 0);
+      old_chain = make_cleanup (close_tty, 0);
 
       c = send_resp (remote_desc, 0x00);
 
@@ -614,7 +613,7 @@
       perror_with_name (filename);
       return;
     }
-  old_chain = make_cleanup ((make_cleanup_func) bfd_close, pbfd);
+  old_chain = make_cleanup (cleanup_bfd_close, pbfd);
 
   if (!bfd_check_format (pbfd, bfd_object))
     error ("\"%s\" is not an object file: %s", filename,
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.3
diff -u -r1.3 stack.c
--- stack.c	2000/02/29 07:17:15	1.3
+++ stack.c	2000/03/19 21:58:53
@@ -471,7 +471,7 @@
   struct cleanup *old_chain;
 
   stb = ui_out_stream_new (uiout);
-  old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb);
+  old_chain = make_cleanup_ui_out_stream_delete, stb);
 #endif /* UI_OUT */
 
   func = find_pc_function (fi->pc);
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.1.1.17
diff -u -r1.1.1.17 symfile.c
--- symfile.c	2000/02/03 04:14:35	1.1.1.17
+++ symfile.c	2000/03/19 21:58:56
@@ -554,13 +554,13 @@
 
   /* Make sure that partially constructed symbol tables will be cleaned up
      if an error occurs during symbol reading.  */
-  old_chain = make_cleanup ((make_cleanup_func) free_objfile, objfile);
+  old_chain = make_cleanup (cleanup_objfile, objfile);
 
   if (mainline)
     {
       /* We will modify the main symbol table, make sure that all its users
          will be cleaned up if an error occurs during symbol reading.  */
-      make_cleanup ((make_cleanup_func) clear_symtab_users, 0);
+      make_cleanup (cleanup_symtab_users, NULL);
 
       /* Since no error yet, throw away the old symbol table.  */
 
@@ -1145,6 +1145,19 @@
   return (sym_bfd);
 }
 
+/* Verison of bfd_close suitable for passing to make_cleanup.  */
+void
+cleanup_bfd_close (void *arg)
+{
+  bfd *abfd = (bfd *)arg;
+  char *name = bfd_get_filename (abfd);
+
+  if (!bfd_close (abfd))
+    /* Question: does bfd_close free all the resources associated with
+       the bfd?  Should we do it here?  */
+    warning ("cannot close \"%s\": %s", name, bfd_errmsg (bfd_get_error ()));
+}
+
 /* Link a new symtab_fns into the global symtab_fns list.  Called on gdb
    startup by the _initialize routine in each object file format reader,
    to register information about each format the the reader is prepared
@@ -1257,10 +1270,7 @@
       return;
     }
 
-  /* FIXME: should be checking for errors from bfd_close (for one thing,
-     on error it does not free all the storage associated with the
-     bfd).  */
-  make_cleanup ((make_cleanup_func) bfd_close, loadfile_bfd);
+  make_cleanup (cleanup_bfd_close, loadfile_bfd);
 
   if (!bfd_check_format (loadfile_bfd, bfd_object))
     {
@@ -1723,10 +1733,9 @@
 	      /* If we get an error, blow away this objfile (not sure if
 	         that is the correct response for things like shared
 	         libraries).  */
-	      old_cleanups = make_cleanup ((make_cleanup_func) free_objfile,
-					   objfile);
+	      old_cleanups = make_cleanup (cleanup_objfile, objfile);
 	      /* We need to do this whenever any symbols go away.  */
-	      make_cleanup ((make_cleanup_func) clear_symtab_users, 0);
+	      make_cleanup (cleanup_symtab_users, NULL);
 
 	      /* Clean up any state BFD has sitting around.  We don't need
 	         to close the descriptor but BFD lacks a way of closing the
@@ -2150,6 +2159,12 @@
     target_new_objfile_hook (NULL);
 }
 
+void
+cleanup_symtab_users (void *arg)
+{
+  clear_symtab_users ();
+}
+
 /* clear_symtab_users_once:
 
    This function is run after symbol reading, or from a cleanup.
@@ -2331,6 +2346,7 @@
 
 	  clear_symtab_users_queued++;
 	  make_cleanup (clear_symtab_users_once, 0);
+#error bitrot - clear_symtab_users_once mismatches make_cleanup
 	  blewit = 1;
 	}
       else
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 symfile.h
--- symfile.h	1999/10/19 02:46:39	1.1.1.6
+++ symfile.h	2000/03/19 21:58:56
@@ -221,6 +221,8 @@
 
 extern bfd *symfile_bfd_open PARAMS ((char *));
 
+extern void cleanup_bfd_close (void *);
+
 /* Utility functions for overlay sections: */
 extern int overlay_debugging;
 extern int overlay_cache_invalid;
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.2
diff -u -r1.2 symtab.c
--- symtab.c	2000/02/08 04:39:02	1.2
+++ symtab.c	2000/03/19 21:58:59
@@ -3556,9 +3556,10 @@
 
 /* Free any memory associated with a search. */
 void
-free_search_symbols (symbols)
-     struct symbol_search *symbols;
+free_search_symbols (void *arg)
 {
+  struct symbol_search *symbols = (struct symbol_search *) arg;
+
   struct symbol_search *p;
   struct symbol_search *next;
 
@@ -3801,8 +3802,7 @@
 		  if (tail == NULL)
 		    {
 		      sr = psr;
-		      old_chain = make_cleanup ((make_cleanup_func)
-						free_search_symbols, sr);
+		      old_chain = make_cleanup (free_search_symbols, sr);
 		    }
 		  else
 		    tail->next = psr;
@@ -3846,8 +3846,8 @@
 			if (tail == NULL)
 			  {
 			    sr = psr;
-			    old_chain = make_cleanup ((make_cleanup_func)
-						  free_search_symbols, &sr);
+			    old_chain = make_cleanup (free_search_symbols,
+						      &sr);
 			  }
 			else
 			  tail->next = psr;
@@ -3962,7 +3962,7 @@
 
   /* must make sure that if we're interrupted, symbols gets freed */
   search_symbols (regexp, kind, 0, (char **) NULL, &symbols);
-  old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, symbols);
+  old_chain = make_cleanup (free_search_symbols, symbols);
 
   printf_filtered (regexp
 		   ? "All %ss matching regular expression \"%s\":\n"
@@ -4050,7 +4050,7 @@
   struct cleanup *old_chain;
 
   search_symbols (regexp, FUNCTIONS_NAMESPACE, 0, (char **) NULL, &ss);
-  old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, ss);
+  old_chain = make_cleanup (free_search_symbols, ss);
 
   for (p = ss; p != NULL; p = p->next)
     {
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.2
diff -u -r1.2 symtab.h
--- symtab.h	2000/03/07 04:33:52	1.2
+++ symtab.h	2000/03/19 21:59:00
@@ -1291,7 +1291,7 @@
 init_minimal_symbol_collection PARAMS ((void));
 
 extern void
-discard_minimal_symbols PARAMS ((int));
+discard_minimal_symbols (void *);
 
 extern void
 install_minimal_symbols PARAMS ((struct objfile *));
@@ -1480,6 +1480,8 @@
 extern void
 clear_symtab_users PARAMS ((void));
 
+extern void cleanup_symtab_users (void *);
+
 extern enum language
 deduce_language_from_filename PARAMS ((char *));
 
@@ -1517,6 +1519,6 @@
   };
 
 extern void search_symbols PARAMS ((char *, namespace_enum, int, char **, struct symbol_search **));
-extern void free_search_symbols PARAMS ((struct symbol_search *));
+extern void free_search_symbols (void *);
 
 #endif /* !defined(SYMTAB_H) */
Index: thread.c
===================================================================
RCS file: /cvs/src/src/gdb/thread.c,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 thread.c
--- thread.c	2000/02/03 04:14:36	1.1.1.11
+++ thread.c	2000/03/19 21:59:01
@@ -59,7 +59,7 @@
 static int thread_alive PARAMS ((struct thread_info *));
 static void info_threads_command PARAMS ((char *, int));
 static void thread_apply_command PARAMS ((char *, int));
-static void restore_current_thread PARAMS ((int));
+static void restore_current_thread (void *);
 static void switch_to_thread PARAMS ((int pid));
 static void prune_threads PARAMS ((void));
 
@@ -508,10 +508,16 @@
   select_frame (get_current_frame (), 0);
 }
 
+struct thread_number {
+  int pid;
+};
+
 static void
-restore_current_thread (pid)
-     int pid;
+restore_current_thread (void *arg)
 {
+  int pid = ((struct thread_number *)arg)->pid;
+  free (arg);
+
   if (pid != inferior_pid)
     {
       switch_to_thread (pid);
@@ -519,6 +525,14 @@
     }
 }
 
+static struct cleanup *
+make_cleanup_restore_current_thread (int pid)
+{
+  struct thread_number *tn = xmalloc (sizeof (struct thread_number));
+  tn->pid = pid;
+  return make_cleanup (restore_current_thread, tn);
+}
+
 /* Apply a GDB command to a list of threads.  List syntax is a whitespace
    seperated list of numbers, or ranges, or the keyword `all'.  Ranges consist
    of two numbers seperated by a hyphen.  Examples:
@@ -539,8 +553,7 @@
   if (cmd == NULL || *cmd == '\000')
     error ("Please specify a command following the thread ID list");
 
-  old_chain = make_cleanup ((make_cleanup_func) restore_current_thread,
-			    (void *) inferior_pid);
+  old_chain = make_cleanup_restore_current_thread (inferior_pid);
 
   for (tp = thread_list; tp; tp = tp->next)
     if (thread_alive (tp))
@@ -575,8 +588,7 @@
   if (*cmd == '\000')
     error ("Please specify a command following the thread ID list");
 
-  old_chain = make_cleanup ((make_cleanup_func) restore_current_thread,
-			    (void *) inferior_pid);
+  old_chain = make_cleanup_restore_current_thread (inferior_pid);
 
   while (tidlist < cmd)
     {
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.4
diff -u -r1.4 top.c
--- top.c	2000/02/24 00:04:03	1.4
+++ top.c	2000/03/19 21:59:04
@@ -76,7 +76,7 @@
 /* NOTE 1999-04-29: this function will be static again, after we make the
    event loop be the default command loop for gdb, and we merge
    event-top.c into this file, top.c */
-/* static */ void command_loop_marker PARAMS ((int));
+/* static */ void command_loop_marker (void *);
 
 static void while_command PARAMS ((char *, int));
 
@@ -101,7 +101,7 @@
 
 static char *insert_args PARAMS ((char *));
 
-static void arg_cleanup PARAMS ((void));
+static void arg_cleanup (void *);
 
 static void init_main PARAMS ((void));
 
@@ -153,7 +153,7 @@
 static void disconnect PARAMS ((int));
 #endif
 
-static void source_cleanup PARAMS ((FILE *));
+static void source_cleanup (void *);
 
 /* Default command line prompt.  This is overriden in some configs. */
 
@@ -753,9 +753,10 @@
    user-defined command).  */
 
 static void
-source_cleanup (stream)
-     FILE *stream;
+source_cleanup (void *arg)
 {
+  FILE *stream = (void *)arg;
+
   /* Restore the previous input stream.  */
   instream = stream;
 }
@@ -767,7 +768,7 @@
 {
   struct cleanup *cleanups;
 
-  cleanups = make_cleanup ((make_cleanup_func) source_cleanup, instream);
+  cleanups = make_cleanup (source_cleanup, instream);
   instream = stream;
   command_loop ();
   do_cleanups (cleanups);
@@ -777,6 +778,13 @@
 
 void (*pre_init_ui_hook) PARAMS ((void));
 
+static void
+cleanup_chdir (void *arg)
+{
+  if (chdir (arg) < 0)
+    perror_with_name (arg);
+}
+
 void
 gdb_init (argv0)
      char *argv0;
@@ -792,7 +800,7 @@
 #ifdef __MSDOS__
   /* Make sure we return to the original directory upon exit, come
      what may, since the OS doesn't do that for us.  */
-  make_final_cleanup ((make_cleanup_func) chdir, strsave (current_directory));
+  make_final_cleanup (cleanup_chdir, strsave (current_directory));
 #endif
 
   init_cmd_lists ();		/* This needs to be done first */
@@ -877,7 +885,7 @@
   /* Allocate and build a new command line structure.  */
   cmd = build_command_line (type, arg);
 
-  old_chain = make_cleanup ((make_cleanup_func) free_command_lines, &cmd);
+  old_chain = make_cleanup (cleanup_command_lines, &cmd);
 
   /* Read in the body of this command.  */
   if (recurse_read_control_structure (cmd) == invalid_control)
@@ -1087,7 +1095,7 @@
       new_line = insert_args (cmd->line);
       if (!new_line)
 	return invalid_control;
-      old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
+      old_chain = make_cleanup (free_current_contents,
 				&new_line);
       execute_command (new_line, 0);
       ret = cmd->control_type;
@@ -1106,10 +1114,10 @@
 	new_line = insert_args (cmd->line);
 	if (!new_line)
 	  return invalid_control;
-	old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
+	old_chain = make_cleanup (free_current_contents,
 				  &new_line);
 	expr = parse_expression (new_line);
-	make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+	make_cleanup (free_current_contents, &expr);
 
 	ret = simple_control;
 	loop = 1;
@@ -1167,11 +1175,11 @@
 	new_line = insert_args (cmd->line);
 	if (!new_line)
 	  return invalid_control;
-	old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
+	old_chain = make_cleanup (free_current_contents,
 				  &new_line);
 	/* Parse the conditional for the if statement.  */
 	expr = parse_expression (new_line);
-	make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+	make_cleanup (free_current_contents, &expr);
 
 	current = NULL;
 	ret = simple_control;
@@ -1257,7 +1265,7 @@
 
 /* Cleanup */
 static void
-arg_cleanup ()
+arg_cleanup (void *arg)
 {
   struct user_args *oargs = user_args;
   if (!user_args)
@@ -1284,7 +1292,7 @@
   args->next = user_args;
   user_args = args;
 
-  old_chain = make_cleanup ((make_cleanup_func) arg_cleanup, 0);
+  old_chain = make_cleanup (arg_cleanup, NULL);
 
   if (p == NULL)
     return old_chain;
@@ -1448,7 +1456,7 @@
 
   /* Set the instream to 0, indicating execution of a
      user-defined function.  */
-  old_chain = make_cleanup ((make_cleanup_func) source_cleanup, instream);
+  old_chain = make_cleanup (source_cleanup, instream);
   instream = (FILE *) 0;
   while (cmdlines)
     {
@@ -1568,8 +1576,7 @@
    gdb to use the event loop as the default command loop and we merge
    event-top.c into this file, top.c */
 /* static */ void
-command_loop_marker (foo)
-     int foo;
+command_loop_marker (void *arg)
 {
 }
 
@@ -1600,7 +1607,7 @@
       quit_flag = 0;
       if (instream == stdin && stdin_is_tty)
 	reinitialize_more_filter ();
-      old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
+      old_chain = make_cleanup (command_loop_marker, 0);
 
 #if defined(TUI)
       /* A bit of paranoia: I want to make sure the "insert_mode" global
@@ -1681,7 +1688,7 @@
       quit_flag = 0;
       if (instream == stdin && stdin_is_tty)
 	reinitialize_more_filter ();
-      old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
+      old_chain = make_cleanup (command_loop_marker, 0);
 
       /* Get a command-line. */
       command = (*read_input_func) (instream == stdin ?
@@ -2839,7 +2846,7 @@
       else
 	{
 	  head = next;
-	  old_chain = make_cleanup ((make_cleanup_func) free_command_lines,
+	  old_chain = make_cleanup (cleanup_command_lines,
 				    &head);
 	}
       tail = next;
@@ -2889,6 +2896,12 @@
       l = next;
     }
 }
+
+void
+cleanup_command_lines (void *arg)
+{
+  free_command_lines (arg);
+}
 
 /* Add an element to the list of info subcommands.  */
 
@@ -3722,6 +3735,14 @@
   error_pre_print = p->old_error_pre_print;
 }
 
+static void
+cleanup_fclose (void *arg)
+{
+  FILE *fp = (FILE *) arg;
+  if (fclose (fp) < 0)
+    perror_with_name ("cleanup_fclose");
+}
+
 /* ARGSUSED */
 void
 source_command (args, from_tty)
@@ -3751,7 +3772,7 @@
 	return;
     }
 
-  make_cleanup ((make_cleanup_func) fclose, stream);
+  make_cleanup (cleanup_fclose, stream);
 
   old_lines.old_line = source_line_number;
   old_lines.old_file = source_file_name;
Index: top.h
===================================================================
RCS file: /cvs/src/src/gdb/top.h,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 top.h
--- top.h	2000/02/03 04:14:30	1.1.1.11
+++ top.h	2000/03/19 21:59:04
@@ -39,7 +39,7 @@
 extern int quit_confirm PARAMS ((void));
 extern void quit_force PARAMS ((char *, int));
 extern void quit_command PARAMS ((char *, int));
-extern void command_loop_marker PARAMS ((int));
+extern void command_loop_marker (void *);
 extern int quit_cover PARAMS ((PTR));
 extern void execute_command PARAMS ((char *, int));
 
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 tracepoint.c
--- tracepoint.c	1999/12/14 01:05:38	1.1.1.11
+++ tracepoint.c	2000/03/19 21:59:06
@@ -854,7 +854,7 @@
 	signal (STOP_SIGNAL, stop_sig);
     }
 #endif
-  old_chain = make_cleanup ((make_cleanup_func) free_actions, (void *) t);
+  old_chain = make_cleanup (cleanup_actions, t);
   while (1)
     {
       /* Make sure that all output has been output.  Some machines may let
@@ -977,7 +977,7 @@
 	      /* else fall thru, treat p as an expression and parse it! */
 	    }
 	  exp = parse_exp_1 (&p, block_for_pc (t->address), 1);
-	  old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
+	  old_chain = make_cleanup (free_current_contents,
 				    &exp);
 
 	  if (exp->elts[0].opcode == OP_VAR_VALUE)
@@ -1000,7 +1000,7 @@
 	  /* we have something to collect, make sure that the expr to
 	     bytecode translator can handle it and that it's not too long */
 	  aexpr = gen_trace_for_expr (t->address, exp);
-	  (void) make_cleanup ((make_cleanup_func) free_agent_expr, aexpr);
+	  (void) make_cleanup (cleanup_agent_expr, aexpr);
 
 	  if (aexpr->len > MAX_AGENT_EXPR_LEN)
 	    error ("expression too complicated, try simplifying");
@@ -1064,6 +1064,12 @@
   t->actions = NULL;
 }
 
+void
+cleanup_actions (void *arg)
+{
+  free_actions (arg);
+}
+
 struct memrange
 {
   int type;		/* 0 for absolute memory range, else basereg number */
@@ -1588,8 +1594,7 @@
 		  struct agent_reqs areqs;
 
 		  exp = parse_exp_1 (&action_exp, block_for_pc (t->address), 1);
-		  old_chain = make_cleanup ((make_cleanup_func)
-					    free_current_contents, &exp);
+		  old_chain = make_cleanup (free_current_contents, &exp);
 
 		  switch (exp->elts[0].opcode)
 		    {
@@ -1618,8 +1623,7 @@
 		    default:	/* full-fledged expression */
 		      aexpr = gen_trace_for_expr (t->address, exp);
 
-		      old_chain1 = make_cleanup ((make_cleanup_func)
-						 free_agent_expr, aexpr);
+		      old_chain1 = make_cleanup (cleanup_agent_expr, aexpr);
 
 		      ax_reqs (aexpr, &areqs);
 		      if (areqs.flaw != agent_flaw_none)
Index: tracepoint.h
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.h,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 tracepoint.h
--- tracepoint.h	1999/12/07 03:56:07	1.1.1.4
+++ tracepoint.h	2000/03/19 21:59:06
@@ -124,6 +124,7 @@
 struct tracepoint *get_tracepoint_by_number PARAMS ((char **, int, int));
 int get_traceframe_number PARAMS ((void));
 void free_actions PARAMS ((struct tracepoint *));
+void cleanup_actions (void *);
 enum actionline_type validate_actionline PARAMS ((char **,
 						  struct tracepoint *));
 
Index: typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/typeprint.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 typeprint.c
--- typeprint.c	2000/02/02 00:21:11	1.1.1.5
+++ typeprint.c	2000/03/19 21:59:06
@@ -89,7 +89,7 @@
   if (exp)
     {
       expr = parse_expression (exp);
-      old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
+      old_chain = make_cleanup (free_current_contents,
 				&expr);
       val = evaluate_type (expr);
     }
@@ -161,7 +161,7 @@
   else
     {
       expr = parse_expression (typename);
-      old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
+      old_chain = make_cleanup (free_current_contents,
 				&expr);
       type = ptype_eval (expr);
       if (type != NULL)
@@ -282,7 +282,7 @@
   if (typename != NULL)
     {
       expr = parse_expression (typename);
-      old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+      old_chain = make_cleanup (free_current_contents, &expr);
       if (expr->elts[0].opcode == OP_TYPE)
 	{
 	  /* The user expression names a type directly, just use that type. */
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.4
diff -u -r1.4 utils.c
--- utils.c	2000/03/04 02:23:06	1.4
+++ utils.c	2000/03/19 21:59:08
@@ -375,10 +375,9 @@
    to arrange to free the object thus allocated.  */
 
 void
-free_current_contents (location)
-     char **location;
+free_current_contents (void *arg)
 {
-  free (*location);
+  free (*(void **)arg);
 }
 
 /* Provide a known function that does nothing, to use as a base for
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.6
diff -u -r1.6 valops.c
--- valops.c	2000/03/13 10:01:23	1.6
+++ valops.c	2000/03/19 21:59:11
@@ -1370,7 +1370,7 @@
     noprocess ();
 
   inf_status = save_inferior_status (1);
-  old_chain = make_cleanup ((make_cleanup_func) restore_inferior_status,
+  old_chain = make_cleanup (restore_inferior_status,
 			    inf_status);
 
   /* PUSH_DUMMY_FRAME is responsible for saving the inferior registers
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 varobj.c
--- varobj.c	2000/02/03 04:14:36	1.1.1.1
+++ varobj.c	2000/03/19 21:59:13
@@ -174,7 +174,7 @@
 
 static struct varobj *new_root_variable PARAMS ((void));
 
-static void free_variable PARAMS ((struct varobj * var));
+static void free_variable (void *);
 
 static struct type *get_type PARAMS ((struct varobj * var));
 
@@ -410,7 +410,7 @@
 
   /* Fill out a varobj structure for the (root) variable being constructed. */
   var = new_root_variable ();
-  old_chain = make_cleanup ((make_cleanup_func) free_variable, var);
+  old_chain = make_cleanup (free_variable, var);
 
   if (expression != NULL)
     {
@@ -1322,9 +1322,10 @@
 
 /* Free any allocated memory associated with VAR. */
 static void
-free_variable (var)
-     struct varobj *var;
+free_variable (void *arg)
 {
+  struct varobj *var = (struct varobj *) arg;
+
   /* Free the expression if this is a root variable. */
   if (var->root->rootvar == var)
     {
Index: xcoffread.c
===================================================================
RCS file: /cvs/src/src/gdb/xcoffread.c,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 xcoffread.c
--- xcoffread.c	1999/12/07 03:56:07	1.1.1.9
+++ xcoffread.c	2000/03/19 21:59:15
@@ -2743,7 +2743,7 @@
   back_to = make_cleanup (really_free_pendings, 0);
 
   init_minimal_symbol_collection ();
-  make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  make_cleanup (discard_minimal_symbols, 0);
 
   /* Now that the symbol table data of the executable file are all in core,
      process them and define symbols accordingly.  */

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