diff options
author | Joseph Myers <joseph@codesourcery.com> | 2010-10-04 12:51:00 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-10-04 12:51:00 +0100 |
commit | d4d24ba4503483a5315b57859c147f9a4e18c5aa (patch) | |
tree | 7379b08acfec7fa146c7082af3852ccc85f50fa0 /gcc/opts-common.c | |
parent | 4a2da10512e3f3480ebc6259e8b50fc2a9bce81a (diff) | |
download | gcc-d4d24ba4503483a5315b57859c147f9a4e18c5aa.zip gcc-d4d24ba4503483a5315b57859c147f9a4e18c5aa.tar.gz gcc-d4d24ba4503483a5315b57859c147f9a4e18c5aa.tar.bz2 |
optc-gen.awk: Define global_options_set.
* optc-gen.awk: Define global_options_set. Don't define
target_flags_explicit.
* opth-gen.awk: Declare global_options_set. Define
target_flags_explicit as macro.
* opts-common.c (handle_option): Take opts_set and generated_p
parameters.
(handle_generated_option, read_cmdline_option, set_option): Take
opts_set parameter.
(set_option): Use opts_set instead of hardcoding target_flags and
target_flags_explicit.
* opts.c (sel_sched_switch_set, profile_arc_flag_set,
flag_profile_values_set, flag_unroll_loops_set, flag_tracer_set,
flag_value_profile_transformations_set, flag_peel_loops_set,
flag_branch_probabilities_set, flag_inline_functions_set,
flag_ipa_cp_set, flag_ipa_cp_clone_set,
flag_predictive_commoning_set, flag_unswitch_loops_set,
flag_gcse_after_reload_set): Remove.
(common_handle_option, lang_handle_option, target_handle_option):
Take opts_set parameter. Assert that it is &global_options_set.
(common_handle_option): Don't set _set variables. Check opts_set
instead of such variables.
(enable_warning_as_error): Pass &global_options_set to
handle_generated_option.
* opts.h (cl_option_handler_func.handler, set_option,
handle_option, handle_generated_option, read_cmdline_option): Add
opts_set parameters.
(handle_option): Add generated_p parameter.
* config/i386/i386.c (ix86_function_specific_save,
ix86_function_specific_restore): Updat for renaming of
target_flags_explicit field.
* config/i386/i386.opt (target_flags_explicit): Rename to
ix86_target_flags_explicit.
* config/ia64/ia64.c (ia64_override_options_after_change): Check
global_options_set.x_flag_selective_scheduling and
global_options_set.x_flag_selective_scheduling2, not
sel_sched_switch_set.
* flags.h (sel_sched_switch_set,
flag_speculative_prefetching_set): Remove.
* gcc.c (driver_handle_option): Take opts_set parameter. Assert
that it is &global_options_set.
(process_command): Pass &global_options_set to
read_cmdline_option.
* lto-opts.c (lto_reissue_options): Pass &global_options_set to
set_option.
* toplev.c (target_flags_explicit): Remove.
c-family:
* c-opts.c (c_common_handle_option): Pass &global_options_set to
handle_generated_option.
From-SVN: r164932
Diffstat (limited to 'gcc/opts-common.c')
-rw-r--r-- | gcc/opts-common.c | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 09e5b11..5ac4fab 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -799,15 +799,20 @@ keep: } /* Handle option DECODED for the language indicated by LANG_MASK, - using the handlers in HANDLERS and setting fields in OPTS. KIND is - the diagnostic_t if this is a diagnostics option, DK_UNSPECIFIED - otherwise. Returns false if the switch was invalid. */ + using the handlers in HANDLERS and setting fields in OPTS and + OPTS_SET. KIND is the diagnostic_t if this is a diagnostics + option, DK_UNSPECIFIED otherwise. GENERATED_P is true for an + option generated as part of processing another option or otherwise + generated internally, false for one explicitly passed by the user. + Returns false if the switch was invalid. */ bool handle_option (struct gcc_options *opts, + struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask, int kind, - const struct cl_option_handlers *handlers) + const struct cl_option_handlers *handlers, + bool generated_p) { size_t opt_index = decoded->opt_index; const char *arg = decoded->arg; @@ -817,12 +822,13 @@ handle_option (struct gcc_options *opts, size_t i; if (flag_var) - set_option (opts, opt_index, value, arg, kind); + set_option (opts, (generated_p ? NULL : opts_set), + opt_index, value, arg, kind); for (i = 0; i < handlers->num_handlers; i++) if (option->flags & handlers->handlers[i].mask) { - if (!handlers->handlers[i].handler (opts, decoded, + if (!handlers->handlers[i].handler (opts, opts_set, decoded, lang_mask, kind, handlers)) return false; else @@ -839,15 +845,17 @@ handle_option (struct gcc_options *opts, command line. */ bool -handle_generated_option (struct gcc_options *opts, size_t opt_index, - const char *arg, int value, +handle_generated_option (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t opt_index, const char *arg, int value, unsigned int lang_mask, int kind, const struct cl_option_handlers *handlers) { struct cl_decoded_option decoded; generate_option (opt_index, arg, value, lang_mask, &decoded); - return handle_option (opts, &decoded, lang_mask, kind, handlers); + return handle_option (opts, opts_set, &decoded, lang_mask, kind, handlers, + true); } /* Fill in *DECODED with an option described by OPT_INDEX, ARG and @@ -906,10 +914,12 @@ generate_option_input_file (const char *file, } /* Handle the switch DECODED for the language indicated by LANG_MASK, - using the handlers in *HANDLERS and setting fields in OPTS. */ + using the handlers in *HANDLERS and setting fields in OPTS and + OPTS_SET. */ void read_cmdline_option (struct gcc_options *opts, + struct gcc_options *opts_set, struct cl_decoded_option *decoded, unsigned int lang_mask, const struct cl_option_handlers *handlers) @@ -963,33 +973,42 @@ read_cmdline_option (struct gcc_options *opts, gcc_assert (!decoded->errors); - if (!handle_option (opts, decoded, lang_mask, DK_UNSPECIFIED, handlers)) + if (!handle_option (opts, opts_set, decoded, lang_mask, DK_UNSPECIFIED, + handlers, false)) error ("unrecognized command line option %qs", opt); } -/* Set any field in OPTS for option OPT_INDEX according to VALUE and ARG, - diagnostic kind KIND. */ +/* Set any field in OPTS, and OPTS_SET if not NULL, for option + OPT_INDEX according to VALUE and ARG, diagnostic kind KIND. */ void -set_option (struct gcc_options *opts, int opt_index, int value, - const char *arg, int kind) +set_option (struct gcc_options *opts, struct gcc_options *opts_set, + int opt_index, int value, const char *arg, int kind) { const struct cl_option *option = &cl_options[opt_index]; void *flag_var = option_flag_var (opt_index, opts); + void *set_flag_var = NULL; if (!flag_var) return; + if (opts_set != NULL) + set_flag_var = option_flag_var (opt_index, opts_set); + switch (option->var_type) { case CLVC_BOOLEAN: *(int *) flag_var = value; + if (set_flag_var) + *(int *) set_flag_var = 1; break; case CLVC_EQUAL: *(int *) flag_var = (value ? option->var_value : !option->var_value); + if (set_flag_var) + *(int *) set_flag_var = 1; break; case CLVC_BIT_CLEAR: @@ -998,12 +1017,14 @@ set_option (struct gcc_options *opts, int opt_index, int value, *(int *) flag_var |= option->var_value; else *(int *) flag_var &= ~option->var_value; - if (flag_var == &target_flags) - target_flags_explicit |= option->var_value; + if (set_flag_var) + *(int *) set_flag_var |= option->var_value; break; case CLVC_STRING: *(const char **) flag_var = arg; + if (set_flag_var) + *(const char **) set_flag_var = ""; break; } |