]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: cpptrad.c (_cpp_scan_out_logical_line): Improve test for whether directive...
authorNathanael Nerode <neroden@gcc.gnu.org>
Wed, 10 Dec 2003 16:57:06 +0000 (16:57 +0000)
committerNathanael Nerode <neroden@gcc.gnu.org>
Wed, 10 Dec 2003 16:57:06 +0000 (16:57 +0000)
Backport from mainline (fixes unreported regression):
* cpptrad.c (_cpp_scan_out_logical_line): Improve test for
  whether directive begins at the beginning of a line.

(testsuite)
Backport from mainline:
* gcc.dg/cpp/trad/xwin1.c: New test case.

From-SVN: r74502

gcc/ChangeLog
gcc/cpptrad.c
gcc/testsuite/ChangeLog

index f378c7aa19321c5e30d65eb04a514fce59cd346a..139b1bef3268de02043021762d2395ad5da7e932 100644 (file)
@@ -1,3 +1,9 @@
+2003-12-10  Nathanael Nerode  <neroden@gcc.gnu.org>
+
+       Backport from mainline (fixes unreported regression):
+       * cpptrad.c (_cpp_scan_out_logical_line): Improve test for
+         whether directive begins at the beginning of a line.
+
 2003-12-10  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR target/13354
index 5c66659f02b1672d1cd8e739b5291a0aac3d5cd2..27cce2f6e280cf3de8dc45e420abe68658d45638 100644 (file)
@@ -438,6 +438,7 @@ scan_out_logical_line (pfile, macro)
   unsigned int c, paren_depth = 0, quote;
   enum ls lex_state = ls_none;
   bool header_ok;
+  const uchar *start_of_input_line;
 
   fmacro.buff = NULL;
 
@@ -448,6 +449,9 @@ scan_out_logical_line (pfile, macro)
   RLIMIT (pfile->context) = pfile->buffer->rlimit;
   pfile->out.cur = pfile->out.base;
   pfile->out.first_line = pfile->line;
+  /* start_of_input_line is needed to make sure that directives really,
+     really start at the first character of the line. */
+  start_of_input_line = pfile->buffer->cur;
  new_context:
   context = pfile->context;
   cur = CUR (context);
@@ -682,7 +686,7 @@ scan_out_logical_line (pfile, macro)
          break;
 
        case '#':
-         if (out - 1 == pfile->out.base
+         if (cur - 1 == start_of_input_line
              /* A '#' from a macro doesn't start a directive.  */
              && !pfile->context->prev
              && !pfile->state.in_directive)
index d35950b639ada173eb8132464890997bd2c6632d..2693b295868705fdab5ce7d18edb1f67c1199b45 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-10  Nathanael Nerode  <neroden@gcc.gnu.org>
+
+       Backport from mainline:
+       * gcc.dg/cpp/trad/xwin1.c: New test case.
+
 2003-12-10  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        Backport from mainline: