c-opts.c (print_help): Remove.

* c-opts.c (print_help): Remove.
	(c_common_handle_option): Don't handle --help.
	* c.opt: Document some options.
	(--help): Remove.
	* opts.c (print_filtered_help): New.
	(print_help): Use it.

From-SVN: r69383
This commit is contained in:
Neil Booth 2003-07-15 05:48:16 +00:00 committed by Neil Booth
parent 2d799c0954
commit 72de27eaff
4 changed files with 110 additions and 103 deletions

View File

@ -1,3 +1,12 @@
2003-07-15 Neil Booth <neil@daikokuya.co.uk>
* c-opts.c (print_help): Remove.
(c_common_handle_option): Don't handle --help.
* c.opt: Document some options.
(--help): Remove.
* opts.c (print_filtered_help): New.
(print_help): Use it.
2003-07-14 Geoffrey Keating <geoffk@apple.com> 2003-07-14 Geoffrey Keating <geoffk@apple.com>
* c-common.c (c_common_type_for_mode): Handle V4DFmode. * c-common.c (c_common_type_for_mode): Handle V4DFmode.

View File

@ -99,7 +99,6 @@ static size_t include_cursor;
static bool permit_fortran_options; static bool permit_fortran_options;
static void set_Wimplicit (int); static void set_Wimplicit (int);
static void print_help (void);
static void handle_OPT_d (const char *); static void handle_OPT_d (const char *);
static void set_std_cxx98 (int); static void set_std_cxx98 (int);
static void set_std_c89 (int, int); static void set_std_c89 (int, int);
@ -255,10 +254,6 @@ c_common_handle_option (size_t scode, const char *arg, int value)
result = permit_fortran_options; result = permit_fortran_options;
break; break;
case OPT__help:
print_help ();
break;
case OPT__output_pch_: case OPT__output_pch_:
pch_file = arg; pch_file = arg;
break; break;
@ -1538,91 +1533,3 @@ handle_OPT_d (const char *arg)
break; break;
} }
} }
/* Handle --help output. */
static void
print_help (void)
{
/* To keep the lines from getting too long for some compilers, limit
to about 500 characters (6 lines) per chunk. */
fputs (_("\
Switches:\n\
-include <file> Include the contents of <file> before other files\n\
-imacros <file> Accept definition of macros in <file>\n\
-iprefix <path> Specify <path> as a prefix for next two options\n\
-iwithprefix <dir> Add <dir> to the end of the system include path\n\
-iwithprefixbefore <dir> Add <dir> to the end of the main include path\n\
-isystem <dir> Add <dir> to the start of the system include path\n\
"), stdout);
fputs (_("\
-idirafter <dir> Add <dir> to the end of the system include path\n\
-I <dir> Add <dir> to the end of the main include path\n\
-I- Fine-grained include path control; see info docs\n\
-nostdinc Do not search system include directories\n\
(dirs specified with -isystem will still be used)\n\
-nostdinc++ Do not search system include directories for C++\n\
-o <file> Put output into <file>\n\
"), stdout);
fputs (_("\
-trigraphs Support ISO C trigraphs\n\
-std=<std name> Specify the conformance standard; one of:\n\
gnu89, gnu99, c89, c99, iso9899:1990,\n\
iso9899:199409, iso9899:1999, c++98\n\
-w Inhibit warning messages\n\
-W[no-]trigraphs Warn if trigraphs are encountered\n\
-W[no-]comment{s} Warn if one comment starts inside another\n\
"), stdout);
fputs (_("\
-W[no-]traditional Warn about features not present in traditional C\n\
-W[no-]undef Warn if an undefined macro is used by #if\n\
-W[no-]import Warn about the use of the #import directive\n\
"), stdout);
fputs (_("\
-W[no-]error Treat all warnings as errors\n\
-W[no-]system-headers Do not suppress warnings from system headers\n\
-W[no-]all Enable most preprocessor warnings\n\
"), stdout);
fputs (_("\
-M Generate make dependencies\n\
-MM As -M, but ignore system header files\n\
-MD Generate make dependencies and compile\n\
-MMD As -MD, but ignore system header files\n\
-MF <file> Write dependency output to the given file\n\
-MG Treat missing header file as generated files\n\
"), stdout);
fputs (_("\
-MP Generate phony targets for all headers\n\
-MQ <target> Add a MAKE-quoted target\n\
-MT <target> Add an unquoted target\n\
"), stdout);
fputs (_("\
-D<macro> Define a <macro> with string '1' as its value\n\
-D<macro>=<val> Define a <macro> with <val> as its value\n\
-A<question>=<answer> Assert the <answer> to <question>\n\
-A-<question>=<answer> Disable the <answer> to <question>\n\
-U<macro> Undefine <macro> \n\
-v Display the version number\n\
"), stdout);
fputs (_("\
-H Print the name of header files as they are used\n\
-C Do not discard comments\n\
-dM Display a list of macro definitions active at end\n\
-dD Preserve macro definitions in output\n\
-dN As -dD except that only the names are preserved\n\
-dI Include #include directives in the output\n\
"), stdout);
fputs (_("\
-f[no-]preprocessed Treat the input file as already preprocessed\n\
-ftabstop=<number> Distance between tab stops for column reporting\n\
-ftarget-charset=<c> Convert all strings and character constants\n\
to character set <c>\n\
-ftarget-wide-charset=<c> Convert all wide strings and character constants\n\
to character set <c>\n\
"), stdout);
fputs (_("\
-isysroot <dir> Set <dir> to be the system root directory\n\
-P Do not generate #line directives\n\
-remap Remap file names when including files\n\
--help Display this information\n\
"), stdout);
}

