From 5f0f4a3bc5e8f25e586b6983d6c8138a89aa030e Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 26 May 2010 14:40:53 +0100 Subject: diagnostic.c: Don't include opts.h. * diagnostic.c: Don't include opts.h. (permissive_error_option): Define. (diagnostic_initialize): Take n_opts parameter. Allocate memory for classify_diagnostic. Don't use memset for classify_diagnostic. Initialize new and recently added fields. (diagnostic_classify_diagnostic): Use context->n_opts instead of N_OPTS. (diagnostic_report_diagnostic): Pass context parameter to diagnostic_report_warnings_p. Use option_enabled and option_name hooks from context. (emit_diagnostic): Use permissive_error_option. (permerror): Likewise. * diagnostic.h: Don't include options.h. (struct diagnostic_context): Add n_opts, opt_permissive, inhibit_warnings, warn_system_headers, option_enabled and option_name fields. Change classify_diagnostic to a pointer. * opts-diagnostic.h: New file. * opts.c: Include opts-diagnostic.h. (common_handle_option): Set global_dc fields for -Wfatal-errors, -Wsystem-headers, -fshow-column, -pedantic-errors and -w. (option_name): New function. * c-opts.c (c_common_init_options): Set global_dc->opt_permissive. (c_common_handle_option): Set global_dc->permissive for -fpermissive. * c-common.c (c_cpp_error): Save and restore global_dc->warn_system_headers, not variable warn_system_headers. * toplev.c: Include opts-diagnostic.h. (general_init): Update call to diagnostic_initialize. Set global_dc->show_column, global_dc->option_enabled and global_dc->option_name. (process_options): Don't set global_dc fields here. * Makefile.in (DIAGNOSTIC_H): Remove options.h. (diagnostic.o, opts.o, toplev.o): Update dependencies. fortran: * cpp.c (cb_cpp_error): Save and restore global_dc->warn_system_headers, not variable warn_system_headers. From-SVN: r159869 --- gcc/toplev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'gcc/toplev.c') diff --git a/gcc/toplev.c b/gcc/toplev.c index aa3eff3..83008da 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -78,6 +78,7 @@ along with GCC; see the file COPYING3. If not see #include "hosthooks.h" #include "cgraph.h" #include "opts.h" +#include "opts-diagnostic.h" #include "coverage.h" #include "value-prof.h" #include "alloc-pool.h" @@ -1691,13 +1692,16 @@ general_init (const char *argv0) /* Initialize the diagnostics reporting machinery, so option parsing can give warnings and errors. */ - diagnostic_initialize (global_dc); + diagnostic_initialize (global_dc, N_OPTS); diagnostic_starter (global_dc) = default_tree_diagnostic_starter; /* Set a default printer. Language specific initializations will override it later. */ pp_format_decoder (global_dc->printer) = &default_tree_printer; global_dc->show_option_requested = flag_diagnostics_show_option; + global_dc->show_column = flag_show_column; global_dc->internal_error = plugins_internal_error_function; + global_dc->option_enabled = option_enabled; + global_dc->option_name = option_name; /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */ #ifdef SIGSEGV @@ -1828,11 +1832,6 @@ process_options (void) if (flag_compare_debug) diagnostic_inhibit_notes (global_dc); - global_dc->show_column = flag_show_column; - global_dc->pedantic_errors = flag_pedantic_errors; - global_dc->permissive = flag_permissive; - global_dc->fatal_errors = flag_fatal_errors; - if (flag_section_anchors && !target_supports_section_anchors_p ()) { warning (OPT_fsection_anchors, -- cgit v1.1