Commit 76c26af9 by Martin Liska Committed by Martin Liska

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
parent 62aee289
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> 2019-11-12 Maciej W. Rozycki <macro@codesourcery.com>
Frederik Harwath <frederik@codesourcery.com> Frederik Harwath <frederik@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com> Thomas Schwinge <thomas@codesourcery.com>
...@@ -437,13 +437,6 @@ Common Driver Alias(-target-help) ...@@ -437,13 +437,6 @@ Common Driver Alias(-target-help)
fversion fversion
Common Driver Alias(-version) 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 -sysroot
Driver Separate Alias(-sysroot=) Driver Separate Alias(-sysroot=)
......
...@@ -475,6 +475,9 @@ affect executable code generation may use this flag instead, so that the ...@@ -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 option is not taken into account in ways that might affect executable
code generation. code generation.
@item Param
This is an option that is a parameter.
@item Undocumented @item Undocumented
The option is deliberately missing documentation and should not The option is deliberately missing documentation and should not
be included in the @option{--help} output. be included in the @option{--help} output.
......
...@@ -105,7 +105,8 @@ function switch_flags (flags) ...@@ -105,7 +105,8 @@ function switch_flags (flags)
test_flag("Undocumented", flags, " | CL_UNDOCUMENTED") \ test_flag("Undocumented", flags, " | CL_UNDOCUMENTED") \
test_flag("NoDWARFRecord", flags, " | CL_NO_DWARF_RECORD") \ test_flag("NoDWARFRecord", flags, " | CL_NO_DWARF_RECORD") \
test_flag("Warning", flags, " | CL_WARNING") \ 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 ) sub( "^0 \\| ", "", result )
return result return result
} }
......
...@@ -961,6 +961,15 @@ decode_cmdline_options_to_array (unsigned int argc, const char **argv, ...@@ -961,6 +961,15 @@ decode_cmdline_options_to_array (unsigned int argc, const char **argv,
continue; 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, n = decode_cmdline_option (argv + i, lang_mask,
&opt_array[num_decoded_options]); &opt_array[num_decoded_options]);
num_decoded_options++; num_decoded_options++;
......
...@@ -1278,38 +1278,6 @@ print_filtered_help (unsigned int include_flags, ...@@ -1278,38 +1278,6 @@ print_filtered_help (unsigned int include_flags,
bool displayed = false; bool displayed = false;
char new_help[256]; 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) if (!opts->x_help_printed)
opts->x_help_printed = XCNEWVAR (char, cl_options_count); opts->x_help_printed = XCNEWVAR (char, cl_options_count);
...@@ -1679,7 +1647,7 @@ print_specific_help (unsigned int include_flags, ...@@ -1679,7 +1647,7 @@ print_specific_help (unsigned int include_flags,
description = _("The following options are language-independent"); description = _("The following options are language-independent");
break; break;
case CL_PARAMS: case CL_PARAMS:
description = _("The --param option recognizes the following as parameters"); description = _("The following options control parameters");
break; break;
default: default:
if (i >= cl_lang_count) if (i >= cl_lang_count)
...@@ -2241,10 +2209,6 @@ common_handle_option (struct gcc_options *opts, ...@@ -2241,10 +2209,6 @@ common_handle_option (struct gcc_options *opts,
switch (code) switch (code)
{ {
case OPT__param:
handle_param (opts, opts_set, loc, arg);
break;
case OPT__help: case OPT__help:
{ {
unsigned int all_langs_mask = (1U << cl_lang_count) - 1; unsigned int all_langs_mask = (1U << cl_lang_count) - 1;
......
...@@ -461,4 +461,14 @@ extern bool parse_and_check_align_values (const char *flag, ...@@ -461,4 +461,14 @@ extern bool parse_and_check_align_values (const char *flag,
bool report_error, bool report_error,
location_t loc); 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 #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment