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]

PATCH to the diagnostic library



This adds one more hooks add a bit of flexibility.

Bootstrapped and tested on i686-pc-linux.  Installed.

-- Gaby
2000-09-25  Gabriel Dos Reis  <gdr@codesourcery.com>

	* diagnostic.c (output_last_position): Define.
	(set_real_maximum_length): Tweek.
	* diagnostic.h (output_last_position): Declare.

Index: diagnostic.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.h,v
retrieving revision 1.15
diff -p -r1.15 diagnostic.h
*** diagnostic.h	2000/09/06 18:43:35	1.15
--- diagnostic.h	2000/09/25 21:17:25
*************** void init_output_buffer		PARAMS ((output
*** 176,181 ****
--- 176,182 ----
  void flush_diagnostic_buffer    PARAMS ((void));
  void output_clear		PARAMS ((output_buffer *));
  const char *output_get_prefix	PARAMS ((const output_buffer *));
+ const char *output_last_position PARAMS ((const output_buffer *));
  void output_set_prefix		PARAMS ((output_buffer *, const char *));
  void output_destroy_prefix      PARAMS ((output_buffer *));
  void output_set_maximum_length  PARAMS ((output_buffer *, int));
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.c,v
retrieving revision 1.35
diff -p -r1.35 diagnostic.c
*** diagnostic.c	2000/09/06 18:43:35	1.35
--- diagnostic.c	2000/09/25 21:17:26
*************** static void
*** 230,237 ****
  set_real_maximum_length (buffer)
       output_buffer *buffer;
  {
!   /* If we're told not to wrap lines then do the obvious thing.  */
!   if (! output_is_line_wrapping (buffer))
      line_wrap_cutoff (buffer) = ideal_line_wrap_cutoff (buffer);
    else
      {
--- 230,241 ----
  set_real_maximum_length (buffer)
       output_buffer *buffer;
  {
!   /* If we're told not to wrap lines then do the obvious thing.  In case
!    we'll emit prefix only once per diagnostic message, it is appropriate
!   not to increase unncessarily the line-length cut-off.  */
!   if (! output_is_line_wrapping (buffer)
!       || prefixing_policy (buffer) == DIAGNOSTICS_SHOW_PREFIX_ONCE
!       || prefixing_policy (buffer) == DIAGNOSTICS_SHOW_PREFIX_NEVER)
      line_wrap_cutoff (buffer) = ideal_line_wrap_cutoff (buffer);
    else
      {
*************** output_set_prefix (buffer, prefix)
*** 269,274 ****
--- 273,291 ----
    set_real_maximum_length (buffer);
    prefix_was_emitted_for (buffer) = 0;
    output_indentation (buffer) = 0;
+ }
+ 
+ /*  Return a pointer to the last character emitted in the output
+     BUFFER area.  A NULL pointer means no character available.  */
+ const char *
+ output_last_position (buffer)
+      const output_buffer *buffer;
+ {
+   const char *p = NULL;
+   
+   if (obstack_base (&buffer->obstack) != obstack_next_free (&buffer->obstack))
+     p = ((const char *) obstack_next_free (&buffer->obstack)) - 1;
+   return p;
  }
  
  /* Free BUFFER's prefix, a previously malloc'd string.  */

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