- and similar functions. In general, such usage should be
- avoided. This global buffer will go away, once all such usage
- has been removed. */
-extern output_buffer *diagnostic_buffer;
-
-/* Prototypes */
-extern void set_diagnostic_context PARAMS ((diagnostic_context *,
- const char *, va_list *,
- const char *, int, int));
-extern void set_internal_error_function PARAMS ((void (*)
- PARAMS ((const char *,
- va_list *))));
-extern void report_diagnostic PARAMS ((diagnostic_context *));
-extern void initialize_diagnostics PARAMS ((void));
-extern void reshape_diagnostic_buffer PARAMS ((void));
-extern void default_initialize_buffer PARAMS ((output_buffer *));
-extern void init_output_buffer PARAMS ((output_buffer *,
- const char *, int));
-extern void flush_diagnostic_buffer PARAMS ((void));
-extern void output_clear PARAMS ((output_buffer *));
-extern const char *output_get_prefix PARAMS ((const output_buffer *));
-extern const char *output_last_position PARAMS ((const output_buffer *));
-extern void output_set_prefix PARAMS ((output_buffer *,
- const char *));
-extern void output_destroy_prefix PARAMS ((output_buffer *));
-extern void output_set_maximum_length PARAMS ((output_buffer *, int));
-extern void output_emit_prefix PARAMS ((output_buffer *));
-extern void output_add_newline PARAMS ((output_buffer *));
-extern void output_add_space PARAMS ((output_buffer *));
-extern int output_space_left PARAMS ((const output_buffer *));
-extern void output_append PARAMS ((output_buffer *, const char *,
- const char *));
-extern void output_add_character PARAMS ((output_buffer *, int));
-extern void output_decimal PARAMS ((output_buffer *, int));
-extern void output_add_string PARAMS ((output_buffer *,
- const char *));
-extern const char *output_finalize_message PARAMS ((output_buffer *));
-extern void output_clear_message_text PARAMS ((output_buffer *));
-extern void output_printf PARAMS ((output_buffer *, const char *,
- ...)) ATTRIBUTE_PRINTF_2;
-extern int output_is_line_wrapping PARAMS ((output_buffer *));
-extern void set_message_prefixing_rule PARAMS ((int));
-extern void output_verbatim PARAMS ((output_buffer *, const char *,
- ...)) ATTRIBUTE_PRINTF_2;
-extern void verbatim PARAMS ((const char *, ...))
- ATTRIBUTE_PRINTF_1;
-extern char *context_as_prefix PARAMS ((const char *, int, int));
-extern char *file_name_as_prefix PARAMS ((const char *));
-extern int error_module_changed PARAMS ((void));
-extern void record_last_error_module PARAMS ((void));
-extern int error_function_changed PARAMS ((void));
-extern void record_last_error_function PARAMS ((void));
-extern void report_problematic_module PARAMS ((output_buffer *));
-
-#endif /* __GCC_DIAGNOSTIC_H__ */
+ and similar functions. */
+extern diagnostic_context *global_dc;
+
+/* The total count of a KIND of diagnostics emitted 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)
+/* Similarly, but for sorrys. */
+#define sorrycount diagnostic_kind_count (global_dc, DK_SORRY)
+
+/* Returns nonzero if warnings should be emitted. */
+#define diagnostic_report_warnings_p(DC, LOC) \
+ (!(DC)->dc_inhibit_warnings \
+ && !(in_system_header_at (LOC) && !(DC)->dc_warn_system_headers))
+
+#define report_diagnostic(D) diagnostic_report_diagnostic (global_dc, D)
+
+/* Override the column number to be used for reporting a
+ diagnostic. */
+#define diagnostic_override_column(DI, COL) (DI)->override_column = (COL)
+
+/* Override the option index to be used for reporting a
+ diagnostic. */
+#define diagnostic_override_option_index(DI, OPTIDX) \
+ ((DI)->option_index = (OPTIDX))
+
+/* Diagnostic related functions. */
+extern void diagnostic_initialize (diagnostic_context *, int);
+extern void diagnostic_finish (diagnostic_context *);
+extern void diagnostic_report_current_module (diagnostic_context *);
+
+/* Force diagnostics controlled by OPTIDX to be kind KIND. */
+extern diagnostic_t diagnostic_classify_diagnostic (diagnostic_context *,
+ int /* optidx */,
+ diagnostic_t /* kind */,
+ location_t);
+extern void diagnostic_push_diagnostics (diagnostic_context *, location_t);
+extern void diagnostic_pop_diagnostics (diagnostic_context *, location_t);
+extern bool diagnostic_report_diagnostic (diagnostic_context *,
+ diagnostic_info *);
+#ifdef ATTRIBUTE_GCC_DIAG
+extern void diagnostic_set_info (diagnostic_info *, const char *, va_list *,
+ location_t, diagnostic_t) ATTRIBUTE_GCC_DIAG(2,0);
+extern void diagnostic_set_info_translated (diagnostic_info *, const char *,
+ va_list *, location_t,
+ diagnostic_t)
+ ATTRIBUTE_GCC_DIAG(2,0);
+#endif
+extern char *diagnostic_build_prefix (diagnostic_context *, diagnostic_info *);
+void default_diagnostic_starter (diagnostic_context *, diagnostic_info *);
+void default_diagnostic_finalizer (diagnostic_context *, diagnostic_info *);
+
+/* Pure text formatting support functions. */
+extern char *file_name_as_prefix (const char *);
+
+#endif /* ! GCC_DIAGNOSTIC_H */