No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-5166-g579bb65cdd35a4.
gcc/ChangeLog: * diagnostic.cc (diagnostic_context::check_max_errors): Replace uses of diagnostic_kind_count with simple field acesss. (diagnostic_context::report_diagnostic): Likewise. (diagnostic_text_output_format::~diagnostic_text_output_format): Replace use of diagnostic_kind_count with diagnostic_context::diagnostic_count. * diagnostic.h (diagnostic_kind_count): Delete. (errorcount): Replace use of diagnostic_kind_count with diagnostic_context::diagnostic_count. (warningcount): Likewise. (werrorcount): Likewise. (sorrycount): Likewise. --- gcc/diagnostic.cc | 16 ++++++++-------- gcc/diagnostic.h | 17 ++++------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index e917e6ce4ac..90103e150f7 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -651,9 +651,9 @@ diagnostic_context::check_max_errors (bool flush) if (!m_max_errors) return; - int count = (diagnostic_kind_count (this, DK_ERROR) - + diagnostic_kind_count (this, DK_SORRY) - + diagnostic_kind_count (this, DK_WERROR)); + int count = (m_diagnostic_count[DK_ERROR] + + m_diagnostic_count[DK_SORRY] + + m_diagnostic_count[DK_WERROR]); if (count >= m_max_errors) { @@ -1547,8 +1547,8 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) error has already occurred. This is counteracted by abort_on_error. */ if (!CHECKING_P - && (diagnostic_kind_count (this, DK_ERROR) > 0 - || diagnostic_kind_count (this, DK_SORRY) > 0) + && (m_diagnostic_count[DK_ERROR] > 0 + || m_diagnostic_count[DK_SORRY] > 0) && !m_abort_on_error) { expanded_location s @@ -1563,9 +1563,9 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) diagnostic->message.m_args_ptr); } if (diagnostic->kind == DK_ERROR && orig_diag_kind == DK_WARNING) - ++diagnostic_kind_count (this, DK_WERROR); + ++m_diagnostic_count[DK_WERROR]; else - ++diagnostic_kind_count (this, diagnostic->kind); + ++m_diagnostic_count[diagnostic->kind]; /* Is this the initial diagnostic within the stack of groups? */ if (m_diagnostic_groups.m_emission_count == 0) @@ -2336,7 +2336,7 @@ auto_diagnostic_group::~auto_diagnostic_group () diagnostic_text_output_format::~diagnostic_text_output_format () { /* Some of the errors may actually have been warnings. */ - if (diagnostic_kind_count (&m_context, DK_WERROR)) + if (m_context.diagnostic_count (DK_WERROR)) { /* -Werror was given. */ if (m_context.warning_as_error_requested_p ()) diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index cf21558c7b2..4ef031b5d1c 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -701,24 +701,15 @@ extern diagnostic_context *global_dc; ready for use. */ #define diagnostic_ready_p() (global_dc->printer != NULL) -/* The total count of a KIND of diagnostics emitted so far. */ - -inline int & -diagnostic_kind_count (diagnostic_context *context, - diagnostic_t kind) -{ - return context->diagnostic_count (kind); -} - /* 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) +#define errorcount global_dc->diagnostic_count (DK_ERROR) /* Similarly, but for warnings. */ -#define warningcount diagnostic_kind_count (global_dc, DK_WARNING) +#define warningcount global_dc->diagnostic_count (DK_WARNING) /* Similarly, but for warnings promoted to errors. */ -#define werrorcount diagnostic_kind_count (global_dc, DK_WERROR) +#define werrorcount global_dc->diagnostic_count (DK_WERROR) /* Similarly, but for sorrys. */ -#define sorrycount diagnostic_kind_count (global_dc, DK_SORRY) +#define sorrycount global_dc->diagnostic_count (DK_SORRY) /* Returns nonzero if warnings should be emitted. */ #define diagnostic_report_warnings_p(DC, LOC) \ -- 2.26.3