Message ID | 561E8DF1.7070909@gmail.com |
---|---|
State | New |
Headers | show |
On Wed, 14 Oct 2015, Martin Sebor wrote: > + /* For undocumented options that are aliases for other > + options that are documented, print the other option's > + help and name. */ > + help = cl_options [option->alias_target].help; > + > + snprintf (new_help, sizeof new_help, "%s", help); > + snprintf (new_help + strlen (new_help), > + sizeof new_help - strlen (new_help), > + ". Same as %s", > + cl_options [option->alias_target].opt_text); Obviously this English string needs to be marked for translation. There is no consistency about whether option descriptions in .opt files end with ".", so this might produce ".. Same as" in some cases. While I think the .opt files should be made consistent, I also think it would be better just to give the "Same as" message without also repeating the description of the canonical option.
diff --git a/gcc/opts.c b/gcc/opts.c index 2bbf653..e441924 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1010,7 +1010,7 @@ print_filtered_help (unsigned int include_flags, const char *help; bool found = false; bool displayed = false; - char new_help[128]; + char new_help[256]; if (include_flags == CL_PARAMS) { @@ -1086,6 +1086,23 @@ print_filtered_help (unsigned int include_flags, { if (exclude_flags & CL_UNDOCUMENTED) continue; + + if (option->alias_target < N_OPTS + && cl_options [option->alias_target].help) + { + /* For undocumented options that are aliases for other + options that are documented, print the other option's + help and name. */ + help = cl_options [option->alias_target].help; + + snprintf (new_help, sizeof new_help, "%s", help); + snprintf (new_help + strlen (new_help), + sizeof new_help - strlen (new_help), + ". Same as %s", + cl_options [option->alias_target].opt_text); + help = new_help; + } + else help = undocumented_msg; }