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]

(C++) line number fix


My last change broke line number tracking.  Here's the fix.

1999-07-26  Jason Merrill  <jason@yorick.cygnus.com>

	* input.c (feed_input): Only touch lineno and input_filename
	if !USE_CPPLIB.  Save the old values before setting the new ones.

Index: input.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/input.c,v
retrieving revision 1.12
diff -c -p -r1.12 input.c
*** input.c	1999/07/26 22:23:59	1.12
--- input.c	1999/07/27 00:36:31
*************** struct input_source {
*** 51,60 ****
    /* linked list maintenance */
    struct input_source *next;
    /* values to restore after reading all of current string */
-   char *filename;
-   int lineno;
    struct pending_input *input;
  #if !USE_CPPLIB
    struct putback_buffer putback;
  #endif
  };
--- 51,60 ----
    /* linked list maintenance */
    struct input_source *next;
    /* values to restore after reading all of current string */
    struct pending_input *input;
  #if !USE_CPPLIB
+   char *filename;
+   int lineno;
    struct putback_buffer putback;
  #endif
  };
*************** feed_input (str, len, file, line)
*** 136,141 ****
--- 136,143 ----
    inp->length = len;
    inp->offset = 0;
    inp->putback = putback;
+   inp->filename = input_filename;
+   inp->lineno = lineno;
    putback.buffer = NULL;
    putback.buffer_size = 0;
    putback.index = -1;
*************** feed_input (str, len, file, line)
*** 143,150 ****
    input_filename = file;
  #endif
    inp->next = input;
-   inp->filename = input_filename;
-   inp->lineno = lineno;
    inp->input = save_pending_input ();
    input = inp;
  }
--- 145,150 ----
*************** end_input ()
*** 160,171 ****
    cpp_pop_buffer (&parse_in);
  #else
    putback = inp->putback;
  #endif
  
    end_of_file = 0;
    input = inp->next;
-   input_filename = inp->filename;
-   lineno = inp->lineno;
    /* Get interface/implementation back in sync.  */
    extract_interface_info ();
    restore_pending_input (inp->input);
--- 160,171 ----
    cpp_pop_buffer (&parse_in);
  #else
    putback = inp->putback;
+   input_filename = inp->filename;
+   lineno = inp->lineno;
  #endif
  
    end_of_file = 0;
    input = inp->next;
    /* Get interface/implementation back in sync.  */
    extract_interface_info ();
    restore_pending_input (inp->input);


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