OSDN Git Service

Mon Dec 7 17:56:06 1998 Mike Stump <mrs@wrs.com>
authorbrolley <brolley@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Dec 1998 15:02:16 +0000 (15:02 +0000)
committerbrolley <brolley@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Dec 1998 15:02:16 +0000 (15:02 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24157 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/lex.c

index a62d80b..eff8c96 100644 (file)
@@ -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 
index 3543cf5..48085bd 100644 (file)
@@ -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)