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]

RFA : remove free_current_contents casts


Andrew,

Now that you have fixed `free_current_contents' prototype, we could remove
all the casts made to pass it to `make_cleanup'.

OK to commit ?

Philippe De Muyter  <phdm@macqel.be>

	* ax-gdb.c (agent_command): Remove now useless cast of
	`free_current_contents' when passed to `make_cleanup'.
	* coffread.c (coff_symfile_read): Ditto.
	* dwarf2read.c (dwarf2_add_member_fn, read_array_type): Ditto.
	(dwarf_decode_lines): Ditto.
	* eval.c (parse_and_eval_address, parse_and_eval_address_1): Ditto.
	(parse_and_eval, parse_to_comma_and_eval): Ditto.
	* parse.c (parse_exp_1): Ditto.
	* printcmd.c (print_command_1, output_command, set_command): Ditto.
	(x_command, print_frame_args, printf_command): Ditto.
	* top.c (execute_control_command): Ditto.
	* tracepoint.c (validate_actionline): Ditto.
	* typeprint.c (whatis_exp, ptype_command, maintenance_print_type): Ditto.
	
Index: gdb/ax-gdb.c
===================================================================
RCS file: /cvs/src/src/gdb/ax-gdb.c,v
retrieving revision 1.2
diff -u -p -b -r1.2 ax-gdb.c
--- ax-gdb.c	2000/04/14 18:43:41	1.2
+++ ax-gdb.c	2000/04/24 05:16:31
@@ -1923,7 +1923,7 @@ agent_command (exp, from_tty)
     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);
   ax_print (gdb_stdout, agent);
Index: gdb/coffread.c
===================================================================
RCS file: /cvs/src/src/gdb/coffread.c,v
retrieving revision 1.2
diff -u -p -b -r1.2 coffread.c
--- coffread.c	2000/02/08 04:39:01	1.2
+++ coffread.c	2000/04/24 05:16:34
@@ -638,7 +638,7 @@ coff_symfile_read (objfile, mainline)
   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
Index: gdb/dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.4
diff -u -p -b -r1.4 dwarf2read.c
--- dwarf2read.c	2000/04/08 22:35:35	1.4
+++ dwarf2read.c	2000/04/24 05:16:39
@@ -1998,8 +1998,7 @@ dwarf2_add_member_fn (fip, die, type, ob
 		      (fip->nfnfields + DW_FIELD_ALLOC_CHUNK)
 		      * sizeof (struct fnfieldlist));
 	  if (fip->nfnfields == 0)
-	    make_cleanup ((make_cleanup_func) free_current_contents,
-			  &fip->fnfieldlists);
+	    make_cleanup (free_current_contents, &fip->fnfieldlists);
 	}
       flp = &fip->fnfieldlists[fip->nfnfields];
       flp->name = fieldname;
@@ -2506,8 +2505,7 @@ read_array_type (die, objfile)
 		xrealloc (range_types, (ndim + DW_FIELD_ALLOC_CHUNK)
 			  * sizeof (struct type *));
 	      if (ndim == 0)
-		make_cleanup ((make_cleanup_func) free_current_contents,
-			      &range_types);
+		make_cleanup (free_current_contents, &range_types);
 	    }
 	  range_types[ndim++] = create_range_type (NULL, index_type, low, high);
 	}
@@ -3760,8 +3758,7 @@ dwarf_decode_lines (offset, comp_dir, ab
   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,
-			  &lh.standard_opcode_lengths);
+  back_to = make_cleanup (free_current_contents, &lh.standard_opcode_lengths);
 
   lh.standard_opcode_lengths[0] = 1;
   for (i = 1; i < lh.opcode_base; ++i)
@@ -3780,7 +3777,7 @@ dwarf_decode_lines (offset, comp_dir, ab
 	    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;
     }
@@ -3797,8 +3794,7 @@ dwarf_decode_lines (offset, comp_dir, ab
 		      (files.num_files + FILE_ALLOC_CHUNK)
 		      * sizeof (struct fileinfo));
 	  if (files.num_files == 0)
-	    make_cleanup ((make_cleanup_func) free_current_contents,
-			  &files.files);
+	    make_cleanup (free_current_contents, &files.files);
 	}
       files.files[files.num_files].name = cur_file;
       files.files[files.num_files].dir =
@@ -3873,8 +3869,7 @@ dwarf_decode_lines (offset, comp_dir, ab
 				  (files.num_files + FILE_ALLOC_CHUNK)
 				  * sizeof (struct fileinfo));
 		      if (files.num_files == 0)
-			make_cleanup ((make_cleanup_func) free_current_contents,
-				      &files.files);
+			make_cleanup (free_current_contents, &files.files);
 		    }
 		  files.files[files.num_files].name = cur_file;
 		  files.files[files.num_files].dir =
Index: gdb/eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.4
diff -u -p -b -r1.4 eval.c
--- eval.c	2000/04/14 18:43:41	1.4
+++ eval.c	2000/04/24 05:16:41
@@ -85,7 +85,7 @@ parse_and_eval_address (exp)
   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);
