Commit 5b01bc66 by Jim Wilson

(multiline_string_line): New file scope static variable.

(rescan): Delete multiline_string_line variable definition.
(skip_quoted_string): Print start line number of unterminated
string and character constants.  When see a newline: warn if
pedantic; delete unreachable duplicate code for traditional case;
set multiline_string_line.

From-SVN: r3012
parent 3e146e90
......@@ -451,6 +451,10 @@ static int no_output;
and/or warnings. */
static int done_initializing = 0;
/* Line where a newline was first seen in a string constant. */
static int multiline_string_line = 0;
/* I/O buffer structure.
The `fname' field is nonzero for source files and #include files
......@@ -2177,9 +2181,6 @@ rescan (op, output_marks)
this records the line it started on, for error messages. */
int start_line;
/* Line where a newline was first seen in a string constant. */
int multiline_string_line = 0;
/* Record position of last `real' newline. */
U_CHAR *beg_of_line;
......@@ -6669,6 +6670,9 @@ skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p,
if (bp >= limit) {
error_with_line (line_for_error (start_line),
"unterminated string or character constant");
error_with_line (multiline_string_line,
"possible real start of unterminated constant");
multiline_string_line = 0;
if (eofp)
*eofp = 1;
break;
......@@ -6696,22 +6700,19 @@ skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p,
*eofp = 1;
break;
}
if (match == '\'') {
if (pedantic || match == '\'') {
error_with_line (line_for_error (start_line),
"unterminated character constant");
"unterminated string or character constant");
bp--;
if (eofp)
*eofp = 1;
break;
}
if (traditional) { /* Unterminated strings are 'legal'. */
if (eofp)
*eofp = 1;
break;
}
/* If not traditional, then allow newlines inside strings. */
if (count_newlines)
++*count_newlines;
if (multiline_string_line == 0)
multiline_string_line = start_line;
} else if (c == match)
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