diff options
author | Martin Liska <mliska@suse.cz> | 2019-11-12 11:07:37 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-11-12 10:07:37 +0000 |
commit | 76c26af90ea3af7487e701e451a4591a81727e8a (patch) | |
tree | f06db17114922ff30c4c817dbb00a5852f3b043e | |
parent | 62aee289e4791fd68aace01accf433fb26b3eeae (diff) | |
download | gcc-76c26af90ea3af7487e701e451a4591a81727e8a.zip gcc-76c26af90ea3af7487e701e451a4591a81727e8a.tar.gz gcc-76c26af90ea3af7487e701e451a4591a81727e8a.tar.bz2 |
Param to options conversion.
2019-11-12 Martin Liska <mliska@suse.cz>
* common.opt: Remove --param and --param= options.
* opt-functions.awk: Mark CL_PARAMS for options
that have Param keyword.
* opts-common.c (decode_cmdline_options_to_array):
Replace --param key=value with --param=key=value.
* opts.c (print_filtered_help): Remove special
printing of params.
(print_specific_help): Update title for params.
(common_handle_option): Do not handle OPT__param.
opts.h (SET_OPTION_IF_UNSET): New macro.
* doc/options.texi: Document Param keyword.
From-SVN: r278083
-rw-r--r-- | gcc/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/common.opt | 7 | ||||
-rw-r--r-- | gcc/doc/options.texi | 3 | ||||
-rw-r--r-- | gcc/opt-functions.awk | 3 | ||||
-rw-r--r-- | gcc/opts-common.c | 9 | ||||
-rw-r--r-- | gcc/opts.c | 38 | ||||
-rw-r--r-- | gcc/opts.h | 10 |
7 files changed, 39 insertions, 45 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 008e0db..a1a3c8b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2019-11-12 Martin Liska <mliska@suse.cz> + + * common.opt: Remove --param and --param= options. + * opt-functions.awk: Mark CL_PARAMS for options + that have Param keyword. + * opts-common.c (decode_cmdline_options_to_array): + Replace --param key=value with --param=key=value. + * opts.c (print_filtered_help): Remove special + printing of params. + (print_specific_help): Update title for params. + (common_handle_option): Do not handle OPT__param. + opts.h (SET_OPTION_IF_UNSET): New macro. + * doc/options.texi: Document Param keyword. + 2019-11-12 Maciej W. Rozycki <macro@codesourcery.com> Frederik Harwath <frederik@codesourcery.com> Thomas Schwinge <thomas@codesourcery.com> diff --git a/gcc/common.opt b/gcc/common.opt index 12c0083..8c6acab 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -437,13 +437,6 @@ Common Driver Alias(-target-help) fversion Common Driver Alias(-version) --param -Common Separate ---param <param>=<value> Set parameter <param> to value. See below for a complete list of parameters. - --param= -Common Joined Alias(-param) - -sysroot Driver Separate Alias(-sysroot=) diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi index b59f4d3..c7c70ac 100644 --- a/gcc/doc/options.texi +++ b/gcc/doc/options.texi @@ -475,6 +475,9 @@ affect executable code generation may use this flag instead, so that the option is not taken into account in ways that might affect executable code generation. +@item Param +This is an option that is a parameter. + @item Undocumented The option is deliberately missing documentation and should not be included in the @option{--help} output. diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index c1da80c..4f02b74 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -105,7 +105,8 @@ function switch_flags (flags) test_flag("Undocumented", flags, " | CL_UNDOCUMENTED") \ test_flag("NoDWARFRecord", flags, " | CL_NO_DWARF_RECORD") \ test_flag("Warning", flags, " | CL_WARNING") \ - test_flag("(Optimization|PerFunction)", flags, " | CL_OPTIMIZATION") + test_flag("(Optimization|PerFunction)", flags, " | CL_OPTIMIZATION") \ + test_flag("Param", flags, " | CL_PARAMS") sub( "^0 \\| ", "", result ) return result } diff --git a/gcc/opts-common.c b/gcc/opts-common.c index b4ec1bd..d55dc93 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -961,6 +961,15 @@ decode_cmdline_options_to_array (unsigned int argc, const char **argv, continue; } + /* Interpret "--param" "key=name" as "--param=key=name". */ + const char *needle = "--param"; + if (i + 1 < argc && strcmp (opt, needle) == 0) + { + const char *replacement + = opts_concat (needle, "=", argv[i + 1], NULL); + argv[++i] = replacement; + } + n = decode_cmdline_option (argv + i, lang_mask, &opt_array[num_decoded_options]); num_decoded_options++; @@ -1278,38 +1278,6 @@ print_filtered_help (unsigned int include_flags, bool displayed = false; char new_help[256]; - if (include_flags == CL_PARAMS) - { - for (i = 0; i < LAST_PARAM; i++) - { - const char *param = compiler_params[i].option; - - help = compiler_params[i].help; - if (help == NULL || *help == '\0') - { - if (exclude_flags & CL_UNDOCUMENTED) - continue; - help = undocumented_msg; - } - - /* Get the translation. */ - help = _(help); - - if (!opts->x_quiet_flag) - { - snprintf (new_help, sizeof (new_help), - _("default %d minimum %d maximum %d"), - compiler_params[i].default_value, - compiler_params[i].min_value, - compiler_params[i].max_value); - help = new_help; - } - wrap_help (help, param, strlen (param), columns); - } - putchar ('\n'); - return; - } - if (!opts->x_help_printed) opts->x_help_printed = XCNEWVAR (char, cl_options_count); @@ -1679,7 +1647,7 @@ print_specific_help (unsigned int include_flags, description = _("The following options are language-independent"); break; case CL_PARAMS: - description = _("The --param option recognizes the following as parameters"); + description = _("The following options control parameters"); break; default: if (i >= cl_lang_count) @@ -2241,10 +2209,6 @@ common_handle_option (struct gcc_options *opts, switch (code) { - case OPT__param: - handle_param (opts, opts_set, loc, arg); - break; - case OPT__help: { unsigned int all_langs_mask = (1U << cl_lang_count) - 1; @@ -461,4 +461,14 @@ extern bool parse_and_check_align_values (const char *flag, bool report_error, location_t loc); +/* Set OPTION in OPTS to VALUE if the option is not set in OPTS_SET. */ + +#define SET_OPTION_IF_UNSET(OPTS, OPTS_SET, OPTION, VALUE) \ + do \ + { \ + if (!(OPTS_SET)->x_ ## OPTION) \ + (OPTS)->x_ ## OPTION = VALUE; \ + } \ + while (false) + #endif |