Diagnostic.h: Move diagnostic_count to diagnostic_context
Gabriel Dos Reis
gdr@codesourcery.com
Mon Jun 3 12:50:00 GMT 2002
This patchlet moves the diagnostic_count array from output_buffer to
diagnostic_context. Bootstrapped and tested on an i686-pc-linux-gnu.
-- Gaby
2002-06-03 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.h (diagnostic_count): Move from output_buffer to
diagnostic_context.
(diagnostic_kind_count): Adjust definition.
Index: diagnostic.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.h,v
retrieving revision 1.41
diff -p -r1.41 diagnostic.h
*** diagnostic.h 2 Jun 2002 19:06:28 -0000 1.41
--- diagnostic.h 3 Jun 2002 19:07:58 -0000
*************** typedef struct
*** 90,106 ****
/* A pointer to the variable argument-list for formatting. */
va_list *format_args;
-
- /* The number of times we have issued diagnostics. */
- int diagnostic_count[DK_LAST_DIAGNOSTIC_KIND];
} output_state;
! /* The output buffer datatype. This is best seen as an abstract datatype. */
struct output_buffer
{
- /* Internal data. These fields should not be accessed directly by
- front-ends. */
-
/* The current state of the buffer. */
output_state state;
--- 90,101 ----
/* A pointer to the variable argument-list for formatting. */
va_list *format_args;
} output_state;
! /* The output buffer datatype. This is best seen as an abstract datatype
! whose fields should not be accessed directly by clients. */
struct output_buffer
{
/* The current state of the buffer. */
output_state state;
*************** struct output_buffer
*** 152,158 ****
/* The amount of whitespace to be emitted when starting a new line. */
#define output_indentation(BUFFER) (BUFFER)->state.indent_skip
! /* A pointer to the formatted diagonstic message. */
#define output_message_text(BUFFER) \
((const char *) obstack_base (&(BUFFER)->obstack))
--- 147,153 ----
/* The amount of whitespace to be emitted when starting a new line. */
#define output_indentation(BUFFER) (BUFFER)->state.indent_skip
! /* A pointer to the formatted diagnostic message. */
#define output_message_text(BUFFER) \
((const char *) obstack_base (&(BUFFER)->obstack))
*************** struct diagnostic_context
*** 182,188 ****
purpose of message formatting. */
va_list *args_ptr;
! /* The name of the source file involved in the diiagnostic. */
const char *file;
/* The line-location in the source file. */
--- 177,183 ----
purpose of message formatting. */
va_list *args_ptr;
! /* The name of the source file involved in the diagnostic. */
const char *file;
/* The line-location in the source file. */
*************** struct diagnostic_context
*** 191,196 ****
--- 186,194 ----
/* Is this message a warning? */
int warn;
+ /* The number of times we have issued diagnostics. */
+ int diagnostic_count[DK_LAST_DIAGNOSTIC_KIND];
+
/* This function is called before any message is printed out. It is
responsible for preparing message prefix and such. For example, it
might say:
*************** struct diagnostic_context
*** 251,267 ****
#define diagnostic_buffer (&global_dc->buffer)
! /* This diagnostic context is used by front-ends that directly output
diagnostic messages without going through `error', `warning',
and similar functions. */
extern diagnostic_context *global_dc;
/* The total count of a KIND of diagnostics meitted so far. */
! #define diagnostic_kind_count(DC, DK) \
! (DC)->buffer.state.diagnostic_count[(int) (DK)]
/* The number of errors that have been issued so far. Ideally, these
! would take an output_buffer as an argument. */
#define errorcount diagnostic_kind_count (global_dc, DK_ERROR)
/* Similarly, but for warnings. */
#define warningcount diagnostic_kind_count (global_dc, DK_WARNING)
--- 249,264 ----
#define diagnostic_buffer (&global_dc->buffer)
! /* This diagnostic_context is used by front-ends that directly output
diagnostic messages without going through `error', `warning',
and similar functions. */
extern diagnostic_context *global_dc;
/* The total count of a KIND of diagnostics meitted so far. */
! #define diagnostic_kind_count(DC, DK) (DC)->diagnostic_count[(int) (DK)]
/* The number of errors that have been issued so far. Ideally, these
! would take a diagnostic_context as an argument. */
#define errorcount diagnostic_kind_count (global_dc, DK_ERROR)
/* Similarly, but for warnings. */
#define warningcount diagnostic_kind_count (global_dc, DK_WARNING)
More information about the Gcc-patches
mailing list