diff options
Diffstat (limited to 'gcc/diagnostic-core.h')
-rw-r--r-- | gcc/diagnostic-core.h | 84 |
1 files changed, 26 insertions, 58 deletions
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h index 1e89c9f..fc32f48 100644 --- a/gcc/diagnostic-core.h +++ b/gcc/diagnostic-core.h @@ -23,21 +23,8 @@ along with GCC; see the file COPYING3. If not see #define GCC_DIAGNOSTIC_CORE_H #include "bversion.h" - -/* Constants used to discriminate diagnostics. */ -typedef enum -{ -#define DEFINE_DIAGNOSTIC_KIND(K, msgid, C) K, -#include "diagnostic.def" -#undef DEFINE_DIAGNOSTIC_KIND - DK_LAST_DIAGNOSTIC_KIND, - /* This is used for tagging pragma pops in the diagnostic - classification history chain. */ - DK_POP, - /* This is used internally to note that a diagnostic is enabled - without mandating any specific type. */ - DK_ANY, -} diagnostic_t; +#include "diagnostics/kinds.h" +#include "diagnostics/option-id.h" /* RAII-style class for grouping related diagnostics within global_dc. */ @@ -61,28 +48,9 @@ class auto_diagnostic_nesting_level }; /* Forward decl. */ -class diagnostic_metadata; /* See diagnostic-metadata.h. */ - -/* A class to use for the ID of an option that controls - a particular diagnostic. - This is just a wrapper around "int", but better documents - the intent of the code. */ - -struct diagnostic_option_id -{ - diagnostic_option_id () : m_idx (0) {} - - diagnostic_option_id (int idx) : m_idx (idx) {} - /* Ideally we'd take an enum opt_code here, but we don't - want to depend on its decl. */ - - bool operator== (diagnostic_option_id other) const - { - return m_idx == other.m_idx; - } - - int m_idx; -}; +namespace diagnostics { + class metadata; /* See diagnostics/metadata.h. */ +} // namespace diagnostics extern const char *progname; @@ -109,29 +77,29 @@ extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) extern void internal_error_no_backtrace (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; /* Pass one of the OPT_W* from options.h as the first parameter. */ -extern bool warning (diagnostic_option_id, +extern bool warning (diagnostics::option_id, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern bool warning_n (location_t, - diagnostic_option_id, + diagnostics::option_id, unsigned HOST_WIDE_INT, const char *, const char *, ...) ATTRIBUTE_GCC_DIAG(4,6) ATTRIBUTE_GCC_DIAG(5,6); extern bool warning_n (rich_location *, - diagnostic_option_id, + diagnostics::option_id, unsigned HOST_WIDE_INT, const char *, const char *, ...) ATTRIBUTE_GCC_DIAG(4, 6) ATTRIBUTE_GCC_DIAG(5, 6); extern bool warning_at (location_t, - diagnostic_option_id, + diagnostics::option_id, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); extern bool warning_at (rich_location *, - diagnostic_option_id, + diagnostics::option_id, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); extern bool warning_meta (rich_location *, - const diagnostic_metadata &, - diagnostic_option_id, + const diagnostics::metadata &, + diagnostics::option_id, const char *, ...) ATTRIBUTE_GCC_DIAG(4,5); extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); @@ -141,29 +109,29 @@ extern void error_n (location_t, unsigned HOST_WIDE_INT, const char *, extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void error_at (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); -extern void error_meta (rich_location *, const diagnostic_metadata &, +extern void error_meta (rich_location *, const diagnostics::metadata &, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3) ATTRIBUTE_NORETURN; /* Pass one of the OPT_W* from options.h as the second parameter. */ extern bool pedwarn (location_t, - diagnostic_option_id, + diagnostics::option_id, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); extern bool pedwarn (rich_location *, - diagnostic_option_id, + diagnostics::option_id, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern bool permerror (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern bool permerror_opt (location_t, - diagnostic_option_id, + diagnostics::option_id, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); extern bool permerror_opt (rich_location *, - diagnostic_option_id, + diagnostics::option_id, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); @@ -174,23 +142,23 @@ extern void inform_n (location_t, unsigned HOST_WIDE_INT, const char *, const char *, ...) ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5); extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); -extern bool emit_diagnostic (diagnostic_t, +extern bool emit_diagnostic (enum diagnostics::kind, location_t, - diagnostic_option_id, + diagnostics::option_id, const char *, ...) ATTRIBUTE_GCC_DIAG(4,5); -extern bool emit_diagnostic (diagnostic_t, +extern bool emit_diagnostic (enum diagnostics::kind, rich_location *, - diagnostic_option_id, + diagnostics::option_id, const char *, ...) ATTRIBUTE_GCC_DIAG(4,5); -extern bool emit_diagnostic_valist (diagnostic_t, +extern bool emit_diagnostic_valist (enum diagnostics::kind, location_t, - diagnostic_option_id, + diagnostics::option_id, const char *, va_list *) ATTRIBUTE_GCC_DIAG (4,0); -extern bool emit_diagnostic_valist_meta (diagnostic_t, +extern bool emit_diagnostic_valist_meta (enum diagnostics::kind, rich_location *, - const diagnostic_metadata *, - diagnostic_option_id, + const diagnostics::metadata *, + diagnostics::option_id, const char *, va_list *) ATTRIBUTE_GCC_DIAG (5,0); extern bool seen_error (void); |