diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1994-09-09 21:48:32 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1994-09-09 21:48:32 -0400 |
commit | 01bffe732f06ee6451aa24ac6566cd364325d612 (patch) | |
tree | 5ed0d27fa6a3c3cf3a9a9b3062aefe22e88ae331 /gcc | |
parent | 4de57b3baa71a87fdaf4a3de8f5a69bd69da8f9c (diff) | |
download | gcc-01bffe732f06ee6451aa24ac6566cd364325d612.zip gcc-01bffe732f06ee6451aa24ac6566cd364325d612.tar.gz gcc-01bffe732f06ee6451aa24ac6566cd364325d612.tar.bz2 |
(rescan, handle_directive): Backslash no longer suppresses the specialness of the following char unless -traditional.
(rescan, handle_directive): Backslash no longer suppresses the specialness of
the following char unless -traditional.
(rescan): Remove backslash-newline only if at top level, since
backslash-newline-space can be encountered during macro processing.
(collect_expansion): Remove special hack for \# inside a #define; it's not
compatible with the C Standard.
From-SVN: r8069
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cccp.c | 30 |
1 files changed, 13 insertions, 17 deletions
@@ -2561,22 +2561,25 @@ do { ip = &instack[indepth]; \ switch (c) { case '\\': - if (ibp >= limit) - break; - if (*ibp == '\n') { - /* Always merge lines ending with backslash-newline, - even in middle of identifier. */ + if (*ibp == '\n' && !ip->macro) { + /* At the top level, always merge lines ending with backslash-newline, + even in middle of identifier. But do not merge lines in a macro, + since backslash might be followed by a newline-space marker. */ ++ibp; ++ip->lineno; --obp; /* remove backslash from obuf */ break; } + /* If ANSI, backslash is just another character outside a string. */ + if (!traditional) + goto randomchar; /* Otherwise, backslash suppresses specialness of following char, so copy it here to prevent the switch from seeing it. But first get any pending identifier processed. */ if (ident_length > 0) goto specialchar; - *obp++ = *ibp++; + if (ibp < limit) + *obp++ = *ibp++; break; case '#': @@ -3582,8 +3585,9 @@ handle_directive (ip, op) if (*bp == '\n') { ip->lineno++; copy_command = 1; - } - bp++; + bp++; + } else if (traditional) + bp++; } break; @@ -5742,16 +5746,8 @@ collect_expansion (buf, end, nargs, arglist) expected_delimiter = c; break; - /* Special hack: if a \# is written in the #define - include a # in the definition. This is useless for C code - but useful for preprocessing other things. */ - case '\\': - /* \# quotes a # even outside of strings. */ - if (p < limit && *p == '#' && !expected_delimiter) { - exp_p--; - *exp_p++ = *p++; - } else if (p < limit && expected_delimiter) { + if (p < limit && expected_delimiter) { /* In a string, backslash goes through and makes next char ordinary. */ *exp_p++ = *p++; |