From: Mark Mitchell Date: Mon, 31 May 1999 11:44:46 +0000 (+0000) Subject: cccp.c (handle_directive): Handle backslash-newlines in quoted strings correctly. X-Git-Tag: releases/libgcj-2.95.0~299 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f0a2a5b4ac9639466b535fe4d0cb252611901c6;p=thirdparty%2Fgcc.git cccp.c (handle_directive): Handle backslash-newlines in quoted strings correctly. * cccp.c (handle_directive): Handle backslash-newlines in quoted strings correctly. From-SVN: r27279 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d02408394064..e83b9fe681e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Mon May 31 11:48:07 1999 Mark Mitchell + + * cccp.c (handle_directive): Handle backslash-newlines in quoted + strings correctly. + Mon May 31 09:36:11 1999 Cort Dougan * rs6000/linux.h (LINK_SPEC): Use emulation elf32ppclinux. diff --git a/gcc/cccp.c b/gcc/cccp.c index e89d00c574b4..6e2d519f6263 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -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;