Various cleanups to help compile server.
authorPer Bothner <pbothner@apple.com>
Thu, 20 Mar 2003 16:43:19 +0000 (16:43 +0000)
committerPer Bothner <bothner@gcc.gnu.org>
Thu, 20 Mar 2003 16:43:19 +0000 (08:43 -0800)
* line-map.c (add_line_map):  Allow leaving the outermost file.
Allowing entering an outermost-file after the initial time.

* toplev.c (pop_srcloc):  Allow popping from initial file.

From-SVN: r64616

gcc/ChangeLog
gcc/line-map.c
gcc/toplev.c

index d20b1758a89c983b3cc364a61972bd4ffc123d3d..fe92cf9c872e4ccf4d3a2f832e8f98a274d28191 100644 (file)
@@ -1,3 +1,12 @@
+2003-03-20  Per Bothner  <pbothner@apple.com>
+
+       Various cleanups to help compile server.
+
+       * line-map.c (add_line_map):  Allow leaving the outermost file.
+       Allowing entering an outermost-file after the initial time. 
+
+       * toplev.c (pop_srcloc):  Allow popping from initial file.
+
 2003-03-20  Kazu Hirata  <kazu at cs dot umass dot edu>
 
        * fold-const.c (fold): Fold A - (A & B) into ~B & A.
index ae26e76a1efbad377ea7a8ca6deecb256e1bb66f..442e314d03028c3631dc038a8ee6eebb9d94d0cb 100644 (file)
@@ -106,9 +106,9 @@ add_line_map (set, reason, sysp, from_line, to_file, to_line)
 
       if (MAIN_FILE_P (map - 1))
        {
-         error = true;
-         reason = LC_RENAME;
-         from = map - 1;
+         set->depth--;
+         set->used--;
+         return NULL;
        }
       else
        {
@@ -139,8 +139,8 @@ add_line_map (set, reason, sysp, from_line, to_file, to_line)
 
   if (reason == LC_ENTER)
     {
+      map->included_from = set->depth == 0 ? -1 : (int) (set->used - 2);
       set->depth++;
-      map->included_from = set->used - 2;
       if (set->trace_includes)
        trace_include (set, map);
     }
index e1b97a104ff542098ac087ea9762e8f5cb795a8e..eadcb36958f910b0fcfe079d374603877f2b1ffb 100644 (file)
@@ -2166,11 +2166,17 @@ pop_srcloc ()
   input_file_stack = fs->next;
   free (fs);
   input_file_stack_tick++;
-  /* The initial source file is never popped.  */
-  if (!input_file_stack)
-    abort ();
-  input_filename = input_file_stack->name;
-  lineno = input_file_stack->line;
+
+  if (input_file_stack)
+    {
+      input_filename = input_file_stack->name;
+      lineno = input_file_stack->line;
+    }
+  else
+    {
+      input_filename = NULL;
+      lineno = 0;
+    }
 }
 
 /* Compile an entire translation unit.  Write a file of assembly