aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1992-12-31 12:42:07 -0800
committerJim Wilson <wilson@gcc.gnu.org>1992-12-31 12:42:07 -0800
commit5b01bc66eed730a17baf459d06f2aa454b908350 (patch)
treea4f81b1512d8d9210c97e11b8f39f31820c83852
parent3e146e90e5672a6f4f8eec15848af491b6fb0654 (diff)
downloadgcc-5b01bc66eed730a17baf459d06f2aa454b908350.zip
gcc-5b01bc66eed730a17baf459d06f2aa454b908350.tar.gz
gcc-5b01bc66eed730a17baf459d06f2aa454b908350.tar.bz2
(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
-rw-r--r--gcc/cccp.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index 6b2aaac..a751a56 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -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;
}