Diagnostic.c: Rename some functions

Gabriel Dos Reis gdr@codesourcery.com
Sun Jun 2 10:40:00 GMT 2002


The below renames some functions, just to reflect the actual types
manipulated. 

Bootstrapped and tested on an i686-pc-linux-gnu

-- Gaby

2002-06-02  Gabriel Dos Reis  <gdr@codesourcery.com>

	* diagnostic.c (diagnostic_finish): Rename to output_flush.
	(clear_disgnostic_info): Rename to output_clear_data.  Use false
	instead of 0 for boolean value.
	Adjust function call throughout.

Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.c,v
retrieving revision 1.83
diff -p -r1.83 diagnostic.c
*** diagnostic.c	11 May 2002 10:47:01 -0000	1.83
--- diagnostic.c	2 Jun 2002 17:32:53 -0000
*************** Software Foundation, 59 Temple Place - S
*** 59,65 ****
  #define diagnostic_msg output_buffer_text_cursor (diagnostic_buffer)
  
  /* Prototypes.  */
! static void diagnostic_finish PARAMS ((output_buffer *));
  static void output_do_verbatim PARAMS ((output_buffer *,
  					const char *, va_list *));
  static void output_buffer_to_stream PARAMS ((output_buffer *));
--- 59,65 ----
  #define diagnostic_msg output_buffer_text_cursor (diagnostic_buffer)
  
  /* Prototypes.  */
! static void output_flush PARAMS ((output_buffer *));
  static void output_do_verbatim PARAMS ((output_buffer *,
  					const char *, va_list *));
  static void output_buffer_to_stream PARAMS ((output_buffer *));
*************** static void output_append_r PARAMS ((out
*** 89,95 ****
  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_diagnostic_info PARAMS ((output_buffer *));
  
  static void default_diagnostic_starter PARAMS ((output_buffer *,
  						diagnostic_context *));
--- 89,95 ----
  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 output_clear_data PARAMS ((output_buffer *));
  
  static void default_diagnostic_starter PARAMS ((output_buffer *,
  						diagnostic_context *));
*************** output_clear_message_text (buffer)
*** 276,290 ****
    output_text_length (buffer) = 0;
  }
  
! /* Zero out any diagnostic data used so far by BUFFER.  */
  
  static void
! clear_diagnostic_info (buffer)
       output_buffer *buffer;
  {
    output_buffer_text_cursor (buffer) = NULL;
    output_buffer_ptr_to_format_args (buffer) = NULL;
!   prefix_was_emitted_for (buffer) = 0;
    output_indentation (buffer) = 0;
  }
  
--- 276,290 ----
    output_text_length (buffer) = 0;
  }
  
! /* Zero out any formatting data used so far by BUFFER.  */
  
  static void
! output_clear_data (buffer)
       output_buffer *buffer;
  {
    output_buffer_text_cursor (buffer) = NULL;
    output_buffer_ptr_to_format_args (buffer) = NULL;
!   prefix_was_emitted_for (buffer) = false;
    output_indentation (buffer) = 0;
  }
  
*************** init_output_buffer (buffer, prefix, maxi
*** 304,310 ****
    output_prefixing_rule (buffer) = diagnostic_prefixing_rule (global_dc);
    output_set_prefix (buffer, prefix);
    output_text_length (buffer) = 0;
!   clear_diagnostic_info (buffer);
  }
  
  /* Reinitialize BUFFER.  */
--- 304,310 ----
    output_prefixing_rule (buffer) = diagnostic_prefixing_rule (global_dc);
    output_set_prefix (buffer, prefix);
    output_text_length (buffer) = 0;
!   output_clear_data (buffer);
  }
  
  /* Reinitialize BUFFER.  */
