+Sat Mar 4 10:57:25 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * defs.h (make_cleanup_func): Document as deprecated.
+ (make_cleanup_ftype): New typedef. Make signature consistent with
+ other function typedefs. Document as not be used out side of
+ make_cleanup code. Use in make_cleanup declarations.
+
+ * utils.c (make_cleanup, make_final_cleanup, make_run_cleanup,
+ make_exec_cleanup, make_exec_error_cleanup, make_my_cleanup,
+ null_cleanup): Change K&R definition to ISO-C using void* and
+ make_cleanup_fytpe.
+ (discard_my_cleanups): Don't cast argument to free.
+
2000-03-03 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* defs.h (struct continuation_arg): Change type of field 'data'
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 *);
-extern struct cleanup *make_cleanup (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.
+ Instead either use a bounce function or add a wrapper function.
+ Calling a f(char*) function with f(void*) is non-portable. */
+typedef void (make_cleanup_ftype) (void *);
+
+extern struct cleanup *make_cleanup (make_cleanup_ftype *, void *);
extern struct cleanup *make_cleanup_freeargv (char **);
struct ui_file;
extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *);
-extern struct cleanup *make_final_cleanup (make_cleanup_func, void *);
+extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *);
extern struct cleanup *make_my_cleanup (struct cleanup **,
- make_cleanup_func, void *);
+ make_cleanup_ftype *, void *);
-extern struct cleanup *make_run_cleanup (make_cleanup_func, void *);
+extern struct cleanup *make_run_cleanup (make_cleanup_ftype *, void *);
-extern struct cleanup *make_exec_cleanup (make_cleanup_func, void *);
-extern struct cleanup *make_exec_error_cleanup (make_cleanup_func, void *);
+extern struct cleanup *make_exec_cleanup (make_cleanup_ftype *, void *);
+extern struct cleanup *make_exec_error_cleanup (make_cleanup_ftype *, void *);
extern struct cleanup *save_cleanups (void);
extern struct cleanup *save_final_cleanups (void);
Args are FUNCTION to clean up with, and ARG to pass to it. */
struct cleanup *
-make_cleanup (function, arg)
- void (*function) PARAMS ((PTR));
- PTR arg;
+make_cleanup (make_cleanup_ftype *function, void *arg)
{
return make_my_cleanup (&cleanup_chain, function, arg);
}
struct cleanup *
-make_final_cleanup (function, arg)
- void (*function) PARAMS ((PTR));
- PTR arg;
+make_final_cleanup (make_cleanup_ftype *function, void *arg)
{
return make_my_cleanup (&final_cleanup_chain, function, arg);
}
struct cleanup *
-make_run_cleanup (function, arg)
- void (*function) PARAMS ((PTR));
- PTR arg;
+make_run_cleanup (make_cleanup_ftype *function, void *arg)
{
return make_my_cleanup (&run_cleanup_chain, function, arg);
}
struct cleanup *
-make_exec_cleanup (function, arg)
- void (*function) PARAMS ((PTR));
- PTR arg;
+make_exec_cleanup (make_cleanup_ftype *function, void *arg)
{
return make_my_cleanup (&exec_cleanup_chain, function, arg);
}
struct cleanup *
-make_exec_error_cleanup (function, arg)
- void (*function) PARAMS ((PTR));
- PTR arg;
+make_exec_error_cleanup (make_cleanup_ftype *function, void *arg)
{
return make_my_cleanup (&exec_error_cleanup_chain, function, arg);
}
}
struct cleanup *
-make_my_cleanup (pmy_chain, function, arg)
- struct cleanup **pmy_chain;
- void (*function) PARAMS ((PTR));
- PTR arg;
+make_my_cleanup (struct cleanup **pmy_chain, make_cleanup_ftype *function,
+ void *arg)
{
register struct cleanup *new
= (struct cleanup *) xmalloc (sizeof (struct cleanup));
while ((ptr = *pmy_chain) != old_chain)
{
*pmy_chain = ptr->next;
- free ((PTR) ptr);
+ free (ptr);
}
}
/* ARGSUSED */
void
-null_cleanup (arg)
- PTR arg;
+null_cleanup (void *arg)
{
}