@@ -102,7 +102,7 @@ parse_and_eval_address_1 (expptr)
   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);
@@ -116,7 +116,7 @@ parse_and_eval (exp)
   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);
@@ -134,7 +134,7 @@ parse_to_comma_and_eval (expp)
   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: gdb/parse.c
===================================================================
RCS file: /cvs/src/src/gdb/parse.c,v
retrieving revision 1.2
diff -u -p -b -r1.2 parse.c
--- parse.c	2000/03/28 02:25:14	1.2
+++ parse.c	2000/04/24 05:16:43
@@ -1176,7 +1176,7 @@ parse_exp_1 (stringptr, block, comma)
   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: gdb/printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.5
diff -u -p -b -r1.5 printcmd.c
--- printcmd.c	2000/04/21 04:10:18	1.5
+++ printcmd.c	2000/04/24 05:16:45
@@ -935,8 +935,7 @@ print_command_1 (exp, inspect, voidprint
     {
       struct type *type;
       expr = parse_expression (exp);
-      old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
-				&expr);
+      old_chain = make_cleanup (free_current_contents, &expr);
       cleanup = 1;
       val = evaluate_expression (expr);
 
@@ -1049,7 +1048,7 @@ output_command (exp, from_tty)
     }
 
   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);
 
@@ -1072,8 +1071,8 @@ set_command (exp, from_tty)
      int from_tty;
 {
   struct expression *expr = parse_expression (exp);
-  register struct cleanup *old_chain
-  = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+  register struct cleanup *old_chain =
+    make_cleanup (free_current_contents, &expr);
   evaluate_expression (expr);
   do_cleanups (old_chain);
 }
@@ -1370,8 +1369,7 @@ x_command (exp, from_tty)
          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,
-				&expr);
+      old_chain = make_cleanup (free_current_contents, &expr);
       val = evaluate_expression (expr);
       if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF)
 	val = value_ind (val);
@@ -1854,7 +1852,7 @@ print_frame_args (func, fi, num, stream)
   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)
@@ -1881,8 +1879,8 @@ print_frame_args (func, fi, num, stream)
 
 	    /* Compute address of next argument by adding the size of
 	       this argument and rounding to an int boundary.  */
-	    current_offset
-	      = ((current_offset + arg_size + sizeof (int) - 1)
+	    current_offset =
+	      ((current_offset + arg_size + sizeof (int) - 1)
 		 & ~(sizeof (int) - 1));
 
 	    /* If this is the highest offset seen yet, set highest_offset.  */
@@ -2110,8 +2108,7 @@ printf_command (arg, from_tty)
   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: gdb/top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.10
diff -u -p -b -r1.10 top.c
--- top.c	2000/04/12 16:43:27	1.10
+++ top.c	2000/04/24 05:16:50
@@ -1094,8 +1094,7 @@ execute_control_command (cmd)
       new_line = insert_args (cmd->line);
       if (!new_line)
 	return invalid_control;
-      old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
-				&new_line);
+      old_chain = make_cleanup (free_current_contents, &new_line);
       execute_command (new_line, 0);
       ret = cmd->control_type;
       break;
@@ -1113,10 +1112,9 @@ execute_control_command (cmd)
 	new_line = insert_args (cmd->line);
 	if (!new_line)
 	  return invalid_control;
-	old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
-				  &new_line);
+	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;
@@ -1174,11 +1172,10 @@ execute_control_command (cmd)
 	new_line = insert_args (cmd->line);
 	if (!new_line)
 	  return invalid_control;
-	old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
-				  &new_line);
+	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;
Index: gdb/tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.2
diff -u -p -b -r1.2 tracepoint.c
--- tracepoint.c	2000/04/14 18:43:41	1.2
+++ tracepoint.c	2000/04/24 05:16:52
@@ -977,8 +977,7 @@ validate_actionline (line, t)
 	      /* 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,
-				    &exp);
+	  old_chain = make_cleanup (free_current_contents, &exp);
 
 	  if (exp->elts[0].opcode == OP_VAR_VALUE)
 	    {
Index: gdb/typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/typeprint.c,v
retrieving revision 1.2
diff -u -p -b -r1.2 typeprint.c
--- typeprint.c	2000/04/04 04:53:50	1.2
+++ typeprint.c	2000/04/24 05:16:53
@@ -90,8 +90,7 @@ whatis_exp (exp, show)
   if (exp)
     {
       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_type (expr);
     }
   else
@@ -185,8 +184,7 @@ ptype_command (typename, from_tty)
   else
     {
       expr = parse_expression (typename);
-      old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
-				&expr);
+      old_chain = make_cleanup (free_current_contents, &expr);
       type = ptype_eval (expr);
       if (type != NULL)
 	{
@@ -306,7 +304,7 @@ maintenance_print_type (typename, from_t
   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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]