public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/rguenth/heads/slp-reorg)] driver: Improve the generated help text for alias options
@ 2020-03-25 14:19 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2020-03-25 14:19 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:d326e9586b405adf7da766b54aa4dbd382d98c2a
commit d326e9586b405adf7da766b54aa4dbd382d98c2a
Author: Lewis Hyatt <lhyatt@gmail.com>
Date: Mon Mar 23 14:37:02 2020 -0400
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.
Diff:
---
gcc/ChangeLog | 4 ++++
gcc/opts.c | 29 +++++++++++++++++++++++------
2 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 852773d2f5f..4509447caa3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+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>
Andre Vieira <andre.simoesdiasvieira@arm.com>
Mihail Ionescu <mihail.ionescu@arm.com>
diff --git a/gcc/opts.c b/gcc/opts.c
index ac160ed8404..5dc7d65dedd 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1315,14 +1315,31 @@ print_filtered_help (unsigned int include_flags,
if (option->alias_target < N_OPTS
&& cl_options [option->alias_target].help)
{
+ const struct cl_option *target = cl_options + option->alias_target;
if (option->help == NULL)
{
- /* For undocumented options that are aliases for other options
- that are documented, point the reader to the other option in
- preference of the former. */
- snprintf (new_help, sizeof new_help,
- _("Same as %s. Use the latter option instead."),
- cl_options [option->alias_target].opt_text);
+ /* The option is undocumented but is an alias for an option that
+ is documented. If the option has alias arguments, then its
+ purpose is to provide certain arguments to the other option, so
+ inform the reader of this. Otherwise, point the reader to the
+ other option in preference to the former. */
+
+ 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
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-25 14:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 14:19 [gcc(refs/users/rguenth/heads/slp-reorg)] driver: Improve the generated help text for alias options Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).