This is the mail archive of the gcc@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]

Re: building 3.1 branch on Cygwin


I don't think it generates "\\n\\\n\\n\\\n" because the prev variable 
gets updated... but it still might generate incorrect code due to an 
extra \n being generated.

Here's another patch which hopefully fixes that (but has the side effect 
of stripping multiple cr's so if a macro ends with a \ it may cause 
problems). Any better quick-solution ideas? (see patch at bottom of 
message). I won't get to any better ideas until Monday.

>I don't think this bit
>
>>-        if (*p == '\n' && prev != '\\')
>>+        if (IS_VSPACE(*p) && prev != '\\')
>>          printf ("\\n\\\n");
>>
>
>does what you want.  DOS line breaks are \r\n; I think the above will
>turn " \r\n" into " \\n\\\n\\n\\\n"  (i.e. introducing an extra blank
>line).  Also, it leaves a backslashed newline alone, which may cause
>problems with a compiler that treats \r as horizontal white space.
>
>The rest of it appears to be safe.
>
>zw
>

Index: gcc/genflags.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/genflags.c,v
retrieving revision 1.42
diff -u -r1.42 genflags.c
--- gcc/genflags.c    2 Dec 2001 00:04:19 -0000    1.42
+++ gcc/genflags.c    7 Mar 2002 23:59:11 -0000
@@ -201,8 +201,8 @@
       printf ("(");
       for (p = XSTR (insn, 2); *p; p++)
     {
-      if (*p == '\n')
-        printf (" \\\n");
+      if (IS_VSPACE(*p))
+        printf (" ");
       else
         printf ("%c", *p);
     }
Index: gcc/genoutput.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/genoutput.c,v
retrieving revision 1.68
diff -u -r1.68 genoutput.c
--- gcc/genoutput.c    2 Dec 2001 00:04:19 -0000    1.68
+++ gcc/genoutput.c    7 Mar 2002 23:59:11 -0000
@@ -366,9 +366,9 @@
         printf ("    \"");
         while (*p)
           {
-        if (*p == '\n' && prev != '\\')
+        if (IS_VSPACE(*p) && prev != '\\')
           printf ("\\n\\\n");
-        else
+        else if (!IS_VSPACE(*p) || !IS_VSPACE(prev))
           putchar (*p);
         prev = *p;
         ++p;
@@ -694,11 +694,11 @@
 
       for (i = 0, cp = &template[1]; *cp; )
     {
-      while (*cp == '\n' || *cp == ' ' || *cp== '\t')
+      while (ISSPACE(*cp))
         cp++;
 
       printf ("  \"");
-      while (*cp != '\n' && *cp != '\0')
+      while (!IS_VSPACE(*cp) && (*cp != '\0'))
         {
           putchar (*cp);
           cp++;



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