+Fri Oct 16 15:44:02 1998 Dave Brolley <brolley@cygnus.com>
+
+ * cccp.c (rescan): Handle multibyte chartacters ending in backslash.
+ (rescan): Ditto.
+ (skip_if_group): Ditto.
+ (skip_to_end_of_comment): Ditto.
+ (macarg1): Ditto.
+ (discard_comments): Ditto.
+ (change_newlines): Ditto.
+
Fri Oct 16 15:26:24 1998 Dave Brolley <brolley@cygnus.com>
* c-lex.c (yylex): Fix unaligned access of wchar_t.
U_CHAR *before_bp = ibp;
while (++ibp < limit) {
- if (*ibp == '\n') {
- if (ibp[-1] != '\\') {
+ if (*ibp == '\n')
+ {
if (put_out_comments) {
bcopy ((char *) before_bp, (char *) obp, ibp - before_bp);
obp += ibp - before_bp;
}
break;
}
- if (warn_comments)
- warning ("multiline `//' comment");
- ++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;
- }
+ if (*ibp == '\\')
+ {
+ if (ibp + 1 < limit && ibp[1] == '\n')
+ {
+ if (warn_comments)
+ warning ("multiline `//' comment");
+ ++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;
+ ++ibp;
+ }
+ }
else
{
#ifdef MULTIBYTE_CHARS
for (ibp += 2; ; ibp++)
{
if (*ibp == '\n')
+ break;
+ if (*ibp == '\\' && ibp[1] == '\n')
{
- if (ibp[-1] != '\\')
- break;
+ if (put_out_comments)
+ *obp++ = *ibp++;
}
else
{
bp += 2;
} else if (bp[1] == '/' && cplusplus_comments) {
for (bp += 2; ; bp++) {
- if (*bp == '\n') {
- if (bp[-1] != '\\')
- break;
- if (warn_comments)
- warning ("multiline `//' comment");
- ip->lineno++;
- }
+ if (*bp == '\n')
+ break;
+ if (*bp == '\\' && bp[1] == '\n')
+ {
+ if (warn_comments)
+ warning ("multiline `//' comment");
+ ip->lineno++;
+ bp++;
+ }
else
{
#ifdef MULTIBYTE_CHARS
}
if (cplusplus_comments && bp[-1] == '/') {
for (; bp < limit; bp++) {
- if (*bp == '\n') {
- if (bp[-1] != '\\')
- break;
- if (!nowarn && warn_comments)
- warning ("multiline `//' comment");
- if (line_counter)
- ++*line_counter;
- if (op)
- ++op->lineno;
- }
+ if (*bp == '\n')
+ break;
+ if (*bp == '\\' && bp + 1 < limit && bp[1] == '\n')
+ {
+ if (!nowarn && warn_comments)
+ warning ("multiline `//' comment");
+ if (line_counter)
+ ++*line_counter;
+ if (op)
+ {
+ ++op->lineno;
+ *op->bufp++ = *bp;
+ }
+ ++bp;
+ }
else
{
#ifdef MULTIBYTE_CHARS
for (bp += 2; bp < limit; bp++) {
if (*bp == '\n') {
++*newlines;
- if (bp[-1] != '\\')
- break;
- if (warn_comments)
- warning ("multiline `//' comment");
+ break;
}
+ if (*bp == '\\' && bp + 1 < limit && bp[1] == '\n')
+ {
+ ++*newlines;
+ if (warn_comments)
+ warning ("multiline `//' comment");
+ ++bp;
+ }
else
{
#ifdef MULTIBYTE_CHARS
while (ibp < limit)
{
if (*ibp == '\n')
- {
- if (ibp[-1] != '\\')
- break;
- }
+ break;
+ if (*ibp == '\\' && ibp + 1 < limit && ibp[1] == '\n')
+ ibp++;
else
{
#ifdef MULTIBYTE_CHARS
while (ibp < limit) {
*obp++ = c = *ibp++;
if (c == quotec)
- {
- if (ibp[-2] != '\\')
- break;
- }
+ break;
+ else if (c == '\\' && ibp < limit && *ibp == '\n')
+ *obp++ = *ibp++;
else if (c == '\n')
{
if (quotec == '\'')