*************** output_clear (buffer)
*** 314,320 ****
       output_buffer *buffer;
  {
    output_clear_message_text (buffer);
!   clear_diagnostic_info (buffer);
  }
  
  /* Finishes constructing a NULL-terminated character string representing
--- 314,320 ----
       output_buffer *buffer;
  {
    output_clear_message_text (buffer);
!   output_clear_data (buffer);
  }
  
  /* Finishes constructing a NULL-terminated character string representing
*************** diagnostic_for_decl (decl, msgid, args_p
*** 907,913 ****
        output_buffer_ptr_to_format_args (diagnostic_buffer) = args_ptr;
        output_buffer_text_cursor (diagnostic_buffer) = _(msgid);
        format_with_decl (diagnostic_buffer, decl);
!       diagnostic_finish ((output_buffer *) global_dc);
        output_destroy_prefix (diagnostic_buffer);
  
        output_buffer_state (diagnostic_buffer) = os;
--- 907,913 ----
        output_buffer_ptr_to_format_args (diagnostic_buffer) = args_ptr;
        output_buffer_text_cursor (diagnostic_buffer) = _(msgid);
        format_with_decl (diagnostic_buffer, decl);
!       output_flush (&global_dc->buffer);
        output_destroy_prefix (diagnostic_buffer);
  
        output_buffer_state (diagnostic_buffer) = os;
*************** diagnostic_for_decl (decl, msgid, args_p
*** 915,920 ****
--- 915,965 ----
    diagnostic_lock--;
  }
  
+ /* Flush the content of BUFFER onto the attached stream.  */
+ 
+ static void
+ output_flush (buffer)
+      output_buffer *buffer;
+ {
+   output_buffer_to_stream (buffer);
+   output_clear_data (buffer);
+   fputc ('\n', output_buffer_attached_stream (buffer));
+   fflush (output_buffer_attached_stream (buffer));
+ }
+ 
+ /* Helper subroutine of output_verbatim and verbatim. Do the appropriate
+    settings needed by BUFFER for a verbatim formatting.  */
+ 
+ static void
+ output_do_verbatim (buffer, msgid, args_ptr)
+      output_buffer *buffer;
+      const char *msgid;
+      va_list *args_ptr;
+ {
+   output_state os;
+ 
+   os = output_buffer_state (buffer);
+   output_prefix (buffer) = NULL;
+   output_prefixing_rule (buffer) = DIAGNOSTICS_SHOW_PREFIX_NEVER;
+   output_buffer_text_cursor (buffer) = _(msgid);
+   output_buffer_ptr_to_format_args (buffer) = args_ptr;
+   output_set_maximum_length (buffer, 0);
+   output_format (buffer);
+   output_buffer_state (buffer) = os;
+ }
+ 
+ /* Output MESSAGE verbatim into BUFFER.  */
+ 
+ void
+ output_verbatim VPARAMS ((output_buffer *buffer, const char *msgid, ...))
+ {
+   VA_OPEN (ap, msgid);
+   VA_FIXEDARG (ap, output_buffer *, buffer);
+   VA_FIXEDARG (ap, const char *, msgid);
+ 
+   output_do_verbatim (buffer, msgid, &ap);
+   VA_CLOSE (ap);
+ }
  
  /* Count an error or warning.  Return 1 if the message should be printed.  */
  
*************** fatal_io_error VPARAMS ((const char *msg
*** 974,980 ****
    output_buffer_ptr_to_format_args (diagnostic_buffer) = ≈
    output_buffer_text_cursor (diagnostic_buffer) = _(msgid);
    output_format (diagnostic_buffer);
!   diagnostic_finish ((output_buffer *) global_dc);
    output_buffer_state (diagnostic_buffer) = os;
    VA_CLOSE (ap);
    exit (FATAL_EXIT_CODE);
--- 1019,1025 ----
    output_buffer_ptr_to_format_args (diagnostic_buffer) = ≈
    output_buffer_text_cursor (diagnostic_buffer) = _(msgid);
    output_format (diagnostic_buffer);
!   output_flush (&global_dc->buffer);
    output_buffer_state (diagnostic_buffer) = os;
    VA_CLOSE (ap);
    exit (FATAL_EXIT_CODE);
*************** pedwarn VPARAMS ((const char *msgid, ...
*** 996,1002 ****
    VA_CLOSE (ap);
  }
  
! /* Issue a pedantic waring about DECL.  */
  
  void
  pedwarn_with_decl VPARAMS ((tree decl, const char *msgid, ...))
--- 1041,1047 ----
    VA_CLOSE (ap);
  }
  
! /* Issue a pedantic warning about DECL.  */
  
  void
  pedwarn_with_decl VPARAMS ((tree decl, const char *msgid, ...))
*************** sorry VPARAMS ((const char *msgid, ...))
*** 1053,1059 ****
    output_buffer_ptr_to_format_args (diagnostic_buffer) = ≈
    output_buffer_text_cursor (diagnostic_buffer) = _(msgid);
    output_format (diagnostic_buffer);
!   diagnostic_finish ((output_buffer *) global_dc);
    output_buffer_state (diagnostic_buffer) = os;
    VA_CLOSE (ap);
  }
--- 1098,1104 ----
    output_buffer_ptr_to_format_args (diagnostic_buffer) = ≈
    output_buffer_text_cursor (diagnostic_buffer) = _(msgid);
    output_format (diagnostic_buffer);
!   output_flush (&global_dc->buffer);
    output_buffer_state (diagnostic_buffer) = os;
    VA_CLOSE (ap);
  }
