Commit 13f0d49c by Gabriel Dos Reis Committed by Gabriel Dos Reis

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
parent 0db79a6b
2002-06-12 Gabriel Dos Reis <gdr@codesourcery.com>
* 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.
2002-06-11 Tom Tromey <tromey@redhat.com> 2002-06-11 Tom Tromey <tromey@redhat.com>
For PR java/6520: For PR java/6520:
......
...@@ -766,6 +766,7 @@ diagnostic_initialize (context) ...@@ -766,6 +766,7 @@ diagnostic_initialize (context)
diagnostic_starter (context) = default_diagnostic_starter; diagnostic_starter (context) = default_diagnostic_starter;
diagnostic_finalizer (context) = default_diagnostic_finalizer; diagnostic_finalizer (context) = default_diagnostic_finalizer;
context->warnings_are_errors_message = warnings_are_errors;
} }
void void
...@@ -819,7 +820,7 @@ diagnostic_for_decl (diagnostic, decl) ...@@ -819,7 +820,7 @@ diagnostic_for_decl (diagnostic, decl)
if (global_dc->lock++) if (global_dc->lock++)
error_recursion (global_dc); 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); diagnostic_report_current_function (global_dc);
output_set_prefix output_set_prefix
...@@ -839,29 +840,42 @@ diagnostic_flush_buffer (context) ...@@ -839,29 +840,42 @@ diagnostic_flush_buffer (context)
fflush (output_buffer_attached_stream (&context->buffer)); fflush (output_buffer_attached_stream (&context->buffer));
} }
/* Count an error or warning. Return true if the message should be /* Count a diagnostic. Return true if the message should be printed. */
printed. */
bool bool
diagnostic_count_error (context, kind) diagnostic_count_diagnostic (context, kind)
diagnostic_context *context; diagnostic_context *context;
diagnostic_t kind; diagnostic_t kind;
{ {
if (kind == DK_WARNING && !diagnostic_report_warnings_p ()) switch (kind)
return false;
if (kind == DK_WARNING && !warnings_are_errors)
++diagnostic_kind_count (context, DK_WARNING);
else
{ {
static bool warning_message = false; default:
abort();
if (kind == DK_WARNING && !warning_message) 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, output_verbatim (&context->buffer,
"%s: warnings being treated as errors\n", progname); "%s: warnings being treated as errors\n", progname);
warning_message = true; context->warnings_are_errors_message = false;
} }
++diagnostic_kind_count (context, DK_ERROR); ++diagnostic_kind_count (context, DK_ERROR);
break;
} }
return true; return true;
...@@ -1220,7 +1234,7 @@ diagnostic_report_diagnostic (context, diagnostic) ...@@ -1220,7 +1234,7 @@ diagnostic_report_diagnostic (context, diagnostic)
if (context->lock++) if (context->lock++)
error_recursion (context); error_recursion (context);
if (diagnostic_count_error (context, diagnostic->kind)) if (diagnostic_count_diagnostic (context, diagnostic->kind))
{ {
(*diagnostic_starter (context)) (context, diagnostic); (*diagnostic_starter (context)) (context, diagnostic);
output_format (&context->buffer, &diagnostic->message); output_format (&context->buffer, &diagnostic->message);
......
...@@ -187,6 +187,10 @@ struct diagnostic_context ...@@ -187,6 +187,10 @@ struct diagnostic_context
/* The number of times we have issued diagnostics. */ /* The number of times we have issued diagnostics. */
int diagnostic_count[DK_LAST_DIAGNOSTIC_KIND]; int diagnostic_count[DK_LAST_DIAGNOSTIC_KIND];
/* True if we should display the "warnings are being tread as error"
message, usually displayed once per compiler run. */
bool warnings_are_errors_message;
/* This function is called before any message is printed out. It is /* This function is called before any message is printed out. It is
responsible for preparing message prefix and such. For example, it responsible for preparing message prefix and such. For example, it
might say: might say:
...@@ -284,7 +288,7 @@ extern void diagnostic_initialize PARAMS ((diagnostic_context *)); ...@@ -284,7 +288,7 @@ extern void diagnostic_initialize PARAMS ((diagnostic_context *));
extern void diagnostic_report_current_module PARAMS ((diagnostic_context *)); extern void diagnostic_report_current_module PARAMS ((diagnostic_context *));
extern void diagnostic_report_current_function PARAMS ((diagnostic_context *)); extern void diagnostic_report_current_function PARAMS ((diagnostic_context *));
extern void diagnostic_flush_buffer PARAMS ((diagnostic_context *)); extern void diagnostic_flush_buffer PARAMS ((diagnostic_context *));
extern bool diagnostic_count_error PARAMS ((diagnostic_context *, extern bool diagnostic_count_diagnostic PARAMS ((diagnostic_context *,
diagnostic_t)); diagnostic_t));
extern void diagnostic_report_diagnostic PARAMS ((diagnostic_context *, extern void diagnostic_report_diagnostic PARAMS ((diagnostic_context *,
diagnostic_info *)); diagnostic_info *));
......
2002-06-12 Gabriel Dos Reis <gdr@codesourcery.com>
* bad.c (ffebad_start_): Adjust calls to diagnostic_count_error.
2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com>
* bad.c (ffebad_start_): Adjust call to count_error. * bad.c (ffebad_start_): Adjust call to count_error.
......
...@@ -203,7 +203,7 @@ ffebad_start_ (bool lex_override, ffebad errnum, ffebadSeverity sev, ...@@ -203,7 +203,7 @@ ffebad_start_ (bool lex_override, ffebad errnum, ffebadSeverity sev,
if ((ffebad_severity_ != FFEBAD_severityPEDANTIC) if ((ffebad_severity_ != FFEBAD_severityPEDANTIC)
|| !flag_pedantic_errors) || !flag_pedantic_errors)
{ {
if (!diagnostic_count_error (global_dc, DK_WARNING)) if (!diagnostic_count_diagnostic (global_dc, DK_WARNING))
{ /* User wants no warnings. */ { /* User wants no warnings. */
ffebad_is_temp_inhibited_ = TRUE; ffebad_is_temp_inhibited_ = TRUE;
return FALSE; return FALSE;
...@@ -215,7 +215,7 @@ ffebad_start_ (bool lex_override, ffebad errnum, ffebadSeverity sev, ...@@ -215,7 +215,7 @@ ffebad_start_ (bool lex_override, ffebad errnum, ffebadSeverity sev,
case FFEBAD_severityWEIRD: case FFEBAD_severityWEIRD:
case FFEBAD_severitySEVERE: case FFEBAD_severitySEVERE:
case FFEBAD_severityDISASTER: case FFEBAD_severityDISASTER:
diagnostic_count_error (global_dc, DK_ERROR); diagnostic_count_diagnostic (global_dc, DK_ERROR);
break; break;
default: default:
......
...@@ -3416,7 +3416,7 @@ error_with_ivar (message, decl, rawdecl) ...@@ -3416,7 +3416,7 @@ error_with_ivar (message, decl, rawdecl)
tree decl; tree decl;
tree rawdecl; tree rawdecl;
{ {
diagnostic_count_error (global_dc, DK_ERROR); diagnostic_count_diagnostic (global_dc, DK_ERROR);
diagnostic_report_current_function (global_dc); diagnostic_report_current_function (global_dc);
...@@ -6895,7 +6895,7 @@ warn_with_method (message, mtype, method) ...@@ -6895,7 +6895,7 @@ warn_with_method (message, mtype, method)
int mtype; int mtype;
tree method; tree method;
{ {
if (!diagnostic_count_error (global_dc, DK_WARNING)) if (!diagnostic_count_diagnostic (global_dc, DK_WARNING))
return; return;
diagnostic_report_current_function (global_dc); diagnostic_report_current_function (global_dc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment