Commit a0469a32 by Richard Kenner

(rescan): Don't address outside of array when preprocessing C++

comments.

From-SVN: r10118
parent d679bebf
...@@ -2991,38 +2991,29 @@ do { ip = &instack[indepth]; \ ...@@ -2991,38 +2991,29 @@ do { ip = &instack[indepth]; \
/* C++ style comment... */ /* C++ style comment... */
start_line = ip->lineno; start_line = ip->lineno;
--ibp; /* Back over the slash */
--obp;
/* Comments are equivalent to spaces. */ /* Comments are equivalent to spaces. */
if (! put_out_comments) if (! put_out_comments)
*obp++ = ' '; obp[-1] = ' ';
else {
/* must fake up a comment here */
*obp++ = '/';
*obp++ = '/';
}
{
U_CHAR *before_bp = ibp+2;
while (ibp < limit) { {
if (ibp[-1] != '\\' && *ibp == '\n') { U_CHAR *before_bp = ibp;
if (put_out_comments) {
bcopy ((char *) before_bp, (char *) obp, ibp - before_bp); while (++ibp < limit) {
obp += ibp - before_bp; if (*ibp == '\n') {
} if (ibp[-1] != '\\') {
break; if (put_out_comments) {
} else { bcopy ((char *) before_bp, (char *) obp, ibp - before_bp);
if (*ibp == '\n') { obp += ibp - before_bp;
++ip->lineno; }
/* Copy the newline into the output buffer, in order to break;
avoid the pain of a #line every time a multiline comment
is seen. */
if (!put_out_comments)
*obp++ = '\n';
++op->lineno;
} }
ibp++; ++ip->lineno;
/* Copy the newline into the output buffer, in order to
avoid the pain of a #line every time a multiline comment
is seen. */
if (!put_out_comments)
*obp++ = '\n';
++op->lineno;
} }
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment