diff options
author | Joseph Myers <joseph@codesourcery.com> | 2010-10-05 15:28:39 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-10-05 15:28:39 +0100 |
commit | 1ebe4b4fa0b30f6ef7cb18404def5854745b5912 (patch) | |
tree | 43c4d6f7a1bd908c7de82db7e4231d62541f883a /gcc/opts.c | |
parent | bcee41ff81d1c5aee58820299fe51eaf4545f3c0 (diff) | |
download | gcc-1ebe4b4fa0b30f6ef7cb18404def5854745b5912.zip gcc-1ebe4b4fa0b30f6ef7cb18404def5854745b5912.tar.gz gcc-1ebe4b4fa0b30f6ef7cb18404def5854745b5912.tar.bz2 |
opts-common.c (handle_option, [...]): Add diagnostic_context parameter.
* opts-common.c (handle_option, handle_generated_option,
read_cmdline_option, set_option): Add diagnostic_context
parameter. Update calls among these functions.
(set_option): Don't use global_dc.
* opts.c (read_cmdline_options): Pass global_dc to
read_cmdline_option.
(decode_options): Pass global_dc to enable_warning_as_error.
(common_handle_option): Pass global_dc to enable_warning_as_error.
(enable_warning_as_error): Add diagnostic_context parameter.
Document parameters. Don't use global_dc. Pass
diagnostic_context parameter to handle_generated_option.
* opts.h (set_option, handle_option, handle_generated_option,
read_cmdline_option, enable_warning_as_error): Add
diagnostic_context parameter.
* Makefile.in (lto-opts.o): Update dependencies.
* coretypes.h (struct diagnostic_context, diagnostic_context):
Declare here.
* diagnostic.h (diagnostic_context): Don't declare typedef here.
* gcc.c (process_command): Pass global_dc to read_cmdline_option.
* langhooks-def.h (struct diagnostic_context): Don't declare here.
(lhd_print_error_function, lhd_initialize_diagnostics): Declare
using diagnostic_context typedef.
* langhooks.c (lhd_initialize_diagnostics): Declare using
diagnostic_context typedef.
* langhooks.h (struct diagnostic_context): Don't declare here.
(initialize_diagnostics, print_error_function): Declare using
diagnostic_context typedef.
* lto-opts.c: Include diagnostic.h.
(lto_reissue_options): Pass global_dc to set_option. Pass
DK_UNSPECIFIED not 0.
* plugin.c (plugins_internal_error_function): Declare using
diagnostic_context typedef.
* plugin.h (struct diagnostic_context): Don't declare here.
(plugins_internal_error_function): Declare using
diagnostic_context typedef.
c-family:
* c-common.h (struct diagnostic_context): Don't declare here.
(c_common_initialize_diagnostics): Declare using
diagnostic_context typedef.
* c-opts.c (c_common_handle_option): Pass global_dc to
handle_generated_option.
cp:
* cp-tree.h (cxx_print_error_function,
cxx_initialize_diagnostics): Declare using diagnostic_context
typedef.
From-SVN: r164991
Diffstat (limited to 'gcc/opts.c')
-rw-r--r-- | gcc/opts.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -639,7 +639,8 @@ read_cmdline_options (struct cl_decoded_option *decoded_options, } read_cmdline_option (&global_options, &global_options_set, - decoded_options + i, lang_mask, handlers); + decoded_options + i, lang_mask, handlers, + global_dc); } } @@ -879,7 +880,8 @@ decode_options (unsigned int argc, const char **argv, } /* Enable -Werror=coverage-mismatch by default */ - enable_warning_as_error ("coverage-mismatch", 1, lang_mask, &handlers); + enable_warning_as_error ("coverage-mismatch", 1, lang_mask, &handlers, + global_dc); if (first_time_p) { @@ -1606,7 +1608,7 @@ common_handle_option (struct gcc_options *opts, break; case OPT_Werror_: - enable_warning_as_error (arg, value, lang_mask, handlers); + enable_warning_as_error (arg, value, lang_mask, handlers, global_dc); break; case OPT_Wlarger_than_: @@ -2284,12 +2286,15 @@ register_warning_as_error_callback (void (*callback) (int)) warning_as_error_callback = callback; } -/* Enable a warning option as an error. This is used by -Werror= and - also by legacy Werror-implicit-function-declaration. */ +/* Enable (or disable if VALUE is 0) a warning option ARG (language + mask LANG_MASK, option handlers HANDLERS) as an error for + diagnostic context DC (possibly NULL). This is used by + -Werror=. */ void enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, - const struct cl_option_handlers *handlers) + const struct cl_option_handlers *handlers, + diagnostic_context *dc) { char *new_option; int option_index; @@ -2311,8 +2316,9 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, option_index = option->alias_target; if (option_index == OPT_SPECIAL_ignore) return; - diagnostic_classify_diagnostic (global_dc, option_index, kind, - UNKNOWN_LOCATION); + if (dc) + diagnostic_classify_diagnostic (dc, option_index, kind, + UNKNOWN_LOCATION); if (kind == DK_ERROR) { const struct cl_option * const option = cl_options + option_index; @@ -2321,7 +2327,8 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, if (option->var_type == CLVC_BOOLEAN) handle_generated_option (&global_options, &global_options_set, option_index, NULL, value, lang_mask, - (int)kind, handlers); + (int)kind, handlers, + dc); if (warning_as_error_callback) warning_as_error_callback (option_index); |