This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

patch to input_file_stack handling


The behavior of push_srcloc/pop_srcloc is weird (why are
we saving the stack the new values in input_location?),
and it caused problems with the compile server.  The
attached patch is simpler, passes boostrap and the testsuite,
and is what I'm using in the compile server.  Ok to check in?
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


	* toplec.c (push_srcloc):  Simplify behavior to save current location
	and set current location to parameters.
	(pop_srcloc):  Simplify semantics.
	(lang_dependent_init):  Remove now-useless initial push_srcloc.

Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.764
diff -u -p -r1.764 toplev.c
--- toplev.c	4 Jun 2003 16:14:35 -0000	1.764
+++ toplev.c	4 Jun 2003 19:41:57 -0000
@@ -2170,14 +2170,11 @@ push_srcloc (const char *file, int line)
 {
   struct file_stack *fs;
 
-  if (input_file_stack)
-    input_file_stack->location = input_location;
-
   fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
-  input_filename = file;
-  input_line = line;
   fs->location = input_location;
   fs->next = input_file_stack;
+  input_filename = file;
+  input_line = line;
   input_file_stack = fs;
   input_file_stack_tick++;
 }
@@ -2192,17 +2189,10 @@ pop_srcloc (void)
   struct file_stack *fs;
 
   fs = input_file_stack;
+  input_location = fs->location;
   input_file_stack = fs->next;
   free (fs);
   input_file_stack_tick++;
-
-  if (input_file_stack)
-    input_location = input_file_stack->location;
-  else
-    {
-      input_filename = NULL;
-      input_line = 0;
-    }
 }
 
 /* Compile an entire translation unit.  Write a file of assembly
@@ -5650,9 +5640,6 @@ lang_dependent_init (const char *name)
   init_dummy_function_start ();
   init_expr_once ();
   expand_dummy_function_end ();
-
-  /* Put an entry on the input file stack for the main input file.  */
-  push_srcloc (input_filename, 0);
 
   /* If dbx symbol table desired, initialize writing it and output the
      predefined types.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]