summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.h
diff options
context:
space:
mode:
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2001-06-10 13:48:04 +0000
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2001-06-10 13:48:04 +0000
commita587b03b0bad479328832d9cf1fdfae26d57808d (patch)
tree0beb92444cb25b52bba6afa1198fdb6b47f5f556 /gcc/diagnostic.h
parent098ab62d6604a8e5da61899a4acb4c5499ec58f5 (diff)
downloadgcc-a587b03b0bad479328832d9cf1fdfae26d57808d.tar.gz
gcc/
2001-06-10 Mark Mitchell <mark@codesourcery.com> Gabriel Dos Reis <gdr@codesourcery.com> * Makefile.in (c-parse.o): Depend on diagnostic.h (dwarf2out.o): Likewise. * dwarf2out.c: #include diagnostic.h * toplev.h (warningcount, errorcount, sorrycount): Remove declarations. * toplev.c (warningcount, errorcount, sorrycount): Remove definitions. * diagnostic.h (struct output_buffer): Reorder fields. (diagnostic_kind_count): New macro. (errorcount, warningcount, sorrycount): Define as macros. (diagnostic_report_warnings_p): New macro. (output_state): Add diagnostic_count field. * diagnostic.c (warningcount, errorcount, inhibit_warnings): Remove tentative declaration. (count_error): Use diagnostic_report_warnings_p. * c-parse.in: #include diagnostic.h ch/ 2001-06-10 Gabriel Dos Reis <gdr@codesourcery.com> * decl.c: #include diagnostic.h * actions.c: #include diagnostic.h * Makefile.in (actions.o): Depend on diagnostic.h (decl.o): Depend on diagnostic.h cp/ 2001-06-10 Mark Mitchell <mark@codesourcery.com> Gabriel Dos Reis <gdr@codesourcery.com> * Make-lang.in (cp/call.o): Depend on diagnostic.h (cp/typeck.o): Depend on diagnostic.h (cp/typeck2.o): Depend on diagnostic.h (cp/repo.o): Depend on dignostic.h * typeck.c: #include diagnostic.h (convert_for_initialization): Remove extern declaration for warningcount and errorcount. * call.c: #include diagnostic.h (convert_like_real): Remove extern declaration for warnincount and errorcount. * repo.c: #include diagnostic.h * typeck2.c: #include diagnostic.h git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43140 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.h')
-rw-r--r--gcc/diagnostic.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 9d017584aaf..02029ea59c7 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -55,9 +55,11 @@ typedef struct
{
/* The prefix for each new line. */
const char *prefix;
+
/* The real upper bound of number of characters per line, taking into
account the case of a very very looong prefix. */
int maximum_length;
+
/* The ideal upper bound of number of characters per line, as suggested
by front-end. */
int ideal_maximum_length;
@@ -77,11 +79,16 @@ typedef struct
o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit current PREFIX each time
a physical line is started. */
int prefixing_rule;
+
/* The current char to output. Updated by front-end (*format_map) when
it is called to report front-end printer for a specified format. */
const char *cursor;
+
/* 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. */
@@ -90,16 +97,20 @@ struct output_buffer
/* Internal data. These fields should not be accessed directly by
front-ends. */
+ /* The current state of the buffer. */
+ output_state state;
+
/* Where to output formatted text. */
FILE* stream;
+
/* The obstack where the text is built up. */
struct obstack obstack;
+
/* The amount of characters output so far. */
int line_length;
- /* The current state of the buffer. */
- output_state state;
};
+#define output_buffer_state(BUFFER) (BUFFER)->state
#define output_buffer_attached_stream(BUFFER) (BUFFER)->stream
#define output_buffer_text_cursor(BUFFER) (BUFFER)->state.cursor
#define output_buffer_format_args(BUFFER) *((BUFFER)->state.format_args)
@@ -178,6 +189,23 @@ extern int diagnostic_message_length_per_line;
has been removed. */
extern output_buffer *diagnostic_buffer;
+#define diagnostic_kind_count(BUFFER, DK) \
+ (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 (diagnostic_buffer, DK_ERROR)
+/* Similarly, but for warnings. */
+#define warningcount diagnostic_kind_count (diagnostic_buffer, DK_WARNING)
+/* Similarly, but for sorrys. */
+#define sorrycount diagnostic_kind_count (diagnostic_buffer, DK_SORRY)
+
+/* Returns non-zero if warnings should be emitted. */
+#define diagnostic_report_warnings_p() \
+ (!inhibit_warnings \
+ && !(in_system_header && !warn_system_headers))
+
+
/* Prototypes */
extern void set_diagnostic_context PARAMS ((diagnostic_context *,
const char *, va_list *,