]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/cpplex.c
cpplib.h (struct cpp_reader): New field include_depth.
[gcc.git] / gcc / cpplex.c
index b7f6da5181b9196826a53c5e3d97bff7cc197192..109e97ef86ca5e48f1731955f2863ef7b10d20d9 100644 (file)
@@ -218,6 +218,8 @@ cpp_pop_buffer (pfile)
        free ((PTR) buf->buf);
       if (pfile->system_include_depth)
        pfile->system_include_depth--;
+      if (pfile->include_depth)
+       pfile->include_depth--;
       if (pfile->potential_control_macro)
        {
          if (buf->inc->cmacro != NEVER_REREAD)
@@ -289,25 +291,26 @@ output_line_command (pfile, print, line)
   if (CPP_OPTION (pfile, no_line_commands))
     return;
 
-  /* Determine whether the current filename has changed, and if so,
-     how.  'nominal_fname' values are unique, so they can be compared
-     by comparing pointers.  */
-  if (ip->nominal_fname == print->last_fname)
-    change = same;
-  else
+  if (pfile->include_depth == print->last_id)
     {
-      if (pfile->buffer_stack_depth == print->last_bsd)
+      /* Determine whether the current filename has changed, and if so,
+        how.  'nominal_fname' values are unique, so they can be compared
+        by comparing pointers.  */
+      if (ip->nominal_fname == print->last_fname)
+       change = same;
+      else
        change = rname;
+    }
+  else
+    {
+      if (pfile->include_depth > print->last_id)
+       change = enter;
       else
-       {
-         if (pfile->buffer_stack_depth > print->last_bsd)
-           change = enter;
-         else
-           change = leave;
-         print->last_bsd = pfile->buffer_stack_depth;
-       }
-      print->last_fname = ip->nominal_fname;
+       change = leave;
+      print->last_id = pfile->include_depth;
     }
+  print->last_fname = ip->nominal_fname;
+
   /* If the current file has not changed, we can output a few newlines
      instead if we want to increase the line number by a small amount.
      We cannot do this if print->lineno is zero, because that means we
This page took 0.030372 seconds and 5 git commands to generate.