Commit 0631b69f by Ralf Wildenhues Committed by Ralf Wildenhues

re PR middle-end/37805 (gcc --help=separate)

gcc/
	PR middle-end/37805
	* opts.c (print_specific_help): In addition to `undocumented',
	accept `separate' and `joined' flags if passed alone.  Describe
	output by the first matched one of those.
	(common_handle_option): Skip over empty strings.
	* gcc.c (display_help): Fix help string for `--help='.
	* doc/invoke.texi (Option Summary, Overall Options): With
	`--help=', classes and qualifiers can both be repeated, but
	only the latter can be negated.  One should not pass only
	negated qualifiers.  Fix markup and examples.

From-SVN: r144921
parent 66811228
2009-03-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR middle-end/37805
* opts.c (print_specific_help): In addition to `undocumented',
accept `separate' and `joined' flags if passed alone. Describe
output by the first matched one of those.
(common_handle_option): Skip over empty strings.
* gcc.c (display_help): Fix help string for `--help='.
* doc/invoke.texi (Option Summary, Overall Options): With
`--help=', classes and qualifiers can both be repeated, but
only the latter can be negated. One should not pass only
negated qualifiers. Fix markup and examples.
Revert
2008-10-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/37805
......
......@@ -163,7 +163,7 @@ in the following sections.
@item Overall Options
@xref{Overall Options,,Options Controlling the Kind of Output}.
@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol
-x @var{language} -v -### --help@r{[}=@var{class}@r{]} --target-help @gol
-x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
--version -wrapper@@@var{file}}
@item C Language Options
......@@ -1161,11 +1161,10 @@ Print (on the standard output) a description of target-specific command
line options for each tool. For some targets extra target-specific
information may also be printed.
@item --help=@var{class}@r{[},@var{qualifier}@r{]}
@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
Print (on the standard output) a description of the command line
options understood by the compiler that fit into a specific class.
The class can be one of @samp{optimizers}, @samp{warnings}, @samp{target},
@samp{params}, or @var{language}:
options understood by the compiler that fit into all specified classes
and qualifiers. These are the supported classes:
@table @asis
@item @samp{optimizers}
......@@ -1195,9 +1194,7 @@ version of GCC.
This will display the options that are common to all languages.
@end table
It is possible to further refine the output of the @option{--help=}
option by adding a comma separated list of qualifiers after the
class. These can be any from the following list:
These are the supported qualifiers:
@table @asis
@item @samp{undocumented}
......@@ -1221,7 +1218,7 @@ switches supported by the compiler the following can be used:
@end smallexample
The sense of a qualifier can be inverted by prefixing it with the
@var{^} character, so for example to display all binary warning
@samp{^} character, so for example to display all binary warning
options (i.e., ones that are either on or off and that do not take an
argument), which have a description the following can be used:
......@@ -1229,7 +1226,10 @@ argument), which have a description the following can be used:
--help=warnings,^joined,^undocumented
@end smallexample
A class can also be used as a qualifier, although this usually
The argument to @option{--help=} should not consist solely of inverted
qualifiers.
Combining several classes is possible, although this usually
restricts the output by so much that there is nothing to display. One
case where it does work however is when one of the classes is
@var{target}. So for example to display all the target-specific
......@@ -1265,7 +1265,7 @@ options, so for example it is possible to find out which optimizations
are enabled at @option{-O2} by using:
@smallexample
-O2 --help=optimizers
-Q -O2 --help=optimizers
@end smallexample
Alternatively you can discover which binary optimizations are enabled
......
......@@ -3228,7 +3228,7 @@ display_help (void)
fputs (_(" -pass-exit-codes Exit with highest error code from a phase\n"), stdout);
fputs (_(" --help Display this information\n"), stdout);
fputs (_(" --target-help Display target specific command line options\n"), stdout);
fputs (_(" --help={target|optimizers|warnings|undocumented|params}[,{[^]joined|[^]separate}]\n"), stdout);
fputs (_(" --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...]\n"), stdout);
fputs (_(" Display specific types of command line options\n"), stdout);
if (! verbose_flag)
fputs (_(" (Use '-v --help' to display command line options of sub-processes)\n"), stdout);
......
......@@ -1396,7 +1396,7 @@ print_specific_help (unsigned int include_flags,
default:
if (i >= cl_lang_count)
break;
if ((exclude_flags & ((1U << cl_lang_count) - 1)) != 0)
if (exclude_flags & all_langs_mask)
description = _("The following options are specific to just the language ");
else
description = _("The following options are supported by the language ");
......@@ -1409,8 +1409,12 @@ print_specific_help (unsigned int include_flags,
{
if (any_flags == 0)
{
if (include_flags == CL_UNDOCUMENTED)
if (include_flags & CL_UNDOCUMENTED)
description = _("The following options are not documented");
else if (include_flags & CL_SEPARATE)
description = _("The following options take separate arguments");
else if (include_flags & CL_JOINED)
description = _("The following options take joined arguments");
else
{
internal_error ("unrecognized include_flags 0x%x passed to print_specific_help",
......@@ -1539,6 +1543,11 @@ common_handle_option (size_t scode, const char *arg, int value,
len = strlen (a);
else
len = comma - a;
if (len == 0)
{
a = comma + 1;
continue;
}
/* Check to see if the string matches an option class name. */
for (i = 0, specific_flag = 0; specifics[i].string != NULL; i++)
......@@ -1547,7 +1556,7 @@ common_handle_option (size_t scode, const char *arg, int value,
specific_flag = specifics[i].flag;
break;
}
/* Check to see if the string matches a language name.
Note - we rely upon the alpha-sorted nature of the entries in
the lang_names array, specifically that shorter names appear
......
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