]> gcc.gnu.org Git - gcc.git/commitdiff
cccp.c (handle_directive): Handle backslash-newlines in quoted strings correctly.
authorMark Mitchell <mark@codesourcery.com>
Mon, 31 May 1999 11:44:46 +0000 (11:44 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 31 May 1999 11:44:46 +0000 (11:44 +0000)
        * cccp.c (handle_directive): Handle backslash-newlines in quoted
        strings correctly.

From-SVN: r27279

gcc/ChangeLog
gcc/cccp.c

index d024083940646acdddb56c311bd2b919f54d7b37..e83b9fe681e9781d819d67edf54b2e7b07ba9917 100644 (file)
@@ -1,3 +1,8 @@
+Mon May 31 11:48:07 1999  Mark Mitchell  <mark@codesourcery.com>
+
+        * cccp.c (handle_directive): Handle backslash-newlines in quoted
+        strings correctly.
+
 Mon May 31 09:36:11 1999  Cort Dougan  <cort@cs.nmt.edu>
 
        * rs6000/linux.h (LINK_SPEC): Use emulation elf32ppclinux.
index e89d00c574b49b94d1e74f9869651c35e9858e06..6e2d519f6263bee59b2c39076638b1c02b430e11 100644 (file)
@@ -3981,11 +3981,33 @@ handle_directive (ip, op)
          case '\'':
          case '\"':
            {
+             int backslash_newlines_p;
+
              register U_CHAR *bp1
                = skip_quoted_string (xp - 1, bp, ip->lineno,
-                                     NULL_PTR, NULL_PTR, NULL_PTR);
-             while (xp != bp1)
-               *cp++ = *xp++;
+                                     NULL_PTR, &backslash_newlines_p, 
+                                     NULL_PTR);
+             if (backslash_newlines_p)
+               while (xp != bp1)
+                 {
+                   /* With something like:
+
+                        #define X "a\
+                        b"
+
+                      we should still remove the backslash-newline
+                      pair as part of phase two.  */
+                   if (xp[0] == '\\' && xp[1] == '\n')
+                     xp += 2;
+                   else
+                     *cp++ = *xp++;
+                 }
+             else
+               /* This is the same as the loop above, but taking
+                  advantage of the fact that we know there are no
+                  backslash-newline pairs.  */
+               while (xp != bp1)
+                 *cp++ = *xp++;
            }
            break;
 
This page took 0.073 seconds and 5 git commands to generate.