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]

RFA: Match calls to debug_end_source_file with calls to debug_start_source_file


Hi Guys,

  I would like approval to apply the following patch.  It fixes
  cb_leave_file in c-lex.c so that it only calls debug_end_source_file
  under the same circumstances that bs_enter_file calls
  debug_start_source_file.

  Without this patch the debug functions can see far more end-of-files
  than start-of-files.  This is particularly a problem for the STABS
  code which maintains a chain of pointers to some per-file state
  information, and when the end-of-file function is called too many
  times, it tries to pop a non-existent node off the chain.

Cheers
	Nick

2000-11-13  Nick Clifton  <nickc@redhat.com>

	* c-lex.c (cb_leave_file): Only call debug_end_source_file
	under the same conditions that cb_enter_file calls
	debug_start_source_file.

Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-lex.c,v
retrieving revision 1.111
diff -p -r1.111 c-lex.c
*** c-lex.c	2000/11/11 13:18:59	1.111
--- c-lex.c	2000/11/13 18:16:57
*************** cb_leave_file (pfile)
*** 728,733 ****
--- 728,735 ----
  {
    /* Bleah, need a better interface to this.  */
    const char *flags = cpp_syshdr_flags (pfile, CPP_BUFFER (pfile));
+   cpp_buffer *ip = CPP_BUFFER (pfile);
+ 
  #if 0
    if (indent_level != input_file_stack->indent_level)
      {
*************** cb_leave_file (pfile)
*** 750,757 ****
        --pending_lang_change;
      }
  #endif
!   lex_lineno = CPP_BUFFER (pfile)->lineno;
!   debug_end_source_file (input_file_stack->line);
  
    update_header_times (input_file_stack->name);
    /* Hook for C++.  */
--- 752,760 ----
        --pending_lang_change;
      }
  #endif
!   lex_lineno = ip->lineno;
!   if (ip->prev)
!     debug_end_source_file (input_file_stack->line);
  
    update_header_times (input_file_stack->name);
    /* Hook for C++.  */

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