lex.c (check_newline): Add support for \ as `natural' characters in file names in...
authorMike Stump <mrs@wrs.com>
Mon, 7 Dec 1998 15:02:16 +0000 (15:02 +0000)
committerDave Brolley <brolley@gcc.gnu.org>
Mon, 7 Dec 1998 15:02:16 +0000 (10:02 -0500)
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

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

index a62d80bf3c02d9cf36522c0c77d28fb72635daf2..eff8c9626ecbf6dbe1e655b57cf30bba9766b6af 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 3543cf5ffcf40d6c5b7c1793c034b1a4be6c501f..48085bdaf3ac9ee1ee0f114ed9e1662e189120af 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)