diff options
author | Gabriel Dos Reis <gdr@codesourcery.com> | 2002-06-11 23:11:34 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2002-06-11 23:11:34 +0000 |
commit | 13f0d49cdfb507a8e369b86d1c5038a08635cee7 (patch) | |
tree | 78d7bd65c43f7bf23d766026f9d3611afa6983e8 /gcc/diagnostic.c | |
parent | 0db79a6b35fc77ec500206c7442457dcc401a0e1 (diff) | |
download | gcc-13f0d49cdfb507a8e369b86d1c5038a08635cee7.zip gcc-13f0d49cdfb507a8e369b86d1c5038a08635cee7.tar.gz gcc-13f0d49cdfb507a8e369b86d1c5038a08635cee7.tar.bz2 |
objc-act.c (warn_with_ivar): Adjust calls to diagnostic_count_error.
* objc/objc-act.c (warn_with_ivar): Adjust calls to
diagnostic_count_error.
(warn_with_method): Likewise.
* diagnostic.h (warnings_are_errors_message): New field of
diagnostic_context.
(diagnostic_count_error): Rename to
diagnostic_count_diagnostic to
match semantics.
* diagnostic.c: Adjust calls to diagnostic_count_error through
out.
(diagnostic_count_diagnostic): Make aware of other kinds of
diagnostics.
(diagnostic_initialize): Initialize
warnings_are_errors_message field.
f/
2002-06-12 Gabriel Dos Reis <gdr@codesourcery.com>
* bad.c (ffebad_start_): Adjust calls to
diagnostic_count_error.
From-SVN: r54532
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r-- | gcc/diagnostic.c | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 22f116a..fd4462a 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -766,6 +766,7 @@ diagnostic_initialize (context) diagnostic_starter (context) = default_diagnostic_starter; diagnostic_finalizer (context) = default_diagnostic_finalizer; + context->warnings_are_errors_message = warnings_are_errors; } void @@ -819,7 +820,7 @@ diagnostic_for_decl (diagnostic, decl) if (global_dc->lock++) error_recursion (global_dc); - if (diagnostic_count_error (global_dc, diagnostic->kind)) + if (diagnostic_count_diagnostic (global_dc, diagnostic->kind)) { diagnostic_report_current_function (global_dc); output_set_prefix @@ -839,29 +840,42 @@ diagnostic_flush_buffer (context) fflush (output_buffer_attached_stream (&context->buffer)); } -/* Count an error or warning. Return true if the message should be - printed. */ +/* Count a diagnostic. Return true if the message should be printed. */ bool -diagnostic_count_error (context, kind) +diagnostic_count_diagnostic (context, kind) diagnostic_context *context; diagnostic_t kind; { - if (kind == DK_WARNING && !diagnostic_report_warnings_p ()) - return false; - - if (kind == DK_WARNING && !warnings_are_errors) - ++diagnostic_kind_count (context, DK_WARNING); - else + switch (kind) { - static bool warning_message = false; - - if (kind == DK_WARNING && !warning_message) - { + default: + abort(); + break; + + case DK_FATAL: case DK_ICE: case DK_SORRY: + case DK_ANACHRONISM: case DK_NOTE: + ++diagnostic_kind_count (context, kind); + break; + + case DK_WARNING: + if (!diagnostic_report_warnings_p ()) + return false; + else if (!warnings_are_errors) + { + ++diagnostic_kind_count (context, DK_WARNING); + break; + } + /* else fall through. */ + + case DK_ERROR: + if (kind == DK_WARNING && context->warnings_are_errors_message) + { output_verbatim (&context->buffer, "%s: warnings being treated as errors\n", progname); - warning_message = true; - } + context->warnings_are_errors_message = false; + } ++diagnostic_kind_count (context, DK_ERROR); + break; } return true; @@ -1220,7 +1234,7 @@ diagnostic_report_diagnostic (context, diagnostic) if (context->lock++) error_recursion (context); - if (diagnostic_count_error (context, diagnostic->kind)) + if (diagnostic_count_diagnostic (context, diagnostic->kind)) { (*diagnostic_starter (context)) (context, diagnostic); output_format (&context->buffer, &diagnostic->message); |