[PATCH] Remove trailing whitespace from @ templates

Jakub Jelinek jakub@redhat.com
Thu Feb 19 10:58:00 GMT 2004


On Wed, Feb 18, 2004 at 04:18:48PM -0800, Richard Henderson wrote:
> On Wed, Feb 18, 2004 at 08:37:29AM +0100, Jakub Jelinek wrote:
> > 	* config/i386/i386.md (zero_extendqidi2, zero_extendqidi2,
> > 	testdi_1_rex64, anddi_2, xordi_1_rex64, xordi_2_rex64): Remove
> > 	trailing whitespace from instructions.
> 
> While this is certainly ok, I wonder if we shouldn't just
> trim it in genemit.c?

Like this?

2004-02-19  Jakub Jelinek  <jakub@redhat.com>

	* genoutput.c (process_template): Strip trailing whitespace in @
	templates and issue a warning if there was any.

--- gcc/genoutput.c.jj	2004-01-19 16:57:38.000000000 +0100
+++ gcc/genoutput.c	2004-02-19 11:39:04.412025120 +0100
@@ -682,11 +682,22 @@ process_template (struct data *d, const 
 
       for (i = 0, cp = &template[1]; *cp; )
 	{
+	  const char *ep, *sp;
+
 	  while (ISSPACE (*cp))
 	    cp++;
 
 	  printf ("  \"");
-	  while (!IS_VSPACE (*cp) && *cp != '\0')
+
+	  for (ep = sp = cp; !IS_VSPACE (*ep) && *ep != '\0'; ++ep)
+	    if (!ISSPACE (*ep))
+	      sp = ep + 1;
+
+	  if (sp != ep)
+	    message_with_line (d->lineno,
+			       "trailing whitespace in output template");
+
+	  while (cp < sp)
 	    {
 	      putchar (*cp);
 	      cp++;


	Jakub



More information about the Gcc-patches mailing list