aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stump <mrs@wrs.com>1998-12-07 15:02:16 +0000
committerDave Brolley <brolley@gcc.gnu.org>1998-12-07 10:02:16 -0500
commit069f7cf27ac43a69025413e86e8674c8bfa8383d (patch)
treeee7188be5e313f899bb4e88ed3ae2d728900b185
parentc25d8793cce98e6abaaf9c44be1526aaabd54e43 (diff)
downloadgcc-069f7cf27ac43a69025413e86e8674c8bfa8383d.zip
gcc-069f7cf27ac43a69025413e86e8674c8bfa8383d.tar.gz
gcc-069f7cf27ac43a69025413e86e8674c8bfa8383d.tar.bz2
lex.c (check_newline): Add support for \ as `natural' characters in file names in #line to be...
Mon Dec 7 17:56:06 1998 Mike Stump <mrs@wrs.com> * lex.c (check_newline): Add support for \ as `natural' characters in file names in #line to be consistent with #include handling. We support escape prcessing in the # 1 "..." version of the command. From-SVN: r24157
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/lex.c17
2 files changed, 21 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a62d80b..eff8c96 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+Mon Dec 7 17:56:06 1998 Mike Stump <mrs@wrs.com>
+
+ * lex.c (check_newline): Add support for \ as `natural'
+ characters in file names in #line to be consistent with #include
+ handling. We support escape prcessing in the # 1 "..." version of
+ the command. See also support in cp/lex.c.
+
1998-12-07 Zack Weinberg <zack@rabi.phys.columbia.edu>
* cp/decl2.c: s/data/opts/ when initializing cpp_reader
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 3543cf5..48085bd 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -2266,6 +2266,7 @@ check_newline ()
{
register int c;
register int token;
+ int saw_line = 0;
/* Read first nonwhite char on the line. Do this before incrementing the
line number, in case we're at the end of saved text. */
@@ -2374,7 +2375,10 @@ check_newline ()
&& getch () == 'n'
&& getch () == 'e'
&& ((c = getch ()) == ' ' || c == '\t'))
- goto linenum;
+ {
+ saw_line = 1;
+ goto linenum;
+ }
}
else if (c == 'i')
{
@@ -2471,9 +2475,16 @@ linenum:
/* More follows: it must be a string constant (filename). */
- /* Read the string constant, but don't treat \ as special. */
- ignore_escape_flag = 1;
+ if (saw_line)
+ {
+ /* Don't treat \ as special if we are processing #line 1 "...".
+ If you want it to be treated specially, use # 1 "...". */
+ ignore_escape_flag = 1;
+ }
+
+ /* Read the string constant. */
token = real_yylex ();
+
ignore_escape_flag = 0;
if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)