From 069f7cf27ac43a69025413e86e8674c8bfa8383d Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Mon, 7 Dec 1998 15:02:16 +0000 Subject: [PATCH] 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 * 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 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/lex.c | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a62d80bf3c0..eff8c9626ec 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +Mon Dec 7 17:56:06 1998 Mike Stump + + * 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 * cp/decl2.c: s/data/opts/ when initializing cpp_reader diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 3543cf5ffcf..48085bdaf3a 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) -- 2.30.2