Commit 7783b402 by Gabriel Dos Reis Committed by Gabriel Dos Reis

c-opts.c (c_common_handle_option): <case OPT_Werror> set global_dc->warning_as_error_requested.

        * c-opts.c (c_common_handle_option): <case OPT_Werror> set
        global_dc->warning_as_error_requested.
        * diagnostic.c (diagnostic_initialize): Tidy.
        * diagnostic.h (diagnostic_context::x_data): Remove
        (diagnostic_context::issue_warnings_are_errors_message): Rename
        from warnings_are_errors_message.
        (diagnostic_context::warning_as_error_requested): New.

From-SVN: r86750
parent 04204c2f
2004-08-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/15378
* c-opts.c (c_common_handle_option): <case OPT_Werror> set
global_dc->warning_as_error_requested.
* diagnostic.c (diagnostic_initialize): Tidy.
* diagnostic.h (diagnostic_context::x_data): Remove
(diagnostic_context::issue_warnings_are_errors_message): Rename
from warnings_are_errors_message.
(diagnostic_context::warning_as_error_requested): New.
2004-08-30 Richard Earnshaw <rearnsha@arm.com> 2004-08-30 Richard Earnshaw <rearnsha@arm.com>
* sched-deps.c (get_condition): Fix breakage in previous patch. * sched-deps.c (get_condition): Fix breakage in previous patch.
......
...@@ -420,6 +420,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) ...@@ -420,6 +420,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
case OPT_Werror: case OPT_Werror:
cpp_opts->warnings_are_errors = value; cpp_opts->warnings_are_errors = value;
global_dc->warning_as_error_requested = value;
break; break;
case OPT_Werror_implicit_function_declaration: case OPT_Werror_implicit_function_declaration:
......
...@@ -107,7 +107,8 @@ diagnostic_initialize (diagnostic_context *context) ...@@ -107,7 +107,8 @@ diagnostic_initialize (diagnostic_context *context)
context->printer->prefixing_rule = DIAGNOSTICS_SHOW_PREFIX_ONCE; context->printer->prefixing_rule = DIAGNOSTICS_SHOW_PREFIX_ONCE;
memset (context->diagnostic_count, 0, sizeof context->diagnostic_count); memset (context->diagnostic_count, 0, sizeof context->diagnostic_count);
context->warnings_are_errors_message = warnings_are_errors; context->issue_warnings_are_errors_message = true;
context->warning_as_error_requested = false;
context->abort_on_error = false; context->abort_on_error = false;
context->internal_error = NULL; context->internal_error = NULL;
diagnostic_starter (context) = default_diagnostic_starter; diagnostic_starter (context) = default_diagnostic_starter;
...@@ -115,7 +116,6 @@ diagnostic_initialize (diagnostic_context *context) ...@@ -115,7 +116,6 @@ diagnostic_initialize (diagnostic_context *context)
context->last_module = 0; context->last_module = 0;
context->last_function = NULL; context->last_function = NULL;
context->lock = 0; context->lock = 0;
context->x_data = NULL;
} }
/* Returns true if the next format specifier in TEXT is a format specifier /* Returns true if the next format specifier in TEXT is a format specifier
...@@ -226,17 +226,16 @@ diagnostic_count_diagnostic (diagnostic_context *context, ...@@ -226,17 +226,16 @@ diagnostic_count_diagnostic (diagnostic_context *context,
if (!diagnostic_report_warnings_p ()) if (!diagnostic_report_warnings_p ())
return false; return false;
if (!warnings_are_errors) if (!context->warning_as_error_requested)
{ {
++diagnostic_kind_count (context, DK_WARNING); ++diagnostic_kind_count (context, DK_WARNING);
break; break;
} }
else if (context->issue_warnings_are_errors_message)
if (context->warnings_are_errors_message)
{ {
pp_verbatim (context->printer, pp_verbatim (context->printer,
"%s: warnings being treated as errors\n", progname); "%s: warnings being treated as errors\n", progname);
context->warnings_are_errors_message = false; context->issue_warnings_are_errors_message = false;
} }
/* And fall through. */ /* And fall through. */
......
...@@ -65,7 +65,10 @@ struct diagnostic_context ...@@ -65,7 +65,10 @@ struct diagnostic_context
/* True if we should display the "warnings are being tread as error" /* True if we should display the "warnings are being tread as error"
message, usually displayed once per compiler run. */ message, usually displayed once per compiler run. */
bool warnings_are_errors_message; bool issue_warnings_are_errors_message;
/* True if it has been requested that warnings be treated as errors. */
bool warning_as_error_requested;
/* True if we should raise a SIGABRT on errors. */ /* True if we should raise a SIGABRT on errors. */
bool abort_on_error; bool abort_on_error;
...@@ -94,9 +97,6 @@ struct diagnostic_context ...@@ -94,9 +97,6 @@ struct diagnostic_context
int last_module; int last_module;
int lock; int lock;
/* Hook for front-end extensions. */
void *x_data;
}; };
/* Client supplied function to announce a diagnostic. */ /* Client supplied function to announce a diagnostic. */
......
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