Commit d326e958 by Lewis Hyatt

driver: Improve the generated help text for alias options

gcc/ChangeLog:

2020-03-23  Lewis Hyatt  <lhyatt@gmail.com>

	* opts.c (print_filtered_help): Improve the help text for alias options.
parent 88c9a831
2020-03-23 Lewis Hyatt <lhyatt@gmail.com>
* opts.c (print_filtered_help): Improve the help text for alias options.
2020-03-23 Srinath Parvathaneni <srinath.parvathaneni@arm.com> 2020-03-23 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
Andre Vieira <andre.simoesdiasvieira@arm.com> Andre Vieira <andre.simoesdiasvieira@arm.com>
Mihail Ionescu <mihail.ionescu@arm.com> Mihail Ionescu <mihail.ionescu@arm.com>
......
...@@ -1315,14 +1315,31 @@ print_filtered_help (unsigned int include_flags, ...@@ -1315,14 +1315,31 @@ print_filtered_help (unsigned int include_flags,
if (option->alias_target < N_OPTS if (option->alias_target < N_OPTS
&& cl_options [option->alias_target].help) && cl_options [option->alias_target].help)
{ {
const struct cl_option *target = cl_options + option->alias_target;
if (option->help == NULL) if (option->help == NULL)
{ {
/* For undocumented options that are aliases for other options /* The option is undocumented but is an alias for an option that
that are documented, point the reader to the other option in is documented. If the option has alias arguments, then its
preference of the former. */ purpose is to provide certain arguments to the other option, so
snprintf (new_help, sizeof new_help, inform the reader of this. Otherwise, point the reader to the
_("Same as %s. Use the latter option instead."), other option in preference to the former. */
cl_options [option->alias_target].opt_text);
if (option->alias_arg)
{
if (option->neg_alias_arg)
snprintf (new_help, sizeof new_help,
_("Same as %s%s (or, in negated form, %s%s)."),
target->opt_text, option->alias_arg,
target->opt_text, option->neg_alias_arg);
else
snprintf (new_help, sizeof new_help,
_("Same as %s%s."),
target->opt_text, option->alias_arg);
}
else
snprintf (new_help, sizeof new_help,
_("Same as %s."),
target->opt_text);
} }
else else
{ {
......
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