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]

Patchlet to diagnostic library.



Boostrapped and tested on i868-pc-linux.  No additional regression.

-- Gaby

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

	* diagnostic.h (output_clear_message_text): New function.
	(output_message_text): New macro.

	* diagnostic.c (clear_text_info): Rename to
	output_clear_message_text. 
	(output_clear): Adjust.
	(output_finish): Rename to output_finalize_message.  Tweek.
	(output_to_stream): Adjust. 

Index: diagnostic.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.h,v
retrieving revision 1.16
diff -p -r1.16 diagnostic.h
*** diagnostic.h	2000/09/25 21:20:19	1.16
--- diagnostic.h	2000/09/28 12:41:42
*************** struct output_buffer
*** 93,98 ****
--- 93,100 ----
  #define output_needs_newline(BUFFER) (BUFFER)->state.need_newline_p
  #define output_buffer_state(BUFFER) (BUFFER)->state
  #define output_indentation(BUFFER) (BUFFER)->state.indent_skip
+ #define output_message_text(BUFFER) \
+    ((const char *) obstack_base (&(BUFFER)->obstack))
  
  /* This data structure bundles altogether any information relevent to
     the context of a diagnostic message.  */
*************** void output_append		PARAMS ((output_buff
*** 189,195 ****
  void output_add_character	PARAMS ((output_buffer *, int));
  void output_decimal		PARAMS ((output_buffer *, int));
  void output_add_string		PARAMS ((output_buffer *, const char *));
! const char *output_finish	PARAMS ((output_buffer *));
  void output_printf		PARAMS ((output_buffer *, const char *,
                                           ...)) ATTRIBUTE_PRINTF_2;
  int output_is_line_wrapping	PARAMS ((output_buffer *));
--- 191,198 ----
  void output_add_character	PARAMS ((output_buffer *, int));
  void output_decimal		PARAMS ((output_buffer *, int));
  void output_add_string		PARAMS ((output_buffer *, const char *));
! const char *output_finalize_message PARAMS ((output_buffer *));
! void output_clear_message_text  PARAMS ((output_buffer *));
  void output_printf		PARAMS ((output_buffer *, const char *,
                                           ...)) ATTRIBUTE_PRINTF_2;
  int output_is_line_wrapping	PARAMS ((output_buffer *));
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.c,v
retrieving revision 1.37
diff -p -r1.37 diagnostic.c
*** diagnostic.c	2000/09/25 22:54:03	1.37
--- diagnostic.c	2000/09/28 12:41:42
*************** static void output_append_r PARAMS ((out
*** 93,99 ****
  static void wrap_text PARAMS ((output_buffer *, const char *, const char *));
  static void maybe_wrap_text PARAMS ((output_buffer *, const char *,
                                       const char *));
- static void clear_text_info PARAMS ((output_buffer *));
  static void clear_diagnostic_info PARAMS ((output_buffer *));
  
  static void default_diagnostic_starter PARAMS ((output_buffer *,
--- 93,98 ----
*************** output_destroy_prefix (buffer)
*** 303,310 ****
  
  /* Zero out any text output so far in BUFFER.  */
  
! static void
! clear_text_info (buffer)
       output_buffer *buffer;
  {
    obstack_free (&buffer->obstack, obstack_base (&buffer->obstack));
--- 302,309 ----
  
  /* Zero out any text output so far in BUFFER.  */
  
! void
! output_clear_message_text (buffer)
       output_buffer *buffer;
  {
    obstack_free (&buffer->obstack, obstack_base (&buffer->obstack));
*************** void
*** 367,373 ****
  output_clear (buffer)
       output_buffer *buffer;
  {
!   clear_text_info (buffer);
    clear_diagnostic_info (buffer);
  }
  
--- 366,372 ----
  output_clear (buffer)
       output_buffer *buffer;
  {
!   output_clear_message_text (buffer);
    clear_diagnostic_info (buffer);
  }
  
*************** output_clear (buffer)
*** 375,385 ****
     the BUFFERed message.  */
  
  const char *
! output_finish (buffer)
       output_buffer *buffer;
  {
    obstack_1grow (&buffer->obstack, '\0');
!   return (const char *) obstack_finish (&buffer->obstack);
  }
  
  void
--- 374,384 ----
     the BUFFERed message.  */
  
  const char *
! output_finalize_message (buffer)
       output_buffer *buffer;
  {
    obstack_1grow (&buffer->obstack, '\0');
!   return output_message_text (buffer);
  }
  
  void
*************** output_to_stream (buffer, file)
*** 652,660 ****
       output_buffer *buffer;
       FILE *file;
  {
!   const char *text = output_finish (buffer);
    fputs (text, file);
!   clear_text_info (buffer);
  }
  
  /* Format a message pointed to by output_buffer_text_cursor (BUFFER) using
--- 651,659 ----
       output_buffer *buffer;
       FILE *file;
  {
!   const char *text = output_finalize_message (buffer);
    fputs (text, file);
!   output_clear_message_text (buffer);
  }
  
  /* Format a message pointed to by output_buffer_text_cursor (BUFFER) using


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