diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-05-31 11:44:46 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-05-31 11:44:46 +0000 |
commit | 2f0a2a5b4ac9639466b535fe4d0cb252611901c6 (patch) | |
tree | 52d08baf01725cba44bffca068fd1784e74f5feb /gcc/cccp.c | |
parent | 305423e8d8fbf43c1723fa8ec0d0b4503269c616 (diff) | |
download | gcc-2f0a2a5b4ac9639466b535fe4d0cb252611901c6.zip gcc-2f0a2a5b4ac9639466b535fe4d0cb252611901c6.tar.gz gcc-2f0a2a5b4ac9639466b535fe4d0cb252611901c6.tar.bz2 |
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
Diffstat (limited to 'gcc/cccp.c')
-rw-r--r-- | gcc/cccp.c | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -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; |