View File

@ -67,71 +67,86 @@ C++
Language Language
ObjC++ ObjC++
-help
C ObjC C++ ObjC++
-output-pch= -output-pch=
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
A A
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-A<question>=<answer> Assert the <answer> to <question>. Putting '-' before <question> disables the <answer> to <question>
C C
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Do not discard comments
CC CC
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Do not discard comments in macro expansions
D D
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-D<macro>[=<val>] Define a <macro> with <val> as its value. If just <macro> is given, <val> is taken to be 1
E E
C ObjC C++ ObjC++ C ObjC C++ ObjC++
H H
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Print the name of header files as they are used
I I
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-I <dir> Add <dir> to the end of the main include path. -I- gives more include path control; see info documentation
M M
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Generate make dependencies
MD MD
C ObjC C++ ObjC++ Separate C ObjC C++ ObjC++ Separate
Generate make dependencies and compile
MF MF
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-MF <file> Write dependency output to the given file
MG MG
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Treat missing header files as generated files
MM MM
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Like -M but ignore system header files
MMD MMD
C ObjC C++ ObjC++ Separate C ObjC C++ ObjC++ Separate
Like -MD but ignore system header files
MP MP
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Generate phony targets for all headers
MQ MQ
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-MQ <target> Add a MAKE-quoted target
MT MT
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-MT <target> Add an unquoted target
P P
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Do not generate #line directives
U U
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-U<macro> Undefine <macro>
Wabi Wabi
C++ ObjC++ C++ ObjC++
Wall Wall
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Enable most preprocessor warnings
Wbad-function-cast Wbad-function-cast
C ObjC C ObjC
@ -144,9 +159,11 @@ C ObjC C++ ObjC++
Wcomment Wcomment
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Warn about possibly nested block comments, and C++ comments spanning more than one physical line
Wcomments Wcomments
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Synonym for -Wcomment
Wconversion Wconversion
C ObjC C++ ObjC++ C ObjC C++ ObjC++
@ -165,9 +182,11 @@ C++ ObjC++
Wendif-labels Wendif-labels
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Warn about stray tokens after #elif and #endif
Werror Werror
C ObjC C++ ObjC++ C ObjC C++ ObjC++
; Documented in common.opt
Werror-implicit-function-declaration Werror-implicit-function-declaration
C ObjC RejectNegative C ObjC RejectNegative
@ -207,6 +226,7 @@ C ObjC
Wimport Wimport
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Warn about uses of the #import directive
Winvalid-offsetof Winvalid-offsetof
C++ ObjC++ C++ ObjC++
@ -294,24 +314,29 @@ C++ ObjC++
Wsystem-headers Wsystem-headers
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Do not suppress warnings from system headers
Wtraditional Wtraditional
C ObjC C ObjC
Warn about features not present in traditional C
Wtrigraphs Wtrigraphs
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Warn if trigraphs are encountered that might affect the meaning of the program
Wundeclared-selector Wundeclared-selector
ObjC ObjC++ ObjC ObjC++
Wundef Wundef
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Warn if an undefined macro is used in an #if directive
Wunknown-pragmas Wunknown-pragmas
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Wunused-macros Wunused-macros
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Warn about macros defined in the main file that are not used
Wwrite-strings Wwrite-strings
C ObjC C++ ObjC++ C ObjC C++ ObjC++
@ -321,6 +346,7 @@ C ObjC C++ ObjC++
d d
C ObjC C++ ObjC++ Joined C ObjC C++ ObjC++ Joined
; Documented in common.opt. FIXME - what about -dI, -dD, -dN and -dD?
fabi-version= fabi-version=
C++ ObjC++ Joined UInteger C++ ObjC++ Joined UInteger
@ -363,6 +389,7 @@ C++ ObjC++
fdollars-in-identifiers fdollars-in-identifiers
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Permit '$' as an identifier character
fdump- fdump-
C ObjC C++ ObjC++ Joined RejectNegative C ObjC C++ ObjC++ Joined RejectNegative
@ -378,6 +405,7 @@ C++ ObjC++
fexec-charset= fexec-charset=
C ObjC C++ ObjC++ Joined RejectNegative C ObjC C++ ObjC++ Joined RejectNegative
-fexec-charset=<cset> Convert all strings and character constants to character set <cset>
fexternal-templates fexternal-templates
C++ ObjC++ C++ ObjC++
@ -459,6 +487,7 @@ C++ ObjC++
fpreprocessed fpreprocessed
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Treat the input file as already preprocessed
frepo frepo
C++ ObjC++ C++ ObjC++
@ -495,6 +524,7 @@ C++ ObjC++
ftabstop= ftabstop=
C ObjC C++ ObjC++ Joined RejectNegative UInteger C ObjC C++ ObjC++ Joined RejectNegative UInteger
-ftabstop=<number> Distance between tab stops for column reporting
ftemplate-depth- ftemplate-depth-
C++ ObjC++ Joined RejectNegative UInteger C++ ObjC++ Joined RejectNegative UInteger
@ -522,6 +552,7 @@ C++ ObjC++
fwide-exec-charset= fwide-exec-charset=
C ObjC C++ ObjC++ Joined RejectNegative C ObjC C++ ObjC++ Joined RejectNegative
-fwide-exec-charset=<cset> Convert all wide strings and character constants to character set <cset>
fxref fxref
C++ ObjC++ C++ ObjC++
@ -531,104 +562,137 @@ ObjC ObjC++
idirafter idirafter
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-idirafter <dir> Add <dir> to the end of the system include path
imacros imacros
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-imacros <file> Accept definition of macros in <file>
include include
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-include <file> Include the contents of <file> before other files
iprefix iprefix
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-iprefix <path> Specify <path> as a prefix for next two options
isysroot isysroot
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-isysroot <dir> Set <dir> to be the system root directory
isystem isystem
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-isystem <dir> Add <dir> to the start of the system include path
iwithprefix iwithprefix
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-iwithprefix <dir> Add <dir> to the end of the system include path
iwithprefixbefore iwithprefixbefore
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
-iwithprefixbefore <dir> Add <dir> to the end of the main include path
lang-asm lang-asm
C C
For internal use only
lang-objc lang-objc
C ObjC C++ ObjC++ C ObjC C++ ObjC++
For internal use only
nostdinc nostdinc
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Do not search standard system include directories (those specified with -isystem will still be used)
nostdinc++ nostdinc++
C ObjC C++ ObjC++ C++ ObjC++
Do not search standard system include directories for C++
o o
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
; Documented in common.opt
pedantic pedantic
C ObjC C++ ObjC++ C ObjC C++ ObjC++
; Documented in common.opt
pedantic-errors pedantic-errors
C ObjC C++ ObjC++ C ObjC C++ ObjC++
; Documented in common.opt
print-objc-runtime-info print-objc-runtime-info
ObjC ObjC++ ObjC ObjC++
remap remap
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Remap file names when including files
std=c++98 std=c++98
C++ ObjC++ C++ ObjC++
Conform to the ISO 1998 C++ standard
std=c89 std=c89
C ObjC C ObjC
Conform to the ISO 1990 C standard
std=c99 std=c99
C ObjC C ObjC
Conform to the ISO 1999 C standard
std=c9x std=c9x
C ObjC C ObjC
Deprecated in favor of -std=c99
std=gnu++98 std=gnu++98
C++ ObjC++ C++ ObjC++
Conform to the ISO 1998 C++ standard with GNU extensions
std=gnu89 std=gnu89
C ObjC C ObjC
Conform to the ISO 1990 C standard with GNU extensions
std=gnu99 std=gnu99
C ObjC C ObjC
Conform to the ISO 1999 C standard with GNU extensions
std=gnu9x std=gnu9x
C ObjC C ObjC
Deprecated in favor of -std=gnu99
std=iso9899:1990 std=iso9899:1990
C ObjC C ObjC
Deprecated in favor of -std=c89
std=iso9899:199409 std=iso9899:199409
C ObjC C ObjC
Conform to the ISO 1990 C standard as amended in 1994
std=iso9899:1999 std=iso9899:1999
C ObjC C ObjC
Deprecated in favor of -std=c99
std=iso9899:199x std=iso9899:199x
C ObjC C ObjC
Deprecated in favor of -std=c99
traditional-cpp traditional-cpp
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Enable traditional preprocessing
trigraphs trigraphs
C ObjC C++ ObjC++ C ObjC C++ ObjC++
-trigraphs Support ISO C trigraphs
undef undef
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Do not predefine system-specific and GCC-specific macros
v v
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Enable verbose output
w w
C ObjC C++ ObjC++ C ObjC C++ ObjC++
; Documented in common.opt
; This comment is to ensure we retain the blank line above. ; This comment is to ensure we retain the blank line above.

