Commit c662432e by Nick Clifton Committed by Nick Clifton

invoke.texi (Overall Options): Document --help=.

* doc/invoke.texi (Overall Options): Document --help=.                                                        
* gcc.c (target_help_flag): Rename to print_subprocess_flag.                                                  
  (cc1_options): Pass --help= on to cc1.                                                                      
  (display_help): Add description of --help=.                                                                 
  (process_command): Add code to handle --help=.  Allow translated                                            
  --help and --target-help switches to be passed on to compiler sub-process.                                                                                               
  (main): Remove unused if statement.                                                                         
* opts.c (columns): Remove.                                                                                   
  (LEFT_COLUMN): Define.                                                                                      
  (wrap_help): Add columns argument.                                                                          
  (print_filtered_help): Change parameters to be an include bitmask,                                          
  an exclude bitmask, an any bitmask and the column width.  Move the                                          
  code to display the params list here.  Add code to display the                                              
  status of options rather than their descriptions if the quiet flag                                          
  is not active.                                                                                              
  (print_specific_help): Change parameters to be an include bitmask,                                          
  an exclude bitmask and an any bitmask.  Move code to look up the                                            
  column width here.  Decide upon the title for an options listing.                                           
  (common_handle_options): Add code to handle --help=.  Adapt code                                            
  for --help and --target-help to use the revised form of the                                                 
  print_specific_help function.                                                                               
  (print_help): Delete.                                                                                       
  (print_param_help): Delete.                                                                                 
  (print_switch): Delete.                                                                                     
* opts.h (cl_lang_count): Add prototype.                                                                      
 (CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_MIN_OPTION_CLASS, CL_MAX_OPTION_CLASS): New defines.            
* optc-gen.awk: Add construction of cl_lang_count.                                                            
* c.opt: Add Warning attribute to warning options and Optimization attribute to optimization options.         
* common.opt: Likewise.                                                                                       
  Add --help=.                                                                                                
  Add -fhelp and -ftarget-help as aliases for the transformed --help and --target-help options.               
* opt-functions.awk: Add code to handle Warning and Optimization attributes.

