This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Fix -Wc++-compat and -Wcast-qual warnings in gen*.c et al.


This patch fixes -Wc++-compat and -Wcast-qual warnings mainly in gen*.c.
I tried to ensure that I use allocator macros in all possible cases to
reduce the number of casts visible in the sources.  To that end, I've
added some missing macros in libiberty here:
http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01470.html

I also added some macros for local static allocators below.  I tried to
use at least one of each of the new macros to make sure they work.
(That's why e.g. cse.c got done out of order here.)  I think all but one,
XDUP, now gets used with this patch.  Anyway, the end result is that the
use of naked casts is reduced.

Tested in conjunction with my previous patches listed below on
x86_64-unknown-linux-gnu, no regressions.

http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01419.html
http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01460.html

With these patches, we're down to about 235 warnings left.

Okay for mainline?

		Thanks,
		--Kaveh




2008-06-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or
	-Wcast-qual warnings.
	* gcc.c (process_command): Likewise.
	* genattrtab.c (oballoc): Use XOBNEW.
	(oballocvec): Define.
	(attr_hash_add_rtx, attr_hash_add_string, attr_string,
	get_attr_value, fill_attr, make_length_attrs, gen_attr, gen_insn,
	gen_delay, find_attr, gen_insn_reserv, gen_bypass_1): Fix
	-Wc++-compat and/or -Wcast-qual warnings.
	* genautomata.c (XCREATENODE, XCREATENODEVEC, XCREATENODEVAR,
	XCOPYNODE, XCOPYNODEVEC, XCOPYNODEVAR): New.
	(gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set,
	gen_presence_absence_set, gen_automaton, gen_regexp_el,
	gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof,
	gen_regexp_sequence, gen_reserv, gen_insn_reserv, process_excls,
	add_excls, process_presence_absence_names,
	process_presence_absence_patterns, add_presence_absence,
	process_regexp, add_advance_cycle_insn_decl, get_free_alt_state,
	get_free_state, add_arc, get_free_automata_list_el,
	form_reserv_sets_list, copy_insn_regexp, transform_1, transform_2,
	transform_3, cache_presence, create_ainsns, create_automata,
	create_state_ainsn_table, dfa_insn_code_enlarge,
	output_trans_func, output_min_issue_delay_func,
	output_dead_lock_func, output_reset_func,
	output_get_cpu_unit_code_func, output_dfa_start_func,
	expand_automata): Likewise.
	* genextract.c (gen_insn): Likewise.
	* gengtype-lex.l: Likewise.
	* gengtype.c (read_input_list, adjust_field_type,
	process_gc_options): Likewise.
	* genoutput.c (note_constraint): Likewise.
	* genpreds.c (mangle, add_constraint): Likewise.
	* genrecog.c (process_define_predicate, new_decision,
	add_to_sequence): Likewise.
	* gensupport.c (record_insn_name): Likewise.

diff -rup orig/egcc-SVN20080623/gcc/cse.c egcc-SVN20080623/gcc/cse.c
--- orig/egcc-SVN20080623/gcc/cse.c	2008-06-18 02:02:26.000000000 +0200
+++ egcc-SVN20080623/gcc/cse.c	2008-06-23 23:39:12.000000000 +0200
@@ -663,7 +663,7 @@ static int
 approx_reg_cost_1 (rtx *xp, void *data)
 {
   rtx x = *xp;
-  int *cost_p = data;
+  int *cost_p = (int *) data;

   if (x && REG_P (x))
     {
@@ -4005,7 +4005,7 @@ cse_insn (rtx insn)

   if (GET_CODE (x) == SET)
     {
-      sets = alloca (sizeof (struct set));
+      sets = XALLOCA (struct set);
       sets[0].rtl = x;

       /* Ignore SETs that are unconditional jumps.
@@ -4040,7 +4040,7 @@ cse_insn (rtx insn)
     {
       int lim = XVECLEN (x, 0);

-      sets = alloca (lim * sizeof (struct set));
+      sets = XALLOCAVEC (struct set, lim);

       /* Find all regs explicitly clobbered in this insn,
 	 and ensure they are not replaced with any other regs
diff -rup orig/egcc-SVN20080623/gcc/gcc.c egcc-SVN20080623/gcc/gcc.c
--- orig/egcc-SVN20080623/gcc/gcc.c	2008-06-20 08:21:12.000000000 +0200
+++ egcc-SVN20080623/gcc/gcc.c	2008-06-23 23:24:35.000000000 +0200
@@ -3409,15 +3409,14 @@ process_command (int argc, const char **
       for (baselen = strlen (progname); baselen > 0; baselen--)
 	if (IS_DIR_SEPARATOR (progname[baselen-1]))
 	  break;
-      new_argv0 = (char *) xmemdup (progname, baselen,
+      new_argv0 = XDUPVAR (char, progname, baselen,
 			   baselen + concat_length (new_version, new_machine,
 						    "-gcc-", NULL) + 1);
       strcpy (new_argv0 + baselen, new_machine);
       strcat (new_argv0, "-gcc-");
       strcat (new_argv0, new_version);

-      new_argv = (char **) xmemdup (argv, (argc + 1) * sizeof (argv[0]),
-			  (argc + 1) * sizeof (argv[0]));
+      new_argv = XDUPVEC (char *, argv, argc + 1);
       new_argv[0] = new_argv0;

       execvp (new_argv0, new_argv);
diff -rup orig/egcc-SVN20080623/gcc/genattrtab.c egcc-SVN20080623/gcc/genattrtab.c
--- orig/egcc-SVN20080623/gcc/genattrtab.c	2008-06-07 02:02:46.000000000 +0200
+++ egcc-SVN20080623/gcc/genattrtab.c	2008-06-23 22:39:49.000000000 +0200
@@ -286,7 +286,8 @@ static rtx one_fn		   (rtx);
 static rtx max_fn		   (rtx);
 static rtx min_fn		   (rtx);

-#define oballoc(size) obstack_alloc (hash_obstack, size)
+#define oballoc(T) XOBNEW (hash_obstack, T)
+#define oballocvec(T, N) XOBNEWVEC (hash_obstack, T, (N))

 /* Hash table for sharing RTL and strings.  */

@@ -326,7 +327,7 @@ attr_hash_add_rtx (int hashcode, rtx rtl
 {
   struct attr_hash *h;

-  h = obstack_alloc (hash_obstack, sizeof (struct attr_hash));
+  h = XOBNEW (hash_obstack, struct attr_hash);
   h->hashcode = hashcode;
   h->u.rtl = rtl;
   h->next = attr_hash_table[hashcode % RTL_HASH_SIZE];
@@ -340,7 +341,7 @@ attr_hash_add_string (int hashcode, char
 {
   struct attr_hash *h;

-  h = obstack_alloc (hash_obstack, sizeof (struct attr_hash));
+  h = XOBNEW (hash_obstack, struct attr_hash);
   h->hashcode = -hashcode;
   h->u.str = str;
   h->next = attr_hash_table[hashcode % RTL_HASH_SIZE];
@@ -601,7 +602,7 @@ attr_string (const char *str, int len)
       return h->u.str;			/* <-- return if found.  */

   /* Not found; create a permanent copy and add it to the hash table.  */
-  new_str = obstack_alloc (hash_obstack, len + 1);
+  new_str = XOBNEWVAR (hash_obstack, char, len + 1);
   memcpy (new_str, str, len);
   new_str[len] = '\0';
   attr_hash_add_string (hashcode, new_str);
@@ -1297,7 +1298,7 @@ get_attr_value (rtx value, struct attr_d
 	    || insn_alternatives[av->first_insn->def->insn_code]))
       return av;

-  av = oballoc (sizeof (struct attr_value));
+  av = oballoc (struct attr_value);
   av->value = value;
   av->next = attr->first_value;
   attr->first_value = av;
@@ -1440,7 +1441,7 @@ fill_attr (struct attr_desc *attr)
       else
 	av = get_attr_value (value, attr, id->insn_code);

-      ie = oballoc (sizeof (struct insn_ent));
+      ie = oballoc (struct insn_ent);
       ie->def = id;
       insert_insn_ent (av, ie);
     }
@@ -1571,7 +1572,7 @@ make_length_attrs (void)
 							 no_address_fn[i],
 							 address_fn[i]),
 				     new_attr, ie->def->insn_code);
-	    new_ie = oballoc (sizeof (struct insn_ent));
+	    new_ie = oballoc (struct insn_ent);
 	    new_ie->def = ie->def;
 	    insert_insn_ent (new_av, new_ie);
 	  }
@@ -2949,7 +2950,7 @@ gen_attr (rtx exp, int lineno)
       name_ptr = XSTR (exp, 1);
       while ((p = next_comma_elt (&name_ptr)) != NULL)
 	{
-	  av = oballoc (sizeof (struct attr_value));
+	  av = oballoc (struct attr_value);
 	  av->value = attr_rtx (CONST_STRING, p);
 	  av->next = attr->first_value;
 	  attr->first_value = av;
@@ -3062,7 +3063,7 @@ gen_insn (rtx exp, int lineno)
 {
   struct insn_def *id;

-  id = oballoc (sizeof (struct insn_def));
+  id = oballoc (struct insn_def);
   id->next = defs;
   defs = id;
   id->def = exp;
@@ -3126,7 +3127,7 @@ gen_delay (rtx def, int lineno)
 	have_annul_false = 1;
     }

-  delay = oballoc (sizeof (struct delay_desc));
+  delay = oballoc (struct delay_desc);
   delay->def = def;
   delay->num = ++num_delays;
   delay->next = delays;
@@ -4158,7 +4159,7 @@ find_attr (const char **name_p, int crea
   if (! create)
     return NULL;

-  attr = oballoc (sizeof (struct attr_desc));
+  attr = oballoc (struct attr_desc);
   attr->name = DEF_ATTR_STRING (name);
   attr->first_value = attr->default_val = NULL;
   attr->is_numeric = attr->is_const = attr->is_special = 0;
@@ -4297,7 +4298,7 @@ static size_t n_insn_reservs;
 static void
 gen_insn_reserv (rtx def)
 {
-  struct insn_reserv *decl = oballoc (sizeof (struct insn_reserv));
+  struct insn_reserv *decl = oballoc (struct insn_reserv);

   decl->name            = DEF_ATTR_STRING (XSTR (def, 0));
   decl->default_latency = XINT (def, 1);
@@ -4338,7 +4339,7 @@ gen_bypass_1 (const char *s, size_t len)
     if (s == b->insn)
       return;  /* already got that one */

-  b = oballoc (sizeof (struct bypass_list));
+  b = oballoc (struct bypass_list);
   b->insn = s;
   b->next = all_bypasses;
   all_bypasses = b;
@@ -4544,13 +4545,13 @@ from the machine description file `md'.
   printf ("#define operands recog_data.operand\n\n");

   /* Make `insn_alternatives'.  */
-  insn_alternatives = oballoc (insn_code_number * sizeof (int));
+  insn_alternatives = oballocvec (int, insn_code_number);
   for (id = defs; id; id = id->next)
     if (id->insn_code >= 0)
       insn_alternatives[id->insn_code] = (1 << id->num_alternatives) - 1;

   /* Make `insn_n_alternatives'.  */
-  insn_n_alternatives = oballoc (insn_code_number * sizeof (int));
+  insn_n_alternatives = oballocvec (int, insn_code_number);
   for (id = defs; id; id = id->next)
     if (id->insn_code >= 0)
       insn_n_alternatives[id->insn_code] = id->num_alternatives;
diff -rup orig/egcc-SVN20080623/gcc/genautomata.c egcc-SVN20080623/gcc/genautomata.c
--- orig/egcc-SVN20080623/gcc/genautomata.c	2008-06-07 02:02:46.000000000 +0200
+++ egcc-SVN20080623/gcc/genautomata.c	2008-06-23 23:03:39.000000000 +0200
@@ -1085,6 +1085,14 @@ regexp_mode_check_failed (enum regexp_mo

 #endif /* #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007) */

+#define XCREATENODE(T) ((T *) create_node (sizeof (T)))
+#define XCREATENODEVEC(T, N) ((T *) create_node (sizeof (T) * (N)))
+#define XCREATENODEVAR(T, S) ((T *) create_node ((S)))
+
+#define XCOPYNODE(T, P) ((T *) copy_node ((P), sizeof (T)))
+#define XCOPYNODEVEC(T, P, N) ((T *) copy_node ((P), sizeof (T) * (N)))
+#define XCOPYNODEVAR(T, P, S) ((T *) copy_node ((P), (S)))
+
 /* Create IR structure (node).  */
 static void *
 create_node (size_t size)
@@ -1242,7 +1250,7 @@ gen_cpu_unit (rtx def)
     fatal ("invalid string `%s' in define_cpu_unit", XSTR (def, 0));
   for (i = 0; i < vect_length; i++)
     {
-      decl = create_node (sizeof (struct decl));
+      decl = XCREATENODE (struct decl);
       decl->mode = dm_unit;
       decl->pos = 0;
       DECL_UNIT (decl)->name = check_name (str_cpu_units [i], decl->pos);
@@ -1272,7 +1280,7 @@ gen_query_cpu_unit (rtx def)
     fatal ("invalid string `%s' in define_query_cpu_unit", XSTR (def, 0));
   for (i = 0; i < vect_length; i++)
     {
-      decl = create_node (sizeof (struct decl));
+      decl = XCREATENODE (struct decl);
       decl->mode = dm_unit;
       decl->pos = 0;
       DECL_UNIT (decl)->name = check_name (str_cpu_units [i], decl->pos);
@@ -1306,7 +1314,7 @@ gen_bypass (rtx def)
   for (i = 0; i < out_length; i++)
     for (j = 0; j < in_length; j++)
       {
-	decl = create_node (sizeof (struct decl));
+	decl = XCREATENODE (struct decl);
 	decl->mode = dm_bypass;
 	decl->pos = 0;
 	DECL_BYPASS (decl)->latency = XINT (def, 0);
@@ -1341,7 +1349,7 @@ gen_excl_set (rtx def)
   if (second_str_cpu_units == NULL)
     fatal ("invalid second string `%s' in exclusion_set", XSTR (def, 1));
   length += first_vect_length;
-  decl = create_node (sizeof (struct decl) + (length - 1) * sizeof (char *));
+  decl = XCREATENODEVAR (struct decl, sizeof (struct decl) + (length - 1) * sizeof (char *));
   decl->mode = dm_excl;
   decl->pos = 0;
   DECL_EXCL (decl)->all_names_num = length;
@@ -1394,14 +1402,14 @@ gen_presence_absence_set (rtx def, int p
 	    : (final_p
 	       ? "invalid second string `%s' in final_absence_set"
 	       : "invalid second string `%s' in absence_set")), XSTR (def, 1));
-  str_patterns = obstack_alloc (&irp, patterns_length * sizeof (char **));
+  str_patterns = XOBNEWVEC (&irp, char **, patterns_length);
   for (i = 0; i < patterns_length; i++)
     {
       str_patterns [i] = get_str_vect (str_pattern_lists [i],
 				       &length, ' ', FALSE);
       gcc_assert (str_patterns [i]);
     }
-  decl = create_node (sizeof (struct decl));
+  decl = XCREATENODE (struct decl);
   decl->pos = 0;
   if (presence_p)
     {
@@ -1486,7 +1494,7 @@ gen_automaton (rtx def)
     fatal ("invalid string `%s' in define_automaton", XSTR (def, 0));
   for (i = 0; i < vect_length; i++)
     {
-      decl = create_node (sizeof (struct decl));
+      decl = XCREATENODE (struct decl);
       decl->mode = dm_automaton;
       decl->pos = 0;
       DECL_AUTOMATON (decl)->name = check_name (str_automata [i], decl->pos);
@@ -1539,19 +1547,19 @@ gen_regexp_el (const char *str)
       len = strlen (str);
       if (str [len - 1] != ')')
 	fatal ("garbage after ) in reservation `%s'", reserv_str);
-      dstr = alloca (len - 1);
+      dstr = XALLOCAVAR (char, len - 1);
       memcpy (dstr, str + 1, len - 2);
       dstr [len-2] = '\0';
       regexp = gen_regexp_sequence (dstr);
     }
   else if (strcmp (str, NOTHING_NAME) == 0)
     {
-      regexp = create_node (sizeof *regexp);
+      regexp = XCREATENODE (struct regexp);
       regexp->mode = rm_nothing;
     }
   else
     {
-      regexp = create_node (sizeof *regexp);
+      regexp = XCREATENODE (struct regexp);
       regexp->mode = rm_unit;
       REGEXP_UNIT (regexp)->name = str;
     }
@@ -1576,7 +1584,7 @@ gen_regexp_repeat (const char *str)
       regexp = gen_regexp_el (repeat_vect [0]);
       for (i = 1; i < els_num; i++)
 	{
-	  repeat = create_node (sizeof (struct regexp));
+	  repeat = XCREATENODE (struct regexp);
 	  repeat->mode = rm_repeat;
 	  REGEXP_REPEAT (repeat)->regexp = regexp;
 	  REGEXP_REPEAT (repeat)->repeat_num = atoi (repeat_vect [i]);
@@ -1605,8 +1613,8 @@ gen_regexp_allof (const char *str)
     fatal ("invalid `%s' in reservation `%s'", str, reserv_str);
   if (els_num > 1)
     {
-      allof = create_node (sizeof (struct regexp)
-			   + sizeof (regexp_t) * (els_num - 1));
+      allof = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+			      + sizeof (regexp_t) * (els_num - 1));
       allof->mode = rm_allof;
       REGEXP_ALLOF (allof)->regexps_num = els_num;
       for (i = 0; i < els_num; i++)
@@ -1631,8 +1639,8 @@ gen_regexp_oneof (const char *str)
     fatal ("invalid `%s' in reservation `%s'", str, reserv_str);
   if (els_num > 1)
     {
-      oneof = create_node (sizeof (struct regexp)
-			   + sizeof (regexp_t) * (els_num - 1));
+      oneof = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+			      + sizeof (regexp_t) * (els_num - 1));
       oneof->mode = rm_oneof;
       REGEXP_ONEOF (oneof)->regexps_num = els_num;
       for (i = 0; i < els_num; i++)
@@ -1655,8 +1663,8 @@ gen_regexp_sequence (const char *str)
   sequence_vect = get_str_vect (str, &els_num, ',', TRUE);
   if (els_num > 1)
     {
-      sequence = create_node (sizeof (struct regexp)
-			      + sizeof (regexp_t) * (els_num - 1));
+      sequence = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+				 + sizeof (regexp_t) * (els_num - 1));
       sequence->mode = rm_sequence;
       REGEXP_SEQUENCE (sequence)->regexps_num = els_num;
       for (i = 0; i < els_num; i++)
@@ -1686,7 +1694,7 @@ gen_reserv (rtx def)
 {
   decl_t decl;

-  decl = create_node (sizeof (struct decl));
+  decl = XCREATENODE (struct decl);
   decl->mode = dm_reserv;
   decl->pos = 0;
   DECL_RESERV (decl)->name = check_name (XSTR (def, 0), decl->pos);
@@ -1704,7 +1712,7 @@ gen_insn_reserv (rtx def)
 {
   decl_t decl;

-  decl = create_node (sizeof (struct decl));
+  decl = XCREATENODE (struct decl);
   decl->mode = dm_insn_reserv;
   decl->pos = 0;
   DECL_INSN_RESERV (decl)->name
@@ -2052,7 +2060,7 @@ process_excls (char **names, int num, po
 	error ("`%s' in exclusion is not unit", names [i]);
       else
 	{
-	  new_el = create_node (sizeof (struct unit_set_el));
+	  new_el = XCREATENODE (struct unit_set_el);
 	  new_el->unit_decl = DECL_UNIT (decl_in_table);
 	  new_el->next_unit_set_el = NULL;
 	  if (last_el == NULL)
@@ -2105,7 +2113,7 @@ add_excls (unit_set_el_t dest_list, unit
 	if (curr_el == NULL)
 	  {
 	    /* Element not found - insert.  */
-	    copy = copy_node (src, sizeof (*src));
+	    copy = XCOPYNODE (struct unit_set_el, src);
 	    copy->next_unit_set_el = NULL;
 	    if (prev_el == NULL)
 	      dst->unit_decl->excl_list = copy;
@@ -2152,7 +2160,7 @@ process_presence_absence_names (char **n
 		   : "`%s' in absence set is not unit")), names [i]);
       else
 	{
-	  new_el = create_node (sizeof (struct unit_set_el));
+	  new_el = XCREATENODE (struct unit_set_el);
 	  new_el->unit_decl = DECL_UNIT (decl_in_table);
 	  new_el->next_unit_set_el = NULL;
 	  if (last_el == NULL)
@@ -2187,8 +2195,9 @@ process_presence_absence_patterns (char
     {
       for (j = 0; patterns [i] [j] != NULL; j++)
 	;
-      new_el = create_node (sizeof (struct pattern_set_el)
-			    + sizeof (struct unit_decl *) * j);
+      new_el = XCREATENODEVAR (struct pattern_set_el,
+			       sizeof (struct pattern_set_el)
+			       + sizeof (struct unit_decl *) * j);
       new_el->unit_decls
 	= (struct unit_decl **) ((char *) new_el
 				 + sizeof (struct pattern_set_el));
@@ -2334,7 +2343,7 @@ add_presence_absence (unit_set_el_t dest
 		     prev_el != NULL && prev_el->next_pattern_set_el != NULL;
 		     prev_el = prev_el->next_pattern_set_el)
 		  ;
-		copy = copy_node (pat, sizeof (*pat));
+		copy = XCOPYNODE (struct pattern_set_el, pat);
 		copy->next_pattern_set_el = NULL;
 		if (prev_el == NULL)
 		  {
@@ -2664,7 +2673,7 @@ process_regexp (regexp_t regexp)

 	  case dm_reserv:
 	    DECL_RESERV (decl_in_table)->reserv_is_used = 1;
-	    new_regexp = create_node (sizeof (struct regexp));
+	    new_regexp = XCREATENODE (struct regexp);
 	    new_regexp->mode = rm_reserv;
 	    new_regexp->pos = regexp->pos;
 	    REGEXP_RESERV (new_regexp)->name = REGEXP_UNIT (regexp)->name;
@@ -3105,7 +3114,7 @@ static decl_t advance_cycle_insn_decl;
 static void
 add_advance_cycle_insn_decl (void)
 {
-  advance_cycle_insn_decl = create_node (sizeof (struct decl));
+  advance_cycle_insn_decl = XCREATENODE (struct decl);
   advance_cycle_insn_decl->mode = dm_insn_reserv;
   advance_cycle_insn_decl->pos = no_pos;
   DECL_INSN_RESERV (advance_cycle_insn_decl)->regexp = NULL;
@@ -3148,7 +3157,7 @@ get_free_alt_state (void)
 #ifndef NDEBUG
       allocated_alt_states_num++;
 #endif
-      result = create_node (sizeof (struct alt_state));
+      result = XCREATENODE (struct alt_state);
     }
   result->state = NULL;
   result->next_alt_state = NULL;
@@ -3623,7 +3632,7 @@ get_free_state (int with_reservs, automa
 #ifndef NDEBUG
       allocated_states_num++;
 #endif
-      result = create_node (sizeof (struct state));
+      result = XCREATENODE (struct state);
       result->automaton = automaton;
       result->first_out_arc = NULL;
       result->unique_num = curr_unique_state_num;
@@ -3890,7 +3899,7 @@ add_arc (state_t from_state, state_t to_
 #ifndef NDEBUG
       allocated_arcs_num++;
 #endif
-      new_arc = create_node (sizeof (struct arc));
+      new_arc = XCREATENODE (struct arc);
       new_arc->to_state = NULL;
       new_arc->insn = NULL;
       new_arc->next_out_arc = NULL;
@@ -3964,7 +3973,7 @@ get_free_automata_list_el (void)
 	= first_free_automata_list_el->next_automata_list_el;
     }
   else
-    result = create_node (sizeof (struct automata_list_el));
+    result = XCREATENODE (struct automata_list_el);
   result->automaton = NULL;
   result->next_automata_list_el = NULL;
   return result;
@@ -4191,7 +4200,7 @@ form_reserv_sets_list (pattern_set_el_t
   prev = first = NULL;
   for (el = pattern_list; el != NULL; el = el->next_pattern_set_el)
     {
-      curr = create_node (sizeof (struct pattern_reserv));
+      curr = XCREATENODE (struct pattern_reserv);
       curr->reserv = alloc_empty_reserv_sets ();
       curr->next_pattern_reserv = NULL;
       for (i = 0; i < el->units_num; i++)
@@ -4362,44 +4371,44 @@ copy_insn_regexp (regexp_t regexp)
       break;

     case rm_unit:
-      result = copy_node (regexp, sizeof (struct regexp));
+      result = XCOPYNODE (struct regexp, regexp);
       break;

     case rm_repeat:
-      result = copy_node (regexp, sizeof (struct regexp));
+      result = XCOPYNODE (struct regexp, regexp);
       REGEXP_REPEAT (result)->regexp
         = copy_insn_regexp (REGEXP_REPEAT (regexp)->regexp);
       break;

     case rm_sequence:
-      result = copy_node (regexp,
-                          sizeof (struct regexp) + sizeof (regexp_t)
-			  * (REGEXP_SEQUENCE (regexp)->regexps_num - 1));
+      result = XCOPYNODEVAR (struct regexp, regexp,
+			     sizeof (struct regexp) + sizeof (regexp_t)
+			     * (REGEXP_SEQUENCE (regexp)->regexps_num - 1));
       for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
 	REGEXP_SEQUENCE (result)->regexps [i]
 	  = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
       break;

     case rm_allof:
-      result = copy_node (regexp,
-                          sizeof (struct regexp) + sizeof (regexp_t)
-			  * (REGEXP_ALLOF (regexp)->regexps_num - 1));
+      result = XCOPYNODEVAR (struct regexp, regexp,
+			     sizeof (struct regexp) + sizeof (regexp_t)
+			     * (REGEXP_ALLOF (regexp)->regexps_num - 1));
       for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
 	REGEXP_ALLOF (result)->regexps [i]
 	  = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
       break;

     case rm_oneof:
-      result = copy_node (regexp,
-                          sizeof (struct regexp) + sizeof (regexp_t)
-			  * (REGEXP_ONEOF (regexp)->regexps_num - 1));
+      result = XCOPYNODEVAR (struct regexp, regexp,
+			     sizeof (struct regexp) + sizeof (regexp_t)
+			     * (REGEXP_ONEOF (regexp)->regexps_num - 1));
       for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
 	REGEXP_ONEOF (result)->regexps [i]
 	  = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
       break;

     case rm_nothing:
-      result = copy_node (regexp, sizeof (struct regexp));
+      result = XCOPYNODE (struct regexp, regexp);
       break;

     default:
@@ -4428,8 +4437,8 @@ transform_1 (regexp_t regexp)
       gcc_assert (repeat_num > 1);
       operand = REGEXP_REPEAT (regexp)->regexp;
       pos = regexp->mode;
-      regexp = create_node (sizeof (struct regexp) + sizeof (regexp_t)
-			    * (repeat_num - 1));
+      regexp = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+			       + sizeof (regexp_t) * (repeat_num - 1));
       regexp->mode = rm_sequence;
       regexp->pos = pos;
       REGEXP_SEQUENCE (regexp)->regexps_num = repeat_num;
@@ -4465,11 +4474,11 @@ transform_2 (regexp_t regexp)
 	{
 	  gcc_assert (REGEXP_SEQUENCE (sequence)->regexps_num > 1
 		      && REGEXP_SEQUENCE (regexp)->regexps_num > 1);
-	  result = create_node (sizeof (struct regexp)
-                                + sizeof (regexp_t)
-				* (REGEXP_SEQUENCE (regexp)->regexps_num
-                                   + REGEXP_SEQUENCE (sequence)->regexps_num
-                                   - 2));
+	  result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+				   + sizeof (regexp_t)
+				   * (REGEXP_SEQUENCE (regexp)->regexps_num
+				      + REGEXP_SEQUENCE (sequence)->regexps_num
+				      - 2));
 	  result->mode = rm_sequence;
 	  result->pos = regexp->pos;
 	  REGEXP_SEQUENCE (result)->regexps_num
@@ -4509,10 +4518,10 @@ transform_2 (regexp_t regexp)
 	{
 	  gcc_assert (REGEXP_ALLOF (allof)->regexps_num > 1
 		      && REGEXP_ALLOF (regexp)->regexps_num > 1);
-	  result = create_node (sizeof (struct regexp)
-                                + sizeof (regexp_t)
-				* (REGEXP_ALLOF (regexp)->regexps_num
-                                   + REGEXP_ALLOF (allof)->regexps_num - 2));
+	  result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+				   + sizeof (regexp_t)
+				   * (REGEXP_ALLOF (regexp)->regexps_num
+				      + REGEXP_ALLOF (allof)->regexps_num - 2));
 	  result->mode = rm_allof;
 	  result->pos = regexp->pos;
 	  REGEXP_ALLOF (result)->regexps_num
@@ -4552,10 +4561,10 @@ transform_2 (regexp_t regexp)
 	{
 	  gcc_assert (REGEXP_ONEOF (oneof)->regexps_num > 1
 		      && REGEXP_ONEOF (regexp)->regexps_num > 1);
-	  result = create_node (sizeof (struct regexp)
-				+ sizeof (regexp_t)
-				* (REGEXP_ONEOF (regexp)->regexps_num
-                                   + REGEXP_ONEOF (oneof)->regexps_num - 2));
+	  result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+				   + sizeof (regexp_t)
+				   * (REGEXP_ONEOF (regexp)->regexps_num
+				      + REGEXP_ONEOF (oneof)->regexps_num - 2));
 	  result->mode = rm_oneof;
 	  result->pos = regexp->pos;
 	  REGEXP_ONEOF (result)->regexps_num
@@ -4607,9 +4616,9 @@ transform_3 (regexp_t regexp)
 	{
 	  gcc_assert (REGEXP_ONEOF (oneof)->regexps_num > 1
 		      && REGEXP_SEQUENCE (regexp)->regexps_num > 1);
-	  result = create_node (sizeof (struct regexp)
-				+ sizeof (regexp_t)
-				* (REGEXP_ONEOF (oneof)->regexps_num - 1));
+	  result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+				   + sizeof (regexp_t)
+				   * (REGEXP_ONEOF (oneof)->regexps_num - 1));
 	  result->mode = rm_oneof;
 	  result->pos = regexp->pos;
 	  REGEXP_ONEOF (result)->regexps_num
@@ -4617,9 +4626,9 @@ transform_3 (regexp_t regexp)
 	  for (i = 0; i < REGEXP_ONEOF (result)->regexps_num; i++)
 	    {
 	      sequence
-                = create_node (sizeof (struct regexp)
-                               + sizeof (regexp_t)
-                               * (REGEXP_SEQUENCE (regexp)->regexps_num - 1));
+                = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+				  + sizeof (regexp_t)
+				  * (REGEXP_SEQUENCE (regexp)->regexps_num - 1));
 	      sequence->mode = rm_sequence;
 	      sequence->pos = regexp->pos;
 	      REGEXP_SEQUENCE (sequence)->regexps_num
@@ -4659,9 +4668,9 @@ transform_3 (regexp_t regexp)
 	{
 	  gcc_assert (REGEXP_ONEOF (oneof)->regexps_num > 1
 		      && REGEXP_ALLOF (regexp)->regexps_num > 1);
-	  result = create_node (sizeof (struct regexp)
-				+ sizeof (regexp_t)
-				* (REGEXP_ONEOF (oneof)->regexps_num - 1));
+	  result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+				   + sizeof (regexp_t)
+				   * (REGEXP_ONEOF (oneof)->regexps_num - 1));
 	  result->mode = rm_oneof;
 	  result->pos = regexp->pos;
 	  REGEXP_ONEOF (result)->regexps_num
@@ -4669,9 +4678,9 @@ transform_3 (regexp_t regexp)
 	  for (i = 0; i < REGEXP_ONEOF (result)->regexps_num; i++)
 	    {
 	      allof
-		= create_node (sizeof (struct regexp)
-                               + sizeof (regexp_t)
-			       * (REGEXP_ALLOF (regexp)->regexps_num - 1));
+		= XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+				  + sizeof (regexp_t)
+				  * (REGEXP_ALLOF (regexp)->regexps_num - 1));
 	      allof->mode = rm_allof;
 	      allof->pos = regexp->pos;
 	      REGEXP_ALLOF (allof)->regexps_num
@@ -4714,8 +4723,8 @@ transform_3 (regexp_t regexp)
 	{
 	  gcc_assert (max_seq_length != 1
 		      && REGEXP_ALLOF (regexp)->regexps_num > 1);
-	  result = create_node (sizeof (struct regexp)
-				+ sizeof (regexp_t) * (max_seq_length - 1));
+	  result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+				   + sizeof (regexp_t) * (max_seq_length - 1));
 	  result->mode = rm_sequence;
 	  result->pos = regexp->pos;
 	  REGEXP_SEQUENCE (result)->regexps_num = max_seq_length;
@@ -4752,9 +4761,9 @@ transform_3 (regexp_t regexp)
 		REGEXP_SEQUENCE (result)->regexps [i] = allof_op;
 	      else
 		{
-		  allof = create_node (sizeof (struct regexp)
-				       + sizeof (regexp_t)
-				       * (allof_length - 1));
+		  allof = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
+					  + sizeof (regexp_t)
+					  * (allof_length - 1));
 		  allof->mode = rm_allof;
 		  allof->pos = regexp->pos;
 		  REGEXP_ALLOF (allof)->regexps_num = allof_length;
@@ -5669,7 +5678,7 @@ cache_presence (state_t state)
   sz = (description->query_units_num + sizeof (int) * CHAR_BIT - 1)
         / (sizeof (int) * CHAR_BIT);

-  state->presence_signature = create_node (sz * sizeof (int));
+  state->presence_signature = XCREATENODEVEC (unsigned int, sz);
   for (i = 0; i < description->units_num; i++)
     if (units_array [i]->query_p)
       {
@@ -6397,7 +6406,7 @@ create_ainsns (void)
       decl = description->decls [i];
       if (decl->mode == dm_insn_reserv)
 	{
-	  curr_ainsn = create_node (sizeof (struct ainsn));
+	  curr_ainsn = XCREATENODE (struct ainsn);
 	  curr_ainsn->insn_reserv_decl = DECL_INSN_RESERV (decl);
 	  curr_ainsn->important_p = FALSE;
 	  curr_ainsn->next_ainsn = NULL;
@@ -6455,7 +6464,7 @@ create_automata (void)
            curr_automaton_num < automata_num;
            curr_automaton_num++, prev_automaton = curr_automaton)
         {
-	  curr_automaton = create_node (sizeof (struct automaton));
+	  curr_automaton = XCREATENODE (struct automaton);
 	  curr_automaton->ainsn_list = create_ainsns ();
 	  curr_automaton->corresponding_automaton_decl = NULL;
 	  curr_automaton->next_automaton = NULL;
@@ -6476,7 +6485,7 @@ create_automata (void)
 	  if (decl->mode == dm_automaton
 	      && DECL_AUTOMATON (decl)->automaton_is_used)
 	    {
-	      curr_automaton = create_node (sizeof (struct automaton));
+	      curr_automaton = XCREATENODE (struct automaton);
 	      curr_automaton->ainsn_list = create_ainsns ();
 	      curr_automaton->corresponding_automaton_decl
 		= DECL_AUTOMATON (decl);
@@ -6493,7 +6502,7 @@ create_automata (void)
 	}
       if (curr_automaton_num == 0)
 	{
-	  curr_automaton = create_node (sizeof (struct automaton));
+	  curr_automaton = XCREATENODE (struct automaton);
 	  curr_automaton->ainsn_list = create_ainsns ();
 	  curr_automaton->corresponding_automaton_decl = NULL;
 	  curr_automaton->next_automaton = NULL;
@@ -6994,7 +7003,7 @@ create_state_ainsn_table (automaton_t au
   int full_vect_length;
   int i;

-  tab = create_node (sizeof (struct state_ainsn_table));
+  tab = XCREATENODE (struct state_ainsn_table);
   tab->automaton = automaton;

   tab->comb_vect  = VEC_alloc (vect_el_t,heap, 10000);
@@ -7908,8 +7917,8 @@ dfa_insn_code_enlarge (int uid)\n\
 {\n\
   int i = %s;\n\
   %s = 2 * uid;\n\
-  %s = xrealloc (%s,\n\
-                 %s * sizeof(int));\n\
+  %s = XRESIZEVEC (int, %s,\n\
+                 %s);\n\
   for (; i < %s; i++)\n\
     %s[i] = -1;\n}\n\n",
 	   DFA_INSN_CODES_LENGTH_VARIABLE_NAME,
@@ -7954,8 +7963,8 @@ output_trans_func (void)
   fprintf (output_file, "{\n  int %s;\n", INTERNAL_INSN_CODE_NAME);
   output_internal_insn_code_evaluation (INSN_PARAMETER_NAME,
 					INTERNAL_INSN_CODE_NAME, -1);
-  fprintf (output_file, "  return %s (%s, %s);\n}\n\n",
-	   INTERNAL_TRANSITION_FUNC_NAME, INTERNAL_INSN_CODE_NAME, STATE_NAME);
+  fprintf (output_file, "  return %s (%s, (struct %s *) %s);\n}\n\n",
+	   INTERNAL_TRANSITION_FUNC_NAME, INTERNAL_INSN_CODE_NAME, CHIP_NAME, STATE_NAME);
 }

 /* Output function `min_issue_delay'.  */
@@ -7973,9 +7982,9 @@ output_min_issue_delay_func (void)
 	   INTERNAL_INSN_CODE_NAME, ADVANCE_CYCLE_VALUE_NAME);
   fprintf (output_file, "    }\n  else\n    %s = %s;\n",
 	   INTERNAL_INSN_CODE_NAME, ADVANCE_CYCLE_VALUE_NAME);
-  fprintf (output_file, "\n  return %s (%s, %s);\n",
+  fprintf (output_file, "\n  return %s (%s, (struct %s *) %s);\n",
 	   INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME, INTERNAL_INSN_CODE_NAME,
-	   STATE_NAME);
+	   CHIP_NAME, STATE_NAME);
   fprintf (output_file, "}\n\n");
 }

@@ -8008,8 +8017,8 @@ output_dead_lock_func (void)
 {
   fprintf (output_file, "int\n%s (%s %s)\n",
 	   DEAD_LOCK_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME);
-  fprintf (output_file, "{\n  return %s (%s);\n}\n\n",
-	   INTERNAL_DEAD_LOCK_FUNC_NAME, STATE_NAME);
+  fprintf (output_file, "{\n  return %s ((struct %s *) %s);\n}\n\n",
+	   INTERNAL_DEAD_LOCK_FUNC_NAME, CHIP_NAME, STATE_NAME);
 }

 /* Output function `internal_reset'.  */
@@ -8036,8 +8045,8 @@ output_reset_func (void)
 {
   fprintf (output_file, "void\n%s (%s %s)\n",
 	   RESET_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME);
-  fprintf (output_file, "{\n  %s (%s);\n}\n\n", INTERNAL_RESET_FUNC_NAME,
-	   STATE_NAME);
+  fprintf (output_file, "{\n  %s ((struct %s *) %s);\n}\n\n", INTERNAL_RESET_FUNC_NAME,
+	   CHIP_NAME, STATE_NAME);
 }

 /* Output function `min_insn_conflict_delay'.  */
@@ -8284,7 +8293,7 @@ output_get_cpu_unit_code_func (void)
 	   LOW_VARIABLE_NAME, MIDDLE_VARIABLE_NAME, HIGH_VARIABLE_NAME);
   fprintf (output_file, "  static struct %s %s [] =\n    {\n",
 	   NAME_CODE_STRUCT_NAME, NAME_CODE_TABLE_NAME);
-  units = xmalloc (sizeof (unit_decl_t) * description->units_num);
+  units = XNEWVEC (unit_decl_t, description->units_num);
   memcpy (units, units_array, sizeof (unit_decl_t) * description->units_num);
   qsort (units, description->units_num, sizeof (unit_decl_t), units_cmp);
   for (i = 0; i < description->units_num; i++)
@@ -8416,7 +8425,7 @@ output_dfa_start_func (void)
   fprintf (output_file,
 	   "void\n%s (void)\n{\n  %s = get_max_uid ();\n",
 	   DFA_START_FUNC_NAME, DFA_INSN_CODES_LENGTH_VARIABLE_NAME);
-  fprintf (output_file, "  %s = xmalloc (%s * sizeof (int));\n",
+  fprintf (output_file, "  %s = XNEWVEC (int, %s);\n",
 	   DFA_INSN_CODES_VARIABLE_NAME, DFA_INSN_CODES_LENGTH_VARIABLE_NAME);
   fprintf (output_file, "  %s ();\n}\n\n", DFA_CLEAN_INSN_CACHE_FUNC_NAME);
 }
@@ -9099,9 +9108,10 @@ expand_automata (void)
 {
   int i;

-  description = create_node (sizeof (struct description)
-			     /* One entry for cycle advancing insn.  */
-			     + sizeof (decl_t) * VEC_length (decl_t, decls));
+  description = XCREATENODEVAR (struct description,
+				sizeof (struct description)
+				/* One entry for cycle advancing insn.  */
+				+ sizeof (decl_t) * VEC_length (decl_t, decls));
   description->decls_num = VEC_length (decl_t, decls);
   description->query_units_num = 0;
   for (i = 0; i < description->decls_num; i++)
diff -rup orig/egcc-SVN20080623/gcc/genextract.c egcc-SVN20080623/gcc/genextract.c
--- orig/egcc-SVN20080623/gcc/genextract.c	2008-03-14 00:35:35.000000000 +0100
+++ egcc-SVN20080623/gcc/genextract.c	2008-06-23 22:41:32.000000000 +0200
@@ -152,7 +152,7 @@ gen_insn (rtx insn, int insn_code_number
   /* Otherwise, make a new extraction method.  We stash the arrays
      after the extraction structure in memory.  */

-  p = xmalloc (sizeof (struct extraction)
+  p = XNEWVAR (struct extraction, sizeof (struct extraction)
 	       + op_count*sizeof (char *)
 	       + dup_count*sizeof (char *)
 	       + dup_count*sizeof (int));
diff -rup orig/egcc-SVN20080623/gcc/gengtype-lex.l egcc-SVN20080623/gcc/gengtype-lex.l
--- orig/egcc-SVN20080623/gcc/gengtype-lex.l	2008-03-14 00:39:19.000000000 +0100
+++ egcc-SVN20080623/gcc/gengtype-lex.l	2008-06-23 22:48:45.000000000 +0200
@@ -116,7 +116,7 @@ EOID	[^[:alnum:]_]
 "nested_ptr"/{EOID}		{ return NESTED_PTR; }
 [0-9]+				{ return NUM; }
 "param"[0-9]*"_is"/{EOID}		{
-  *yylval = xmemdup (yytext, yyleng, yyleng+1);
+  *yylval = XDUPVAR (const char, yytext, yyleng, yyleng+1);
   return PARAM_IS;
 }

@@ -127,28 +127,28 @@ EOID	[^[:alnum:]_]
   for (len = yyleng; ISSPACE (yytext[len-1]); len--)
     ;

-  *yylval = xmemdup (yytext, len, len+1);
+  *yylval = XDUPVAR (const char, yytext, len, len+1);
   update_lineno (yytext, yyleng);
   return SCALAR;
 }


 {ID}/{EOID}			{
-  *yylval = xmemdup (yytext, yyleng, yyleng+1);
+  *yylval = XDUPVAR (const char, yytext, yyleng, yyleng+1);
   return ID;
 }

 \"([^"\\]|\\.)*\"		{
-  *yylval = xmemdup (yytext+1, yyleng-2, yyleng-1);
+  *yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng-1);
   return STRING;
 }
   /* This "terminal" avoids having to parse integer constant expressions.  */
 "["[^\[\]]*"]"			{
-  *yylval = xmemdup (yytext+1, yyleng-2, yyleng-1);
+  *yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng-1);
   return ARRAY;
 }
 "'"("\\".|[^\\])"'"		{
-  *yylval = xmemdup (yytext+1, yyleng-2, yyleng);
+  *yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng);
   return CHAR;
 }

diff -rup orig/egcc-SVN20080623/gcc/gengtype.c egcc-SVN20080623/gcc/gengtype.c
--- orig/egcc-SVN20080623/gcc/gengtype.c	2008-05-22 02:02:50.000000000 +0200
+++ egcc-SVN20080623/gcc/gengtype.c	2008-06-23 23:10:38.000000000 +0200
@@ -433,7 +433,7 @@ read_input_list (const char *listname)
 				     : lang_dir_names[langno - 1]);

 		    bmap |= curlangs;
-		    set_lang_bitmap ((char *)gt_files[i], bmap);
+		    set_lang_bitmap (CONST_CAST(char *, gt_files[i]), bmap);
 		    here = committed;
 		    goto next_line;
 		  }
@@ -1266,9 +1266,9 @@ adjust_field_type (type_p t, options_p o
 	if (params[num] != NULL)
 	  error_at_line (&lexer_line, "duplicate `%s' option", opt->name);
 	if (! ISDIGIT (opt->name[5]))
-	  params[num] = create_pointer ((type_p) opt->info);
+	  params[num] = create_pointer (CONST_CAST2(type_p, const char *, opt->info));
 	else
-	  params[num] = (type_p) opt->info;
+	  params[num] = CONST_CAST2 (type_p, const char *, opt->info);
       }
     else if (strcmp (opt->name, "special") == 0)
       {
@@ -1317,7 +1317,8 @@ process_gc_options (options_p opt, enum
   options_p o;
   for (o = opt; o; o = o->next)
     if (strcmp (o->name, "ptr_alias") == 0 && level == GC_POINTED_TO)
-      set_gc_used_type ((type_p) o->info, GC_POINTED_TO, NULL);
+      set_gc_used_type (CONST_CAST2 (type_p, const char *, o->info),
+			GC_POINTED_TO, NULL);
     else if (strcmp (o->name, "maybe_undef") == 0)
       *maybe_undef = 1;
     else if (strcmp (o->name, "use_params") == 0)
diff -rup orig/egcc-SVN20080623/gcc/genoutput.c egcc-SVN20080623/gcc/genoutput.c
--- orig/egcc-SVN20080623/gcc/genoutput.c	2008-05-28 02:46:36.000000000 +0200
+++ egcc-SVN20080623/gcc/genoutput.c	2008-06-23 22:42:37.000000000 +0200
@@ -1173,7 +1173,7 @@ note_constraint (rtx exp, int lineno)
 	  return;
 	}
     }
-  new = xmalloc (sizeof (struct constraint_data) + namelen);
+  new = XNEWVAR (struct constraint_data, sizeof (struct constraint_data) + namelen);
   strcpy ((char *)new + offsetof(struct constraint_data, name), name);
   new->namelen = namelen;
   new->lineno = lineno;
diff -rup orig/egcc-SVN20080623/gcc/genpreds.c egcc-SVN20080623/gcc/genpreds.c
--- orig/egcc-SVN20080623/gcc/genpreds.c	2008-05-28 02:46:36.000000000 +0200
+++ egcc-SVN20080623/gcc/genpreds.c	2008-06-23 21:13:51.000000000 +0200
@@ -732,7 +732,7 @@ mangle (const char *name)
       }

   obstack_1grow (rtl_obstack, '\0');
-  return obstack_finish (rtl_obstack);
+  return XOBFINISH (rtl_obstack, const char *);
 }

 /* Add one constraint, of any sort, to the tables.  NAME is its name;
@@ -897,7 +897,7 @@ add_constraint (const char *name, const
     }


-  c = obstack_alloc (rtl_obstack, sizeof (struct constraint_data));
+  c = XOBNEW (rtl_obstack, struct constraint_data);
   c->name = name;
   c->c_name = need_mangled_name ? mangle (name) : name;
   c->lineno = lineno;
diff -rup orig/egcc-SVN20080623/gcc/genrecog.c egcc-SVN20080623/gcc/genrecog.c
--- orig/egcc-SVN20080623/gcc/genrecog.c	2008-05-09 02:02:27.000000000 +0200
+++ egcc-SVN20080623/gcc/genrecog.c	2008-06-23 21:12:02.000000000 +0200
@@ -366,7 +366,7 @@ compute_predicate_codes (rtx exp, char c
 static void
 process_define_predicate (rtx desc)
 {
-  struct pred_data *pred = xcalloc (sizeof (struct pred_data), 1);
+  struct pred_data *pred = XCNEW (struct pred_data);
   char codes[NUM_RTX_CODE];
   int i;

@@ -474,7 +474,7 @@ extern void debug_decision_list
 static struct decision *
 new_decision (const char *position, struct decision_head *last)
 {
-  struct decision *new = xcalloc (1, sizeof (struct decision));
+  struct decision *new = XCNEW (struct decision);

   new->success = *last;
   new->position = xstrdup (position);
@@ -890,7 +890,7 @@ add_to_sequence (rtx pattern, struct dec
   if (depth > max_depth)
     max_depth = depth;

-  subpos = xmalloc (depth + 2);
+  subpos = XNEWVAR (char, depth + 2);
   strcpy (subpos, position);
   subpos[depth + 1] = 0;

diff -rup orig/egcc-SVN20080623/gcc/gensupport.c egcc-SVN20080623/gcc/gensupport.c
--- orig/egcc-SVN20080623/gcc/gensupport.c	2008-05-09 02:02:27.000000000 +0200
+++ egcc-SVN20080623/gcc/gensupport.c	2008-06-23 21:10:16.000000000 +0200
@@ -1434,7 +1434,7 @@ record_insn_name (int code, const char *
     {
       int new_size;
       new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512);
-      insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size);
+      insn_name_ptr = XRESIZEVEC (char *, insn_name_ptr, new_size);
       memset (insn_name_ptr + insn_name_ptr_size, 0,
 	      sizeof(char *) * (new_size - insn_name_ptr_size));
       insn_name_ptr_size = new_size;
@@ -1442,7 +1442,7 @@ record_insn_name (int code, const char *

   if (!name || name[0] == '\0')
     {
-      new = xmalloc (strlen (last_real_name) + 10);
+      new = XNEWVAR (char, strlen (last_real_name) + 10);
       sprintf (new, "%s+%d", last_real_name, code - last_real_code);
     }
   else


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