(make_definition): Don't dump core when given an unterminated string
authorRichard Kenner <kenner@gcc.gnu.org>
Thu, 1 Sep 1994 23:17:40 +0000 (19:17 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Thu, 1 Sep 1994 23:17:40 +0000 (19:17 -0400)
in a -D option.

From-SVN: r8013

gcc/cccp.c

index aa564fdfe909246f58f05ebcebb2cd29afb97b2e..bcc0edc6d74b401ac3433c8cf19536f6666e4e77 100644 (file)
@@ -9289,7 +9289,18 @@ make_definition (str, op)
     p++;
     q = &buf[p - str];
     while (*p) {
-      if (*p == '\\' && p[1] == '\n')
+      if (*p == '\"' || *p == '\'') {
+       int unterminated = 0;
+       U_CHAR *p1 = skip_quoted_string (p, p + strlen (p), 0,
+                                        NULL_PTR, NULL_PTR, &unterminated);
+       if (unterminated)
+         return;
+       while (p != p1)
+         if (*p == '\\' && p[1] == '\n')
+           p += 2;
+         else
+           *q++ = *p++;
+      } else if (*p == '\\' && p[1] == '\n')
        p += 2;
       /* Change newline chars into newline-markers.  */
       else if (*p == '\n')