From-SVN: r121849
parent dfcbeaa5
2007-02-12 Nick Clifton <nickc@redhat.com>
* doc/invoke.texi (Overall Options): Document --help=.
* gcc.c (target_help_flag): Rename to print_subprocess_flag.
(cc1_options): Pass --help= on to cc1.
(display_help): Add description of --help=.
(process_command): Add code to handle --help=. Allow translated
--help and --target-help switches to be passed on to compiler
sub-process.
(main): Remove unused if statement.
* opts.c (columns): Remove.
(LEFT_COLUMN): Define.
(wrap_help): Add columns argument.
(print_filtered_help): Change parameters to be an include bitmask,
an exclude bitmask, an any bitmask and the column width. Move the
code to display the params list here. Add code to display the
status of options rather than their descriptions if the quiet flag
is not active.
(print_specific_help): Change parameters to be an include bitmask,
an exclude bitmask and an any bitmask. Move code to look up the
column width here. Decide upon the title for an options listing.
(common_handle_options): Add code to handle --help=. Adapt code
for --help and --target-help to use the revised form of the
print_specific_help function.
(print_help): Delete.
(print_param_help): Delete.
(print_switch): Delete.
* opts.h (cl_lang_count): Add prototype.
(CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_MIN_OPTION_CLASS,
CL_MAX_OPTION_CLASS): New defines.
* optc-gen.awk: Add construction of cl_lang_count.
* c.opt: Add Warning attribute to warning options and Optimization
attribute to optimization options.
* common.opt: Likewise.
Add --help=.
Add -fhelp and -ftarget-help as aliases for the transformed --help
and --target-help options.
* opt-functions.awk: Add code to handle Warning and Optimization
attributes.
2007-02-12 Richard Henderson <rth@redhat.com>
* config/alpha/constraints.md: New file.
......
......@@ -160,8 +160,9 @@ in the following sections.
@table @emph
@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 --target-help --version @@@var{file}}
@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
--version @@@var{file}}
@item C Language Options
@xref{C Dialect Options,,Options Controlling C Dialect}.
......@@ -1078,15 +1079,123 @@ Print (on the standard output) a description of the command line options
understood by @command{gcc}. If the @option{-v} option is also specified
then @option{--help} will also be passed on to the various processes
invoked by @command{gcc}, so that they can display the command line options
they accept. If the @option{-Wextra} option is also specified then command
line options which have no documentation associated with them will also
be displayed.
they accept. If the @option{-Wextra} option has also been specified
(prior to the @option{--help} option), then command line options which
have no documentation associated with them will also be displayed.
@item --target-help
@opindex target-help
Print (on the standard output) a description of target specific command
Print (on the standard output) a description of target-specific command
line options for each tool.
@item --help=@var{class}@r{[},@var{qualifier}@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 @var{optimizers}, @var{warnings}, @var{target}
or @var{params}:
@table @gcctabopt
@item @var{optimizers}
This will display all of the optimization options supported by the
compiler.
@item @var{warnings}
This will display all of the options controlling warning messages
produced by the compiler.
@item @var{target}
This will display target-specific options. Unlike the
@option{--target-help} option however, target-specific options of the
linker and assembler will not be displayed. This is because those
tools do not currently support the extended @option{--help=} syntax.
@item @var{params}
This will display the values recognized by the @option{--param}
option.
@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:
@table @gcctabopt
@item undocumented
Display only those options which are undocumented.
@item joined
Display options which take an argument that appears after an equal
sign in the same continuous piece of text, such as:
@samp{--help=target}.
@item separate
Display options which take an argument that appears as a separate word
following the original option, such as: @samp{-o output-file}.
@end table
Thus for example to display all the undocumented target-specific
switches supported by the compiler the following can be used:
@smallexample
--help=target,undocumented
@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
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:
@smallexample
--help=warnings,^joined,^undocumented
@end smallexample
A class can also be used as a qualifier, 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
optimization options the following can be used:
@smallexample
--help=target,optimizers
@end smallexample
The @option{--help=} option can be repeated on the command line. Each
successive use will display its requested class of options, skipping
those that have already been displayed.
If the @option{-Q} option appears on the command line before the
@option{--help=} option, then the descriptive text displayed by
@option{--help=} is changed. Instead of describing the displayed
options, an indication is given as to whether the option is enabled,
disabled or set to a specific value (assuming that the compiler
knows this at the point where the @option{--help=} option is used).
Here is a truncated example from the ARM port of @command{gcc}:
@smallexample
% gcc -Q -mabi=2 --help=target -c
The following options are target specific:
-mabi= 2
-mabort-on-noreturn [disabled]
-mapcs [disabled]
@end smallexample
The output is sensitive to the effects of previous command line
options, so for example it is possible to find out which optimizations
are enabled at @option{-O2} by using:
@smallexample
-O2 --help=optimizers
@end smallexample
Alternatively you can discover which binary optimizations are enabled
by @option{-O3} by using:
@smallexample
gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
diff /tmp/O2-opts /tmp/O3-opts | grep enabled
@end smallexample
@item --version
@opindex version
Display the version number and copyrights of the invoked GCC@.
......@@ -2754,7 +2863,7 @@ if a variable may be clobbered by a @code{setjmp} call.
These warnings are possible only in optimizing compilation,
because they require data flow information that is computed only
when optimizing. If you do not specify @option{-O}, you will not get
when optimizing. If you do not specify @option{-O}, you will not get
these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized}
requiring @option{-O}.
......
2007-02-12 Nick Clifton <nickc@redhat.com>
* lang.opt: Add Warning attribute to warning options.
2007-02-11 Daniel Franke <franke.daniel@gmail.com>
* intrinsic.texi (HOSTNM): Fix typographical error in syntax.
......
; Options for the Fortran 95 front end.
; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
;
; This file is part of GCC.
;
......@@ -38,43 +38,43 @@ Fortran
; Documented in C
Waliasing
Fortran
Fortran Warning
Warn about possible aliasing of dummy arguments
Wampersand
Fortran
Fortran Warning
Warn about missing ampersand in continued character constants
Wcharacter-truncation
Fortran
Fortran Warning
Warn about truncated character expressions
Wconversion
Fortran
Fortran Warning
Warn about implicit conversion
Wimplicit-interface
Fortran
Fortran Warning
Warn about calls with implicit interface
Wline-truncation
Fortran
Fortran Warning
Warn about truncated source lines
Wnonstd-intrinsics
Fortran
Fortran Warning
Warn about usage of non-standard intrinsics
Wsurprising
Fortran
Fortran Warning
Warn about \"suspicious\" constructs
Wtabs
Fortran
Fortran Warning
Permit nonconforming uses of the tab character
Wunderflow
Fortran
Fortran Warning
Warn about underflow of numerical constant expressions
fall-intrinsics
......
/* Compiler driver program that can handle many languages.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
Inc.
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of GCC.
......@@ -179,9 +179,9 @@ static int verbose_flag;
shell scripts to capture the driver-generated command line. */
static int verbose_only_flag;
/* Flag indicating to print target specific command line options. */
/* Flag indicating how to print command line options of sub-processes. */
static int target_help_flag;
static int print_subprocess_help;
/* Flag indicating whether we should report subprocess execution times
(if this is supported by the system - see pexecute.c). */
......@@ -805,6 +805,7 @@ static const char *cc1_options =
%{v:-version} %{pg:-p} %{p} %{f*} %{undef}\
%{Qn:-fno-ident} %{--help:--help}\
%{--target-help:--target-help}\
%{--help=*:--help=%(VALUE)}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
%{fsyntax-only:-o %j} %{-param*}\
%{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}\
......@@ -1492,7 +1493,7 @@ static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/";
static const char *md_exec_prefix = MD_EXEC_PREFIX;
static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
static const char *const standard_startfile_prefix_1
static const char *const standard_startfile_prefix_1
= STANDARD_STARTFILE_PREFIX_1;
static const char *const standard_startfile_prefix_2
= STANDARD_STARTFILE_PREFIX_2;
......@@ -3174,6 +3175,8 @@ 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 (_(" 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);
fputs (_(" -dumpspecs Display all of the built in spec strings\n"), stdout);
......@@ -3589,10 +3592,19 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
add_assembler_option ("--help", 6);
add_linker_option ("--help", 6);
}
else if (strncmp (argv[i], "-fhelp=", 7) == 0)
{
/* translate_options () has turned --help into -fhelp. */
print_subprocess_help = 2;
/* We will be passing a dummy file on to the sub-processes. */
n_infiles++;
n_switches++;
}
else if (strcmp (argv[i], "-ftarget-help") == 0)
{
/* translate_options() has turned --target-help into -ftarget-help. */
target_help_flag = 1;
print_subprocess_help = 1;
/* We will be passing a dummy file on to the sub-processes. */
n_infiles++;
......@@ -4074,10 +4086,6 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
;
else if (! strcmp (argv[i], "-print-multi-os-directory"))
;
else if (! strcmp (argv[i], "-ftarget-help"))
;
else if (! strcmp (argv[i], "-fhelp"))
;
else if (! strncmp (argv[i], "--sysroot=", strlen ("--sysroot=")))
{
target_system_root = argv[i] + strlen ("--sysroot=");
......@@ -4243,34 +4251,14 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
error ("warning: '-x %s' after last input file has no effect", spec_lang);
/* Ensure we only invoke each subprocess once. */
if (target_help_flag || print_help_list)
if (print_subprocess_help || print_help_list)
{
n_infiles = 1;
/* Create a dummy input file, so that we can pass --target-help on to
the various sub-processes. */
/* Create a dummy input file, so that we can pass
the help option on to the various sub-processes. */
infiles[0].language = "c";
infiles[0].name = "help-dummy";
if (target_help_flag)
{
switches[n_switches].part1 = "--target-help";
switches[n_switches].args = 0;
switches[n_switches].live_cond = SWITCH_OK;
switches[n_switches].validated = 0;
n_switches++;
}
if (print_help_list)
{
switches[n_switches].part1 = "--help";
switches[n_switches].args = 0;
switches[n_switches].live_cond = SWITCH_OK;
switches[n_switches].validated = 0;
n_switches++;
}
}
switches[n_switches].part1 = 0;
......@@ -6421,16 +6409,6 @@ main (int argc, char **argv)
return (0);
}
if (target_help_flag)
{
/* Print if any target specific options. */
/* We do not exit here. Instead we have created a fake input file
called 'target-dummy' which needs to be compiled, and we pass this
on to the various sub-processes, along with the --target-help
switch. */
}
if (print_help_list)
{
display_help ();
......
# Copyright (C) 2003,2004 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
# Contributed by Kelley Cook, June 2004.
# Original code from Neil Booth, May 2003.
#
......@@ -77,6 +77,8 @@ function switch_flags (flags)
test_flag("RejectNegative", flags, " | CL_REJECT_NEGATIVE") \
test_flag("UInteger", flags, " | CL_UINTEGER") \
test_flag("Undocumented", flags, " | CL_UNDOCUMENTED") \
test_flag("Warning", flags, " | CL_WARNING") \
test_flag("Optimization", flags, " | CL_OPTIMIZATION") \
test_flag("Report", flags, " | CL_REPORT")
sub( "^0 \\| ", "", result )
return result
......
# Copyright (C) 2003,2004 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
# Contributed by Kelley Cook, June 2004.
# Original code from Neil Booth, May 2003.
#
......@@ -119,6 +119,7 @@ for (i = 0; i < n_langs; i++) {
print " 0\n};\n"
print "const unsigned int cl_options_count = N_OPTS;\n"
print "const unsigned int cl_lang_count = " n_langs ";\n"
print "const struct cl_option cl_options[] =\n{"
......
/* Command line option handling.
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GCC.
......@@ -64,17 +64,30 @@ struct cl_option_state {
extern const struct cl_option cl_options[];
extern const unsigned int cl_options_count;
extern const char *const lang_names[];
extern const unsigned int cl_lang_count;
extern bool no_unit_at_a_time_default;
#define CL_DISABLED (1 << 21) /* Disabled in this configuration. */
#define CL_TARGET (1 << 22) /* Target-specific option. */
#define CL_REPORT (1 << 23) /* Report argument with -fverbose-asm */
#define CL_JOINED (1 << 24) /* If takes joined argument. */
#define CL_SEPARATE (1 << 25) /* If takes a separate argument. */
#define CL_REJECT_NEGATIVE (1 << 26) /* Reject no- form. */
#define CL_MISSING_OK (1 << 27) /* Missing argument OK (joined). */
#define CL_UINTEGER (1 << 28) /* Argument is an integer >=0. */
#define CL_COMMON (1 << 29) /* Language-independent. */
#define CL_PARAMS (1 << 18) /* Fake entry. Used to display --param info with --help. */
#define CL_WARNING (1 << 19) /* Enables an (optional) warning message. */
#define CL_OPTIMIZATION (1 << 20) /* Enables an (optional) optimization. */
#define CL_TARGET (1 << 21) /* Target-specific option. */
#define CL_COMMON (1 << 22) /* Language-independent. */
#define CL_MIN_OPTION_CLASS CL_PARAMS
#define CL_MAX_OPTION_CLASS CL_COMMON
/* From here on the bits describe attributes of the options.
Before this point the bits have described the class of the option.
This distinction is important because --help will not list options
which only have these higher bits set. */
#define CL_DISABLED (1 << 23) /* Disabled in this configuration. */
#define CL_REPORT (1 << 24) /* Report argument with -fverbose-asm */
#define CL_JOINED (1 << 25) /* If takes joined argument. */
#define CL_SEPARATE (1 << 26) /* If takes a separate argument. */
#define CL_REJECT_NEGATIVE (1 << 27) /* Reject no- form. */
#define CL_MISSING_OK (1 << 28) /* Missing argument OK (joined). */
#define CL_UINTEGER (1 << 29) /* Argument is an integer >=0. */
#define CL_UNDOCUMENTED (1 << 30) /* Do not output with --help. */
/* Input file names. */
......
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