diff options
author | Martin Liska <mliska@suse.cz> | 2019-11-12 11:09:57 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-11-12 10:09:57 +0000 |
commit | 8cc5fcaf1f04f8c7323181a53f05b34ed28a0f1a (patch) | |
tree | 87cfecfb1f2f7d58eb7d6ac38bb7c188f9feb367 /gcc | |
parent | 0c29cac4a8cc840a0a597313147a7e0df0064c54 (diff) | |
download | gcc-8cc5fcaf1f04f8c7323181a53f05b34ed28a0f1a.zip gcc-8cc5fcaf1f04f8c7323181a53f05b34ed28a0f1a.tar.gz gcc-8cc5fcaf1f04f8c7323181a53f05b34ed28a0f1a.tar.bz2 |
Remove last leftover usage of params* files.
2019-11-12 Martin Liska <mliska@suse.cz>
* common.opt: Remove param_values.
* config/i386/i386-options.c (ix86_valid_target_attribute_p):
Remove finalize_options_struct.
* gcc.c (driver::decode_argv): Do not call global_init_params
and finish_params.
(driver::finalize): Do not call params_c_finalize
and finalize_options_struct.
* opt-suggestions.c (option_proposer::get_completions): Remove
special casing of params.
(option_proposer::find_param_completions): Remove.
(test_completion_partial_match): Update expected output.
* opt-suggestions.h: Remove find_param_completions.
* opts-common.c (add_misspelling_candidates): Add
--param with a space.
* opts.c (handle_param): Remove.
(init_options_struct):. Remove init_options_struct and
similar calls.
(finalize_options_struct): Remove.
(common_handle_option): Use SET_OPTION_IF_UNSET.
* opts.h (finalize_options_struct): Remove.
* toplev.c (general_init): Do not call global_init_params.
(toplev::finalize): Do not call params_c_finalize and
finalize_options_struct.
From-SVN: r278087
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/common.opt | 3 | ||||
-rw-r--r-- | gcc/config/i386/i386-options.c | 2 | ||||
-rw-r--r-- | gcc/gcc.c | 8 | ||||
-rw-r--r-- | gcc/opt-suggestions.c | 58 | ||||
-rw-r--r-- | gcc/opt-suggestions.h | 5 | ||||
-rw-r--r-- | gcc/opts-common.c | 11 | ||||
-rw-r--r-- | gcc/opts.c | 71 | ||||
-rw-r--r-- | gcc/opts.h | 1 | ||||
-rw-r--r-- | gcc/toplev.c | 8 |
10 files changed, 53 insertions, 140 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef51776..1be218c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,31 @@ 2019-11-12 Martin Liska <mliska@suse.cz> + * common.opt: Remove param_values. + * config/i386/i386-options.c (ix86_valid_target_attribute_p): + Remove finalize_options_struct. + * gcc.c (driver::decode_argv): Do not call global_init_params + and finish_params. + (driver::finalize): Do not call params_c_finalize + and finalize_options_struct. + * opt-suggestions.c (option_proposer::get_completions): Remove + special casing of params. + (option_proposer::find_param_completions): Remove. + (test_completion_partial_match): Update expected output. + * opt-suggestions.h: Remove find_param_completions. + * opts-common.c (add_misspelling_candidates): Add + --param with a space. + * opts.c (handle_param): Remove. + (init_options_struct):. Remove init_options_struct and + similar calls. + (finalize_options_struct): Remove. + (common_handle_option): Use SET_OPTION_IF_UNSET. + * opts.h (finalize_options_struct): Remove. + * toplev.c (general_init): Do not call global_init_params. + (toplev::finalize): Do not call params_c_finalize and + finalize_options_struct. + +2019-11-12 Martin Liska <mliska@suse.cz> + * Makefile.in: Remove PARAMS_H and params.list and params.options. * params-enum.h: Remove. diff --git a/gcc/common.opt b/gcc/common.opt index 8c6acab..26b6c2c 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -63,9 +63,6 @@ int flag_complex_method = 1 Variable bool flag_warn_unused_result = false -Variable -int *param_values - ; Nonzero if we should write GIMPLE bytecode for link-time optimization. Variable int flag_generate_lto diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c index 1e3280d..c909f8e 100644 --- a/gcc/config/i386/i386-options.c +++ b/gcc/config/i386/i386-options.c @@ -1340,8 +1340,6 @@ ix86_valid_target_attribute_p (tree fndecl, DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize; } - finalize_options_struct (&func_options); - return ret; } @@ -7422,10 +7422,6 @@ driver::expand_at_files (int *argc, char ***argv) const void driver::decode_argv (int argc, const char **argv) { - /* Register the language-independent parameters. */ - global_init_params (); - finish_params (); - init_opts_obstack (); init_options_struct (&global_options, &global_options_set); @@ -10113,7 +10109,6 @@ void driver::finalize () { env.restore (); - params_c_finalize (); diagnostic_finish (global_dc); is_cpp_driver = 0; @@ -10134,9 +10129,6 @@ driver::finalize () spec_machine = DEFAULT_TARGET_MACHINE; greatest_status = 1; - finalize_options_struct (&global_options); - finalize_options_struct (&global_options_set); - obstack_free (&obstack, NULL); obstack_free (&opts_obstack, NULL); /* in opts.c */ obstack_free (&collect_obstack, NULL); diff --git a/gcc/opt-suggestions.c b/gcc/opt-suggestions.c index 609e60b..01ce331 100644 --- a/gcc/opt-suggestions.c +++ b/gcc/opt-suggestions.c @@ -64,32 +64,17 @@ option_proposer::get_completions (const char *option_prefix, size_t length = strlen (option_prefix); - /* Handle OPTION_PREFIX starting with "-param". */ - const char *prefix = "-param"; - if (length >= strlen (prefix) - && strstr (option_prefix, prefix) == option_prefix) - { - /* We support both '-param-xyz=123' and '-param xyz=123' */ - option_prefix += strlen (prefix); - char separator = option_prefix[0]; - option_prefix++; - if (separator == ' ' || separator == '=') - find_param_completions (separator, option_prefix, results); - } - else - { - /* Lazily populate m_option_suggestions. */ - if (!m_option_suggestions) - build_option_suggestions (option_prefix); - gcc_assert (m_option_suggestions); + /* Lazily populate m_option_suggestions. */ + if (!m_option_suggestions) + build_option_suggestions (option_prefix); + gcc_assert (m_option_suggestions); - for (unsigned i = 0; i < m_option_suggestions->length (); i++) - { - char *candidate = (*m_option_suggestions)[i]; - if (strlen (candidate) >= length - && strstr (candidate, option_prefix) == candidate) - results.safe_push (concat ("-", candidate, NULL)); - } + for (unsigned i = 0; i < m_option_suggestions->length (); i++) + { + char *candidate = (*m_option_suggestions)[i]; + if (strlen (candidate) >= length + && strstr (candidate, option_prefix) == candidate) + results.safe_push (concat ("-", candidate, NULL)); } } @@ -212,25 +197,6 @@ option_proposer::build_option_suggestions (const char *prefix) } } -/* Find parameter completions for --param format with SEPARATOR. - Again, save the completions into results. */ - -void -option_proposer::find_param_completions (const char separator, - const char *param_prefix, - auto_string_vec &results) -{ - char separator_str[] = {separator, '\0'}; - size_t length = strlen (param_prefix); - for (unsigned i = 0; i < get_num_compiler_params (); ++i) - { - const char *candidate = compiler_params[i].option; - if (strlen (candidate) >= length - && strstr (candidate, param_prefix) == candidate) - results.safe_push (concat ("--param", separator_str, candidate, NULL)); - } -} - #if CHECKING_P namespace selftest { @@ -400,9 +366,9 @@ test_completion_partial_match (option_proposer &proposer) ASSERT_TRUE (in_completion_p (proposer, "-fipa-icf", "-fipa-icf-functions")); ASSERT_TRUE (in_completion_p (proposer, "-fipa-icf", "-fipa-icf")); ASSERT_TRUE (in_completion_p (proposer, "--param=", - "--param=max-vartrack-reverse-op-size")); + "--param=max-vartrack-reverse-op-size=")); ASSERT_TRUE (in_completion_p (proposer, "--param ", - "--param max-vartrack-reverse-op-size")); + "--param max-vartrack-reverse-op-size=")); ASSERT_FALSE (in_completion_p (proposer, "-fipa-icf", "-fipa")); ASSERT_FALSE (in_completion_p (proposer, "-fipa-icf-functions", "-fipa-icf")); diff --git a/gcc/opt-suggestions.h b/gcc/opt-suggestions.h index 8d24833..93f65be 100644 --- a/gcc/opt-suggestions.h +++ b/gcc/opt-suggestions.h @@ -63,11 +63,6 @@ private: it's set to NULL. */ void build_option_suggestions (const char *prefix); - /* Find parameter completions for --param format with SEPARATOR. - Again, save the completions into results. */ - void find_param_completions (const char separator, const char *param_prefix, - auto_string_vec &results); - private: /* Cache with all suggestions. */ auto_string_vec *m_option_suggestions; diff --git a/gcc/opts-common.c b/gcc/opts-common.c index d55dc93..51e08d4 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -510,6 +510,17 @@ add_misspelling_candidates (auto_vec<char *> *candidates, candidates->safe_push (alternative); } } + + /* For all params (e.g. --param=key=value), + include also '--param key=value'. */ + const char *prefix = "--param="; + if (strstr (opt_text, prefix) == opt_text) + { + char *param = xstrdup (opt_text + 1); + gcc_assert (param[6] == '='); + param[6] = ' '; + candidates->safe_push (param); + } } /* Decode the switch beginning at ARGV for the language indicated by @@ -188,9 +188,6 @@ static const char use_diagnosed_msg[] = N_("Uses of this option are diagnosed.") typedef char *char_p; /* For DEF_VEC_P. */ -static void handle_param (struct gcc_options *opts, - struct gcc_options *opts_set, location_t loc, - const char *carg); static void set_debug_level (enum debug_info_type type, int extended, const char *arg, struct gcc_options *opts, struct gcc_options *opts_set, @@ -283,8 +280,6 @@ init_opts_obstack (void) void init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set) { - size_t num_params = get_num_compiler_params (); - /* Ensure that opts_obstack has already been initialized by the time that we initialize any gcc_options instances (PR jit/68446). */ gcc_assert (opts_obstack.chunk_size > 0); @@ -294,13 +289,6 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set) if (opts_set) memset (opts_set, 0, sizeof (*opts_set)); - opts->x_param_values = XNEWVEC (int, num_params); - - if (opts_set) - opts_set->x_param_values = XCNEWVEC (int, num_params); - - init_param_values (opts->x_param_values); - /* Initialize whether `char' is signed. */ opts->x_flag_signed_char = DEFAULT_SIGNED_CHAR; /* Set this to a special "uninitialized" value. The actual default @@ -318,14 +306,6 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set) targetm_common.option_init_struct (opts); } -/* Release any allocations owned by OPTS. */ - -void -finalize_options_struct (struct gcc_options *opts) -{ - XDELETEVEC (opts->x_param_values); -} - /* If indicated by the optimization level LEVEL (-Os if SIZE is set, -Ofast if FAST is set, -Og if DEBUG is set), apply the option DEFAULT_OPT to OPTS and OPTS_SET, diagnostic context DC, location LOC, with language @@ -2465,10 +2445,10 @@ common_handle_option (struct gcc_options *opts, break; case OPT_finline_limit_: - set_param_value ("max-inline-insns-single", value / 2, - opts->x_param_values, opts_set->x_param_values); - set_param_value ("max-inline-insns-auto", value / 2, - opts->x_param_values, opts_set->x_param_values); + SET_OPTION_IF_UNSET (opts, opts_set, param_max_inline_insns_single, + value / 2); + SET_OPTION_IF_UNSET (opts, opts_set, param_max_inline_insns_auto, + value / 2); break; case OPT_finstrument_functions_exclude_function_list_: @@ -2836,49 +2816,6 @@ common_handle_option (struct gcc_options *opts, return true; } -/* Handle --param NAME=VALUE. */ -static void -handle_param (struct gcc_options *opts, struct gcc_options *opts_set, - location_t loc, const char *carg) -{ - char *equal, *arg; - int value; - - arg = xstrdup (carg); - equal = strchr (arg, '='); - if (!equal) - error_at (loc, "%s: %qs arguments should be of the form NAME=VALUE", - arg, "--param"); - else - { - *equal = '\0'; - - enum compiler_param index; - if (!find_param (arg, &index)) - { - const char *suggestion = find_param_fuzzy (arg); - if (suggestion) - error_at (loc, "invalid %qs name %qs; did you mean %qs?", - "--param", arg, suggestion); - else - error_at (loc, "invalid %qs name %qs", "--param", arg); - } - else - { - if (!param_string_value_p (index, equal + 1, &value)) - value = integral_argument (equal + 1); - - if (value == -1) - error_at (loc, "invalid %qs value %qs", "--param", equal + 1); - else - set_param_value (arg, value, - opts->x_param_values, opts_set->x_param_values); - } - } - - free (arg); -} - /* Used to set the level of strict aliasing warnings in OPTS, when no level is specified (i.e., when -Wstrict-aliasing, and not -Wstrict-aliasing=level was given). @@ -345,7 +345,6 @@ extern void init_options_once (void); extern void init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set); extern void init_opts_obstack (void); -extern void finalize_options_struct (struct gcc_options *opts); extern void decode_cmdline_options_to_array_default_mask (unsigned int argc, const char **argv, struct cl_decoded_option **decoded_options, diff --git a/gcc/toplev.c b/gcc/toplev.c index 513e4e0..d4583ba 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1240,9 +1240,6 @@ general_init (const char *argv0, bool init_signals) /* Initialize register usage now so switches may override. */ init_reg_sets (); - /* Register the language-independent parameters. */ - global_init_params (); - /* This must be done after global_init_params but before argument processing. */ init_ggc_heuristics (); @@ -1262,7 +1259,6 @@ general_init (const char *argv0, bool init_signals) statistics_early_init (); debuginfo_early_init (); - finish_params (); } /* Return true if the current target supports -fsection-anchors. */ @@ -2468,10 +2464,6 @@ toplev::finalize (void) gcse_c_finalize (); ipa_cp_c_finalize (); ira_costs_c_finalize (); - params_c_finalize (); - - finalize_options_struct (&global_options); - finalize_options_struct (&global_options_set); /* save_decoded_options uses opts_obstack, so these must be cleaned up together. */ |