Makefile.in: Update.
* Makefile.in: Update. * c-opts.c (c_common_handle_option): opt_text now contains the '-'. * c.opt: Update documentation. * common.opt: Add some help text. * opts.c: Include intl.h. (wrap_help, print_help): New. (find_opt, handle_option, common_handle_option): opt_text now contains the '-'. Use print_help to output help. * opts.h (struct cl_option): New member "help". * opts.sh: Update to handle help text output and to prepend options with '-'. * toplev.c (display_help): Remove some help text. From-SVN: r69068
This commit is contained in:
parent
690e3ffd33
commit
cf03fd63cd
|
@ -1414,7 +1414,7 @@ s-specs : Makefile
|
|||
$(SHELL) $(srcdir)/move-if-change tmp-specs.h specs.h
|
||||
$(STAMP) s-specs
|
||||
|
||||
options.c: $(lang_opt_files) $(srcdir)/opts.sh options.h
|
||||
options.c: $(lang_opt_files) $(srcdir)/opts.sh options.h intl.h
|
||||
|
||||
options.h: $(lang_opt_files) $(srcdir)/opts.sh
|
||||
AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh options.c options.h \
|
||||
|
@ -1481,7 +1481,7 @@ diagnostic.o : diagnostic.c diagnostic.h real.h diagnostic.def \
|
|||
input.h toplev.h intl.h langhooks.h $(LANGHOOKS_DEF_H)
|
||||
opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \
|
||||
coretypes.h $(TREE_H) $(TM_H) $(LANGHOOKS_H) $(GGC_H) $(RTL_H) \
|
||||
output.h diagnostic.h $(TM_P_H) $(INSN_ATTR_H)
|
||||
output.h diagnostic.h $(TM_P_H) $(INSN_ATTR_H) intl.h
|
||||
toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
|
||||
function.h flags.h xcoffout.h input.h $(INSN_ATTR_H) output.h diagnostic.h \
|
||||
debug.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h \
|
||||
|
|
|
@ -675,7 +675,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
|
|||
case OPT_fthis_is_variable:
|
||||
case OPT_fvtable_thunks:
|
||||
case OPT_fxref:
|
||||
warning ("switch \"-%s\" is no longer supported", option->opt_text);
|
||||
warning ("switch \"%s\" is no longer supported", option->opt_text);
|
||||
break;
|
||||
|
||||
case OPT_fabi_version_:
|
||||
|
@ -691,7 +691,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
|
|||
if (value)
|
||||
flag_external_templates = true;
|
||||
cp_deprecated:
|
||||
warning ("switch \"-%s\" is deprecated, please see documentation "
|
||||
warning ("switch \"%s\" is deprecated, please see documentation "
|
||||
"for details", option->opt_text);
|
||||
break;
|
||||
|
||||
|
|
|
@ -38,6 +38,14 @@
|
|||
; decoder will convert the argument for you, or complain to the user
|
||||
; if the argument is invalid.
|
||||
|
||||
; The third field is the help text to output with --help. This is
|
||||
; automatically line-wrapped on output. Normally the switch is output
|
||||
; automatically, with the help text on the right hand side of the
|
||||
; output. However, if the help text contains a tab character, the
|
||||
; text to the left of the tab is output instead of the switch, and the
|
||||
; text to its right forms the help. This is useful for elaborating on
|
||||
; what type of argument a switch takes, for example.
|
||||
|
||||
; Comments can appear on their own line anwhere in the file, preceded
|
||||
; by a semicolon. Whitespace is permitted before the semicolon.
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
-help
|
||||
Common
|
||||
Display this information
|
||||
|
||||
-param
|
||||
Common Separate
|
||||
|
@ -36,12 +37,15 @@ Common
|
|||
|
||||
G
|
||||
Common Joined Separate UInteger
|
||||
-G<number> Put global and static data smaller than <number> bytes into a special section (on some targets)
|
||||
|
||||
O
|
||||
Common JoinedOrMissing
|
||||
-O<number> Set optimization level to <number>
|
||||
|
||||
Os
|
||||
Common
|
||||
Optimize for space rather than speed
|
||||
|
||||
W
|
||||
Common RejectNegative
|
||||
|
@ -63,12 +67,14 @@ Common
|
|||
|
||||
Wextra
|
||||
Common
|
||||
Print extra (possibly unwanted) warnings
|
||||
|
||||
Winline
|
||||
Common
|
||||
|
||||
Wlarger-than-
|
||||
Common RejectNegative Joined UInteger
|
||||
-Wlarger-than-<number> Warn if an object is larger than <number> bytes
|
||||
|
||||
Wmissing-noreturn
|
||||
Common
|
||||
|
@ -105,6 +111,7 @@ Common
|
|||
|
||||
Wunused
|
||||
Common
|
||||
Enable all -Wunused- warnings
|
||||
|
||||
Wunused-function
|
||||
Common
|
||||
|
@ -123,6 +130,7 @@ Common
|
|||
|
||||
aux-info
|
||||
Common Separate
|
||||
-aux-info <file> Emit declaration information into <file>
|
||||
|
||||
aux-info=
|
||||
Common Joined
|
||||
|
@ -135,9 +143,11 @@ Common Separate
|
|||
|
||||
d
|
||||
Common Joined
|
||||
-d<letters> Enable dumps from specific passes of the compiler
|
||||
|
||||
dumpbase
|
||||
Common Separate
|
||||
-dumpbase <file> Set the file basename to be used for dumps
|
||||
|
||||
fPIC
|
||||
Common
|
||||
|
@ -198,9 +208,11 @@ Common
|
|||
|
||||
fcall-saved-
|
||||
Common Joined RejectNegative
|
||||
-fcall-saved-<register> Mark <register> as being preserved across functions
|
||||
|
||||
fcall-used-
|
||||
Common Joined RejectNegative
|
||||
-fcall-used-<register> Mark <register> as being corrupted by function calls
|
||||
|
||||
fcaller-saves
|
||||
Common
|
||||
|
@ -234,6 +246,7 @@ Common
|
|||
|
||||
fdiagnostics-show-location=
|
||||
Common Joined RejectNegative
|
||||
-fdiagnostics-show-location=[once|every-line] How often to emit source location at the beginning of line-wrapped diagnostics
|
||||
|
||||
fdump-unnumbered
|
||||
Common
|
||||
|
@ -261,6 +274,7 @@ Common
|
|||
|
||||
ffixed-
|
||||
Common Joined RejectNegative
|
||||
-ffixed-<register> Mark <register> as being unavailable to the compiler
|
||||
|
||||
ffloat-store
|
||||
Common
|
||||
|
@ -315,6 +329,7 @@ Common RejectNegative Joined UInteger
|
|||
|
||||
finline-limit=
|
||||
Common RejectNegative Joined UInteger
|
||||
-finline-limit=<number> Limit the size of inlined functions to <number>
|
||||
|
||||
finstrument-functions
|
||||
Common
|
||||
|
@ -345,6 +360,7 @@ Common
|
|||
|
||||
fmessage-length=
|
||||
Common RejectNegative Joined UInteger
|
||||
-fmessage-length=<number> Limit diagnostics to <number> characters per line. 0 suppresses line-wrapping
|
||||
|
||||
fmove-all-movables
|
||||
Common
|
||||
|
@ -405,6 +421,7 @@ Common
|
|||
|
||||
frandom-seed=
|
||||
Common Joined RejectNegative
|
||||
-frandom-seed=<string> Make compile reproducible using <string>
|
||||
|
||||
freduce-all-givs
|
||||
Common
|
||||
|
@ -444,6 +461,7 @@ Common
|
|||
|
||||
fsched-verbose=
|
||||
Common RejectNegative Joined
|
||||
-fsched-verbose=<number> Set the verbosity level of the scheduler
|
||||
|
||||
fsched2-use-superblocks
|
||||
Common
|
||||
|
@ -483,9 +501,11 @@ Common
|
|||
|
||||
fstack-limit-register=
|
||||
Common RejectNegative Joined
|
||||
-fstack-limit-register=<register> Trap if the stack goes past <register>
|
||||
|
||||
fstack-limit-symbol=
|
||||
Common RejectNegative Joined
|
||||
-fstack-limit-symbol=<name> Trap if the stack goes past symbol <name>
|
||||
|
||||
fstrength-reduce
|
||||
Common
|
||||
|
@ -507,6 +527,7 @@ Common
|
|||
|
||||
ftls-model=
|
||||
Common Joined RejectNegative
|
||||
-ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec] Set the default thread-local storage code generation model
|
||||
|
||||
ftracer
|
||||
Common
|
||||
|
@ -555,23 +576,30 @@ Common Joined
|
|||
|
||||
o
|
||||
Common Joined Separate
|
||||
-o <file> Place output into <file>
|
||||
|
||||
p
|
||||
Common
|
||||
Enable function profiling
|
||||
|
||||
pedantic
|
||||
Common
|
||||
Issue warnings needed for strict compliance to the standard
|
||||
|
||||
pedantic-errors
|
||||
Common
|
||||
Like -pedantic but issue them as errors
|
||||
|
||||
quiet
|
||||
Common
|
||||
Do not display functions compiled or elapsed time
|
||||
|
||||
version
|
||||
Common
|
||||
Display the compiler's version
|
||||
|
||||
w
|
||||
Common
|
||||
Suppress warnings
|
||||
|
||||
; This comment is to ensure we retain the blank line above.
|
||||
|
|
91
gcc/opts.c
91
gcc/opts.c
|
@ -21,6 +21,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "intl.h"
|
||||
#include "coretypes.h"
|
||||
#include "tm.h"
|
||||
#include "tree.h"
|
||||
|
@ -136,6 +137,8 @@ static char *write_langs (unsigned int lang_mask);
|
|||
static void complain_wrong_lang (const char *, const struct cl_option *,
|
||||
unsigned int lang_mask);
|
||||
static void handle_options (unsigned int, const char **, unsigned int);
|
||||
static void wrap_help (const char *help, const char *item, size_t item_width);
|
||||
static void print_help (void);
|
||||
|
||||
/* Perform a binary search to find which option the command-line INPUT
|
||||
matches. Returns its index in the option array, and N_OPTS
|
||||
|
@ -177,7 +180,7 @@ find_opt (const char *input, int lang_mask)
|
|||
{
|
||||
md = (mn + mx) / 2;
|
||||
opt_len = cl_options[md].opt_len;
|
||||
comp = strncmp (input, cl_options[md].opt_text, opt_len);
|
||||
comp = strncmp (input, cl_options[md].opt_text + 1, opt_len);
|
||||
|
||||
if (comp < 0)
|
||||
mx = md;
|
||||
|
@ -197,7 +200,7 @@ find_opt (const char *input, int lang_mask)
|
|||
const struct cl_option *opt = &cl_options[mn];
|
||||
|
||||
/* Is this switch a prefix of the input? */
|
||||
if (!strncmp (input, opt->opt_text, opt->opt_len))
|
||||
if (!strncmp (input, opt->opt_text + 1, opt->opt_len))
|
||||
{
|
||||
/* If language is OK, and the match is exact or the switch
|
||||
takes a joined argument, return it. */
|
||||
|
@ -374,7 +377,7 @@ handle_option (const char **argv, unsigned int lang_mask)
|
|||
value = integral_argument (arg);
|
||||
if (value == -1)
|
||||
{
|
||||
error ("argument to \"-%s\" should be a non-negative integer",
|
||||
error ("argument to \"%s\" should be a non-negative integer",
|
||||
option->opt_text);
|
||||
goto done;
|
||||
}
|
||||
|
@ -612,7 +615,7 @@ common_handle_option (size_t scode, const char *arg,
|
|||
abort ();
|
||||
|
||||
case OPT__help:
|
||||
display_help ();
|
||||
print_help ();
|
||||
exit_after_options = true;
|
||||
break;
|
||||
|
||||
|
@ -1477,3 +1480,83 @@ fast_math_flags_set_p (void)
|
|||
&& flag_finite_math_only
|
||||
&& !flag_errno_math);
|
||||
}
|
||||
|
||||
/* Output --help text. */
|
||||
static void
|
||||
print_help (void)
|
||||
{
|
||||
size_t i, len;
|
||||
|
||||
printf (_("\nThe following options are language-independent:\n"));
|
||||
|
||||
for (i = 0; i < cl_options_count; i++)
|
||||
{
|
||||
const char *help = cl_options[i].help;
|
||||
const char *opt, *tab;
|
||||
|
||||
/* During transition, ignore switches with no help. */
|
||||
if (!help)
|
||||
continue;
|
||||
|
||||
/* Get the translation. */
|
||||
help = _(help);
|
||||
|
||||
tab = strchr (help, '\t');
|
||||
if (tab)
|
||||
{
|
||||
len = tab - help;
|
||||
opt = help;
|
||||
help = tab + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
opt = cl_options[i].opt_text;
|
||||
len = strlen (opt);
|
||||
}
|
||||
|
||||
wrap_help (help, opt, len);
|
||||
}
|
||||
|
||||
puts ( "\n" );
|
||||
display_help ();
|
||||
}
|
||||
|
||||
/* Output ITEM, of length ITEM_WIDTH, in the left column, followed by
|
||||
word-wrapped HELP in a second column. */
|
||||
static void
|
||||
wrap_help (const char *help, const char *item, size_t item_width)
|
||||
{
|
||||
const size_t columns = 80, col_width = 27;
|
||||
size_t remaining, room, len;
|
||||
|
||||
remaining = strlen (help);
|
||||
|
||||
do
|
||||
{
|
||||
room = columns - 3 - MAX (col_width, item_width);
|
||||
len = remaining;
|
||||
|
||||
if (room < len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; help[i]; i++)
|
||||
{
|
||||
if (i >= room && len != remaining)
|
||||
break;
|
||||
if (help[i] == ' ')
|
||||
len = i;
|
||||
else if (help[i] == '-')
|
||||
len = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf( " %-*.*s %.*s\n", col_width, item_width, item, len, help);
|
||||
item_width = 0;
|
||||
while (help[len] == ' ')
|
||||
len++;
|
||||
help += len;
|
||||
remaining -= len;
|
||||
}
|
||||
while (remaining);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ extern void decode_options (unsigned int argc, const char **argv);
|
|||
struct cl_option
|
||||
{
|
||||
const char *opt_text;
|
||||
const char *help;
|
||||
unsigned short back_chain;
|
||||
unsigned char opt_len;
|
||||
unsigned int flags;
|
||||
|
|
21
gcc/opts.sh
21
gcc/opts.sh
|
@ -37,7 +37,13 @@ ${AWK} '
|
|||
# Ignore comments and blank lines
|
||||
/^[ \t]*(;|$)/ { next }
|
||||
# Note that RS="" falls foul of gawk 3.1.2 bugs
|
||||
/^[^ \t]/ { getline tmp; print $0 "\034" tmp}
|
||||
/^[^ \t]/ { record = $0
|
||||
do { getline tmp;
|
||||
if (tmp != "" )
|
||||
record = record "\034" tmp
|
||||
} while (tmp != "")
|
||||
print record
|
||||
}
|
||||
' "$@" | ${SORT} | ${AWK} '
|
||||
function switch_flags (flags, result)
|
||||
{
|
||||
|
@ -74,6 +80,7 @@ ${AWK} '
|
|||
} else {
|
||||
opts[n_opts] = $1
|
||||
flags[n_opts] = $2
|
||||
help[n_opts] = $3
|
||||
n_opts++;
|
||||
}
|
||||
}
|
||||
|
@ -86,6 +93,7 @@ ${AWK} '
|
|||
comma = ","
|
||||
|
||||
print "/* This file is auto-generated by opts.sh. */\n" > c_file
|
||||
print "#include <intl.h>" >> c_file
|
||||
print "#include \"" h_file "\"" >> c_file
|
||||
print "#include \"opts.h\"\n" >> c_file
|
||||
print "const char * const lang_names[] =\n{" >> c_file
|
||||
|
@ -140,10 +148,15 @@ ${AWK} '
|
|||
if (i + 1 == n_opts)
|
||||
comma = ""
|
||||
|
||||
if (help[i] == "")
|
||||
hlp = "0"
|
||||
else
|
||||
hlp = "N_(\"" help[i] "\")";
|
||||
|
||||
printf(" %s,%s/* -%s */\n", enum, s, opts[i]) >> h_file
|
||||
printf(" { \"%s\", (unsigned short) %s, %u,\n\t%s }%s\n",
|
||||
opts[i], back_chain[i], len, switch_flags(flags[i]),
|
||||
comma) >> c_file
|
||||
printf(" { \"-%s\",\n %s,\n %s, %u, %s }%s\n",
|
||||
opts[i], hlp, back_chain[i], len,
|
||||
switch_flags(flags[i]), comma) >> c_file
|
||||
}
|
||||
|
||||
print " N_OPTS\n};" >> h_file
|
||||
|
|
36
gcc/toplev.c
36
gcc/toplev.c
|
@ -3942,18 +3942,6 @@ display_help (void)
|
|||
unsigned long i;
|
||||
const char *lang;
|
||||
|
||||
printf (_(" -ffixed-<register> Mark <register> as being unavailable to the compiler\n"));
|
||||
printf (_(" -fcall-used-<register> Mark <register> as being corrupted by function calls\n"));
|
||||
printf (_(" -fcall-saved-<register> Mark <register> as being preserved across functions\n"));
|
||||
printf (_(" -finline-limit=<number> Limits the size of inlined functions to <number>\n"));
|
||||
printf (_(" -fmessage-length=<number> Limits diagnostics messages lengths to <number> characters per line. 0 suppresses line-wrapping\n"));
|
||||
printf (_(" -fdiagnostics-show-location=[once | every-line] Indicates how often source location information should be emitted, as prefix, at the beginning of diagnostics when line-wrapping\n"));
|
||||
printf (_(" -ftls-model=[global-dynamic | local-dynamic | initial-exec | local-exec] Indicates the default thread-local storage code generation model\n"));
|
||||
printf (_(" -fstack-limit-register=<register> Trap if the stack goes past <register>\n"));
|
||||
printf (_(" -fstack-limit-symbol=<name> Trap if the stack goes past symbol <name>\n"));
|
||||
printf (_(" -frandom-seed=<string> Make compile reproducible using <string>\n"));
|
||||
|
||||
|
||||
for (i = ARRAY_SIZE (f_options); i--;)
|
||||
{
|
||||
const char *description = f_options[i].description;
|
||||
|
@ -3963,8 +3951,6 @@ display_help (void)
|
|||
f_options[i].string, _(description));
|
||||
}
|
||||
|
||||
printf (_(" -O[number] Set optimization level to [number]\n"));
|
||||
printf (_(" -Os Optimize for space rather than speed\n"));
|
||||
for (i = LAST_PARAM; i--;)
|
||||
{
|
||||
const char *description = compiler_params[i].help;
|
||||
|
@ -3976,9 +3962,6 @@ display_help (void)
|
|||
length > 0 ? length : 1, " ",
|
||||
_(description));
|
||||
}
|
||||
printf (_(" -pedantic Issue warnings needed by strict compliance to ISO C\n"));
|
||||
printf (_(" -pedantic-errors Like -pedantic except that errors are produced\n"));
|
||||
printf (_(" -w Suppress warnings\n"));
|
||||
|
||||
for (i = ARRAY_SIZE (W_options); i--;)
|
||||
{
|
||||
|
@ -3989,15 +3972,6 @@ display_help (void)
|
|||
W_options[i].string, _(description));
|
||||
}
|
||||
|
||||
printf (_(" -Wextra Print extra (possibly unwanted) warnings\n"));
|
||||
printf (_(" -Wunused Enable unused warnings\n"));
|
||||
printf (_(" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n"));
|
||||
printf (_(" -p Enable function profiling\n"));
|
||||
printf (_(" -o <file> Place output into <file> \n"));
|
||||
printf (_("\
|
||||
-G <number> Put global and static data smaller than <number>\n\
|
||||
bytes into a special section (on some targets)\n"));
|
||||
|
||||
for (i = ARRAY_SIZE (debug_args); i--;)
|
||||
{
|
||||
if (debug_args[i].description != NULL)
|
||||
|
@ -4005,16 +3979,6 @@ display_help (void)
|
|||
debug_args[i].arg, _(debug_args[i].description));
|
||||
}
|
||||
|
||||
printf (_(" -aux-info <file> Emit declaration info into <file>\n"));
|
||||
printf (_(" -quiet Do not display functions compiled or elapsed time\n"));
|
||||
printf (_(" -version Display the compiler's version\n"));
|
||||
printf (_(" -d[letters] Enable dumps from specific passes of the compiler\n"));
|
||||
printf (_(" -dumpbase <file> Base name to be used for dumps from specific passes\n"));
|
||||
#if defined INSN_SCHEDULING
|
||||
printf (_(" -fsched-verbose=<number> Set the verbosity level of the scheduler\n"));
|
||||
#endif
|
||||
printf (_(" --help Display this information\n"));
|
||||
|
||||
undoc = 0;
|
||||
lang = "language";
|
||||
|
||||
|
|
Loading…
Reference in New Issue