Commit 2994a9ac by Richard Kenner

(skip_quoted_string): If pedantic and not pedantic_errors,

skipped multiline strings elicit a warning, not an error.
(rescan): Minor code reorg to keep it parallel with skip_quoted_string.

From-SVN: r11023
parent e28ea75b
...@@ -2876,12 +2876,12 @@ do { ip = &instack[indepth]; \ ...@@ -2876,12 +2876,12 @@ do { ip = &instack[indepth]; \
"unterminated character constant"); "unterminated character constant");
goto while2end; goto while2end;
} }
if (pedantic && multiline_string_line == 0) { if (multiline_string_line == 0) {
pedwarn_with_line (line_for_error (start_line), if (pedantic)
"string constant runs past end of line"); pedwarn_with_line (line_for_error (start_line),
} "string constant runs past end of line");
if (multiline_string_line == 0)
multiline_string_line = ip->lineno - 1; multiline_string_line = ip->lineno - 1;
}
break; break;
case '\\': case '\\':
...@@ -7708,7 +7708,7 @@ skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p, ...@@ -7708,7 +7708,7 @@ skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p,
*eofp = 1; *eofp = 1;
break; break;
} }
if (pedantic || match == '\'') { if (match == '\'') {
error_with_line (line_for_error (start_line), error_with_line (line_for_error (start_line),
"unterminated string or character constant"); "unterminated string or character constant");
bp--; bp--;
...@@ -7719,8 +7719,12 @@ skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p, ...@@ -7719,8 +7719,12 @@ skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p,
/* If not traditional, then allow newlines inside strings. */ /* If not traditional, then allow newlines inside strings. */
if (count_newlines) if (count_newlines)
++*count_newlines; ++*count_newlines;
if (multiline_string_line == 0) if (multiline_string_line == 0) {
if (pedantic)
pedwarn_with_line (line_for_error (start_line),
"string constant runs past end of line");
multiline_string_line = start_line; multiline_string_line = start_line;
}
} else if (c == match) } else if (c == match)
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