*************** warning VPARAMS ((const char *msgid, ...
*** 1281,1331 ****
    VA_CLOSE (ap);
  }
  
- /* Flush diagnostic_buffer content on stderr.  */
- 
- static void
- diagnostic_finish (buffer)
-      output_buffer *buffer;
- {
-   output_buffer_to_stream (buffer);
-   clear_diagnostic_info (buffer);
-   fputc ('\n', output_buffer_attached_stream (buffer));
-   fflush (output_buffer_attached_stream (buffer));
- }
- 
- /* Helper subroutine of output_verbatim and verbatim. Do the appropriate
-    settings needed by BUFFER for a verbatim formatting.  */
- 
- static void
- output_do_verbatim (buffer, msgid, args_ptr)
-      output_buffer *buffer;
-      const char *msgid;
-      va_list *args_ptr;
- {
-   output_state os;
- 
-   os = output_buffer_state (buffer);
-   output_prefix (buffer) = NULL;
-   output_prefixing_rule (buffer) = DIAGNOSTICS_SHOW_PREFIX_NEVER;
-   output_buffer_text_cursor (buffer) = _(msgid);
-   output_buffer_ptr_to_format_args (buffer) = args_ptr;
-   output_set_maximum_length (buffer, 0);
-   output_format (buffer);
-   output_buffer_state (buffer) = os;
- }
- 
- /* Output MESSAGE verbatim into BUFFER.  */
- 
- void
- output_verbatim VPARAMS ((output_buffer *buffer, const char *msgid, ...))
- {
-   VA_OPEN (ap, msgid);
-   VA_FIXEDARG (ap, output_buffer *, buffer);
-   VA_FIXEDARG (ap, const char *, msgid);
- 
-   output_do_verbatim (buffer, msgid, &ap);
-   VA_CLOSE (ap);
- }
  
  /* Same as above but use diagnostic_buffer.  */
  
--- 1326,1331 ----
*************** report_diagnostic (dc)
*** 1363,1369 ****
        (*diagnostic_starter (dc)) (diagnostic_buffer, dc);
        output_format (diagnostic_buffer);
        (*diagnostic_finalizer (dc)) (diagnostic_buffer, dc);
!       diagnostic_finish ((output_buffer *) global_dc);
        output_buffer_state (diagnostic_buffer) = os;
      }
  
--- 1363,1369 ----
        (*diagnostic_starter (dc)) (diagnostic_buffer, dc);
        output_format (diagnostic_buffer);
        (*diagnostic_finalizer (dc)) (diagnostic_buffer, dc);
!       output_flush (&global_dc->buffer);
        output_buffer_state (diagnostic_buffer) = os;
      }
  
*************** static void
*** 1379,1385 ****
  error_recursion ()
  {
    if (diagnostic_lock < 3)
!     diagnostic_finish ((output_buffer *) global_dc);
  
    fnotice (stderr,
  	   "Internal compiler error: Error reporting routines re-entered.\n");
--- 1379,1385 ----
  error_recursion ()
  {
    if (diagnostic_lock < 3)
!     output_flush (&global_dc->buffer);
  
    fnotice (stderr,
  	   "Internal compiler error: Error reporting routines re-entered.\n");



More information about the Gcc-patches mailing list