View File

@ -139,6 +139,7 @@ static void complain_wrong_lang (const char *, const struct cl_option *,
static void handle_options (unsigned int, const char **, unsigned int); static void handle_options (unsigned int, const char **, unsigned int);
static void wrap_help (const char *help, const char *item, int item_width); static void wrap_help (const char *help, const char *item, int item_width);
static void print_help (void); static void print_help (void);
static void print_filtered_help (unsigned int flag);
/* Perform a binary search to find which option the command-line INPUT /* Perform a binary search to find which option the command-line INPUT
matches. Returns its index in the option array, and N_OPTS matches. Returns its index in the option array, and N_OPTS
@ -1485,16 +1486,45 @@ fast_math_flags_set_p (void)
static void static void
print_help (void) print_help (void)
{ {
size_t i, len; size_t i;
puts (_("\nThe following options are language-independent:\n")); puts (_("The following options are language-independent:\n"));
print_filtered_help (CL_COMMON);
for (i = 0; lang_names[i]; i++)
{
printf (_("\nThe %s front end recognizes the following options:\n"),
lang_names[i]);
print_filtered_help (1U << i);
}
puts ( "\n" );
display_help ();
}
/* Print help for a specific front-end, etc. */
static void
print_filtered_help (unsigned int flag)
{
size_t i, len;
unsigned int filter;
/* Don't print COMMON options twice. */
filter = flag;
if (flag != CL_COMMON)
filter |= CL_COMMON;
for (i = 0; i < cl_options_count; i++) for (i = 0; i < cl_options_count; i++)
{ {
const char *help = cl_options[i].help; const char *help;
const char *opt, *tab; const char *opt, *tab;
if ((cl_options[i].flags & filter) != flag)
continue;
/* During transition, ignore switches with no help. */ /* During transition, ignore switches with no help. */
help = cl_options[i].help;
if (!help) if (!help)
continue; continue;
@ -1516,9 +1546,6 @@ print_help (void)
wrap_help (help, opt, len); wrap_help (help, opt, len);
} }
puts ( "\n" );
display_help ();
} }
/* Output ITEM, of length ITEM_WIDTH, in the left column, followed by /* Output ITEM, of length ITEM_WIDTH, in the left column, followed by