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]: Resolve C++ keyword conflicts in gen*.c


This patch eliminates some conflicts with C++ keywords in the gen*.c files.

Bootstrapped on x86_64-unknown-linux-gnu, no regressions.

Okay for mainline?

		Thanks,
		--Kaveh


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

	* genattrtab.c (insert_right_side, evaluate_eq_attr): Avoid C++
	keywords.
	* genemit.c (gen_insn): Likewise.
	* gengtype.c (note_def_vec): Likewise.
	* gengtype.h (note_def_vec): Likewise.
	* genoutput.c (struct data, output_insn_data, process_template,
	gen_expand, gen_split, note_constraint): Likewise.
	* genrecog.c (new_decision, add_to_sequence, factor_tests,
	make_insn_sequence): Likewise.
	* gensupport.c (record_insn_name): Likewise.

diff -rup orig/egcc-SVN20080707/gcc/genattrtab.c egcc-SVN20080707/gcc/genattrtab.c
--- orig/egcc-SVN20080707/gcc/genattrtab.c	2008-06-26 03:03:00.000000000 +0200
+++ egcc-SVN20080707/gcc/genattrtab.c	2008-07-07 07:37:45.000000000 +0200
@@ -1846,11 +1846,11 @@ insert_right_side (enum rtx_code code, r

   if (GET_CODE (exp) == code)
     {
-      rtx new = insert_right_side (code, XEXP (exp, 1),
-				   term, insn_code, insn_index);
-      if (new != XEXP (exp, 1))
+      rtx new_rtx = insert_right_side (code, XEXP (exp, 1),
+				       term, insn_code, insn_index);
+      if (new_rtx != XEXP (exp, 1))
 	/* Make a copy of this expression and call recursively.  */
-	newexp = attr_rtx (code, XEXP (exp, 0), new);
+	newexp = attr_rtx (code, XEXP (exp, 0), new_rtx);
       else
 	newexp = exp;
     }
@@ -1980,10 +1980,10 @@ evaluate_eq_attr (rtx exp, rtx value, in

       for (i = 0; i < XVECLEN (value, 0); i += 2)
 	{
-	  rtx this = simplify_test_exp_in_temp (XVECEXP (value, 0, i),
-						insn_code, insn_index);
+	  rtx this_cond = simplify_test_exp_in_temp (XVECEXP (value, 0, i),
+						    insn_code, insn_index);

-	  right = insert_right_side (AND, andexp, this,
+	  right = insert_right_side (AND, andexp, this_cond,
 				     insn_code, insn_index);
 	  right = insert_right_side (AND, right,
 				     evaluate_eq_attr (exp,
@@ -1995,7 +1995,7 @@ evaluate_eq_attr (rtx exp, rtx value, in
 				     insn_code, insn_index);

 	  /* Add this condition into the AND expression.  */
-	  newexp = attr_rtx (NOT, this);
+	  newexp = attr_rtx (NOT, this_cond);
 	  andexp = insert_right_side (AND, andexp, newexp,
 				      insn_code, insn_index);
 	}
diff -rup orig/egcc-SVN20080707/gcc/genemit.c egcc-SVN20080707/gcc/genemit.c
--- orig/egcc-SVN20080707/gcc/genemit.c	2008-01-03 23:37:34.000000000 +0100
+++ egcc-SVN20080707/gcc/genemit.c	2008-07-07 07:16:13.000000000 +0200
@@ -357,17 +357,17 @@ gen_insn (rtx insn, int lineno)

 	      for (j = i + 1; j < XVECLEN (insn, 1); j++)
 		{
-		  rtx old = XEXP (XVECEXP (p->pattern, 1, j), 0);
-		  rtx new = XEXP (XVECEXP (insn, 1, j), 0);
+		  rtx old_rtx = XEXP (XVECEXP (p->pattern, 1, j), 0);
+		  rtx new_rtx = XEXP (XVECEXP (insn, 1, j), 0);

-		  /* OLD and NEW are the same if both are to be a SCRATCH
+		  /* OLD and NEW_INSN are the same if both are to be a SCRATCH
 		     of the same mode,
 		     or if both are registers of the same mode and number.  */
-		  if (! (GET_MODE (old) == GET_MODE (new)
-			 && ((GET_CODE (old) == MATCH_SCRATCH
-			      && GET_CODE (new) == MATCH_SCRATCH)
-			     || (REG_P (old) && REG_P (new)
-				 && REGNO (old) == REGNO (new)))))
+		  if (! (GET_MODE (old_rtx) == GET_MODE (new_rtx)
+			 && ((GET_CODE (old_rtx) == MATCH_SCRATCH
+			      && GET_CODE (new_rtx) == MATCH_SCRATCH)
+			     || (REG_P (old_rtx) && REG_P (new_rtx)
+				 && REGNO (old_rtx) == REGNO (new_rtx)))))
 		    break;
 		}

diff -rup orig/egcc-SVN20080707/gcc/gengtype.c egcc-SVN20080707/gcc/gengtype.c
--- orig/egcc-SVN20080707/gcc/gengtype.c	2008-06-26 03:02:59.000000000 +0200
+++ egcc-SVN20080707/gcc/gengtype.c	2008-07-07 06:10:13.000000000 +0200
@@ -3529,22 +3529,22 @@ write_roots (pair_p variables)
    where the GTY(()) tags are only present if is_scalar is _false_.  */

 void
-note_def_vec (const char *typename, bool is_scalar, struct fileloc *pos)
+note_def_vec (const char *type_name, bool is_scalar, struct fileloc *pos)
 {
   pair_p fields;
   type_p t;
   options_p o;
   type_p len_ty = create_scalar_type ("unsigned");
-  const char *name = concat ("VEC_", typename, "_base", (char *)0);
+  const char *name = concat ("VEC_", type_name, "_base", (char *)0);

   if (is_scalar)
     {
-      t = create_scalar_type (typename);
+      t = create_scalar_type (type_name);
       o = 0;
     }
   else
     {
-      t = resolve_typedef (typename, pos);
+      t = resolve_typedef (type_name, pos);
       o = create_option (0, "length", "%h.num");
     }

diff -rup orig/egcc-SVN20080707/gcc/gengtype.h egcc-SVN20080707/gcc/gengtype.h
--- orig/egcc-SVN20080707/gcc/gengtype.h	2008-01-03 23:37:34.000000000 +0100
+++ egcc-SVN20080707/gcc/gengtype.h	2008-07-07 06:10:40.000000000 +0200
@@ -64,7 +64,7 @@ extern pair_p nreverse_pairs (pair_p lis
 extern type_p adjust_field_type (type_p, options_p);
 extern void note_variable (const char *s, type_p t, options_p o,
 			   struct fileloc *pos);
-extern void note_def_vec (const char *typename, bool is_scalar,
+extern void note_def_vec (const char *type_name, bool is_scalar,
 			  struct fileloc *pos);
 extern void note_def_vec_alloc (const char *type, const char *astrat,
 				struct fileloc *pos);
diff -rup orig/egcc-SVN20080707/gcc/genoutput.c egcc-SVN20080707/gcc/genoutput.c
--- orig/egcc-SVN20080707/gcc/genoutput.c	2008-06-26 03:02:59.000000000 +0200
+++ egcc-SVN20080707/gcc/genoutput.c	2008-07-07 07:32:23.000000000 +0200
@@ -154,7 +154,7 @@ struct data
 {
   struct data *next;
   const char *name;
-  const char *template;
+  const char *template_code;
   int code_number;
   int index_number;
   const char *filename;
@@ -336,7 +336,7 @@ output_insn_data (void)
 	  break;
 	case INSN_OUTPUT_FORMAT_SINGLE:
 	  {
-	    const char *p = d->template;
+	    const char *p = d->template_code;
 	    char prev = 0;

 	    printf ("#if HAVE_DESIGNATED_INITIALIZERS\n");
@@ -656,36 +656,36 @@ place_operands (struct data *d)
    templates, or C code to generate the assembler code template.  */

 static void
-process_template (struct data *d, const char *template)
+process_template (struct data *d, const char *template_code)
 {
   const char *cp;
   int i;

   /* Templates starting with * contain straight code to be run.  */
-  if (template[0] == '*')
+  if (template_code[0] == '*')
     {
-      d->template = 0;
+      d->template_code = 0;
       d->output_format = INSN_OUTPUT_FORMAT_FUNCTION;

       puts ("\nstatic const char *");
       printf ("output_%d (rtx *operands ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED)\n",
 	      d->code_number);
       puts ("{");
-      print_rtx_ptr_loc (template);
-      puts (template + 1);
+      print_rtx_ptr_loc (template_code);
+      puts (template_code + 1);
       puts ("}");
     }

   /* If the assembler code template starts with a @ it is a newline-separated
      list of assembler code templates, one for each alternative.  */
-  else if (template[0] == '@')
+  else if (template_code[0] == '@')
     {
-      d->template = 0;
+      d->template_code = 0;
       d->output_format = INSN_OUTPUT_FORMAT_MULTI;

       printf ("\nstatic const char * const output_%d[] = {\n", d->code_number);

-      for (i = 0, cp = &template[1]; *cp; )
+      for (i = 0, cp = &template_code[1]; *cp; )
 	{
 	  const char *ep, *sp;

@@ -725,7 +725,7 @@ process_template (struct data *d, const
     }
   else
     {
-      d->template = template;
+      d->template_code = template_code;
       d->output_format = INSN_OUTPUT_FORMAT_SINGLE;
     }
 }
@@ -952,7 +952,7 @@ gen_expand (rtx insn, int lineno)

   d->n_operands = max_opno + 1;
   d->n_dups = num_dups;
-  d->template = 0;
+  d->template_code = 0;
   d->output_format = INSN_OUTPUT_FORMAT_NONE;

   validate_insn_alternatives (d);
@@ -993,7 +993,7 @@ gen_split (rtx split, int lineno)
   d->n_operands = max_opno + 1;
   d->n_dups = 0;
   d->n_alternatives = 0;
-  d->template = 0;
+  d->template_code = 0;
   d->output_format = INSN_OUTPUT_FORMAT_NONE;

   place_operands (d);
@@ -1120,7 +1120,7 @@ note_constraint (rtx exp, int lineno)
 {
   const char *name = XSTR (exp, 0);
   unsigned int namelen = strlen (name);
-  struct constraint_data **iter, **slot, *new;
+  struct constraint_data **iter, **slot, *new_cdata;

   /* The 'm' constraint is special here since that constraint letter
      can be overridden by the back end by defining the
@@ -1173,12 +1173,12 @@ note_constraint (rtx exp, int lineno)
 	  return;
 	}
     }
-  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;
-  new->next_this_letter = *slot;
-  *slot = new;
+  new_cdata = XNEWVAR (struct constraint_data, sizeof (struct constraint_data) + namelen);
+  strcpy ((char *)new_cdata + offsetof(struct constraint_data, name), name);
+  new_cdata->namelen = namelen;
+  new_cdata->lineno = lineno;
+  new_cdata->next_this_letter = *slot;
+  *slot = new_cdata;
 }

 /* Return the length of the constraint name beginning at position S
diff -rup orig/egcc-SVN20080707/gcc/genrecog.c egcc-SVN20080707/gcc/genrecog.c
--- orig/egcc-SVN20080707/gcc/genrecog.c	2008-06-26 03:02:59.000000000 +0200
+++ egcc-SVN20080707/gcc/genrecog.c	2008-07-07 07:23:29.000000000 +0200
@@ -474,14 +474,14 @@ extern void debug_decision_list
 static struct decision *
 new_decision (const char *position, struct decision_head *last)
 {
-  struct decision *new = XCNEW (struct decision);
+  struct decision *new_decision = XCNEW (struct decision);

-  new->success = *last;
-  new->position = xstrdup (position);
-  new->number = next_number++;
+  new_decision->success = *last;
+  new_decision->position = xstrdup (position);
+  new_decision->number = next_number++;

-  last->first = last->last = new;
-  return new;
+  last->first = last->last = new_decision;
+  return new_decision;
 }

 /* Create a new test and link it in at PLACE.  */
@@ -877,7 +877,7 @@ add_to_sequence (rtx pattern, struct dec
 		 enum routine_type insn_type, int top)
 {
   RTX_CODE code;
-  struct decision *this, *sub;
+  struct decision *this_decision, *sub;
   struct decision_test *test;
   struct decision_test **place;
   char *subpos;
@@ -894,8 +894,8 @@ add_to_sequence (rtx pattern, struct dec
   strcpy (subpos, position);
   subpos[depth + 1] = 0;

-  sub = this = new_decision (position, last);
-  place = &this->tests;
+  sub = this_decision = new_decision (position, last);
+  place = &this_decision->tests;

  restart:
   mode = GET_MODE (pattern);
@@ -1142,20 +1142,20 @@ add_to_sequence (rtx pattern, struct dec
      before any of the nodes we may have added above.  */
   if (code != UNKNOWN)
     {
-      place = &this->tests;
+      place = &this_decision->tests;
       test = new_decision_test (DT_code, &place);
       test->u.code = code;
     }

   if (mode != VOIDmode)
     {
-      place = &this->tests;
+      place = &this_decision->tests;
       test = new_decision_test (DT_mode, &place);
       test->u.mode = mode;
     }

   /* If we didn't insert any tests or accept nodes, hork.  */
-  gcc_assert (this->tests);
+  gcc_assert (this_decision->tests);

  ret:
   free (subpos);
@@ -1592,7 +1592,7 @@ factor_tests (struct decision_head *head
   for (first = head->first; first && first->next; first = next)
     {
       enum decision_type type;
-      struct decision *new, *old_last;
+      struct decision *new_dec, *old_last;

       type = first->tests->type;
       next = first->next;
@@ -1615,8 +1615,8 @@ factor_tests (struct decision_head *head
          below our first test.  */
       if (first->tests->next != NULL)
 	{
-	  new = new_decision (first->position, &first->success);
-	  new->tests = first->tests->next;
+	  new_dec = new_decision (first->position, &first->success);
+	  new_dec->tests = first->tests->next;
 	  first->tests->next = NULL;
 	}

@@ -1633,14 +1633,14 @@ factor_tests (struct decision_head *head

 	  if (next->tests->next != NULL)
 	    {
-	      new = new_decision (next->position, &next->success);
-	      new->tests = next->tests->next;
+	      new_dec = new_decision (next->position, &next->success);
+	      new_dec->tests = next->tests->next;
 	      next->tests->next = NULL;
 	    }
-	  new = next;
+	  new_dec = next;
 	  next = next->next;
-	  new->next = NULL;
-	  h.first = h.last = new;
+	  new_dec->next = NULL;
+	  h.first = h.last = new_dec;

 	  merge_trees (head, &h);
 	}
@@ -2618,25 +2618,25 @@ make_insn_sequence (rtx insn, enum routi

 	  if (i != XVECLEN (x, 0))
 	    {
-	      rtx new;
+	      rtx new_rtx;
 	      struct decision_head clobber_head;

 	      /* Build a similar insn without the clobbers.  */
 	      if (i == 1)
-		new = XVECEXP (x, 0, 0);
+		new_rtx = XVECEXP (x, 0, 0);
 	      else
 		{
 		  int j;

-		  new = rtx_alloc (PARALLEL);
-		  XVEC (new, 0) = rtvec_alloc (i);
+		  new_rtx = rtx_alloc (PARALLEL);
+		  XVEC (new_rtx, 0) = rtvec_alloc (i);
 		  for (j = i - 1; j >= 0; j--)
-		    XVECEXP (new, 0, j) = XVECEXP (x, 0, j);
+		    XVECEXP (new_rtx, 0, j) = XVECEXP (x, 0, j);
 		}

 	      /* Recognize it.  */
 	      memset (&clobber_head, 0, sizeof(clobber_head));
-	      last = add_to_sequence (new, &clobber_head, "", type, 1);
+	      last = add_to_sequence (new_rtx, &clobber_head, "", type, 1);

 	      /* Find the end of the test chain on the last node.  */
 	      for (test = last->tests; test->next; test = test->next)
diff -rup orig/egcc-SVN20080707/gcc/gensupport.c egcc-SVN20080707/gcc/gensupport.c
--- orig/egcc-SVN20080707/gcc/gensupport.c	2008-06-26 03:02:59.000000000 +0200
+++ egcc-SVN20080707/gcc/gensupport.c	2008-07-07 06:13:10.000000000 +0200
@@ -1428,7 +1428,7 @@ record_insn_name (int code, const char *
 {
   static const char *last_real_name = "insn";
   static int last_real_code = 0;
-  char *new;
+  char *new_name;

   if (insn_name_ptr_size <= code)
     {
@@ -1442,14 +1442,14 @@ record_insn_name (int code, const char *

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

-  insn_name_ptr[code] = new;
+  insn_name_ptr[code] = new_name;
 }


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