Commit cf03fd63 by Neil Booth

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
parent 690e3ffd
...@@ -1414,7 +1414,7 @@ s-specs : Makefile ...@@ -1414,7 +1414,7 @@ s-specs : Makefile
$(SHELL) $(srcdir)/move-if-change tmp-specs.h specs.h $(SHELL) $(srcdir)/move-if-change tmp-specs.h specs.h
$(STAMP) s-specs $(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 options.h: $(lang_opt_files) $(srcdir)/opts.sh
AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh options.c options.h \ AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh options.c options.h \
...@@ -1481,7 +1481,7 @@ diagnostic.o : diagnostic.c diagnostic.h real.h diagnostic.def \ ...@@ -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) 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) \ 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) \ 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) \ 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 \ 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 \ 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) ...@@ -675,7 +675,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
case OPT_fthis_is_variable: case OPT_fthis_is_variable:
case OPT_fvtable_thunks: case OPT_fvtable_thunks:
case OPT_fxref: case OPT_fxref:
warning ("switch \"-%s\" is no longer supported", option->opt_text); warning ("switch \"%s\" is no longer supported", option->opt_text);
break; break;
case OPT_fabi_version_: case OPT_fabi_version_:
...@@ -691,7 +691,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) ...@@ -691,7 +691,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
if (value) if (value)
flag_external_templates = true; flag_external_templates = true;
cp_deprecated: cp_deprecated:
warning ("switch \"-%s\" is deprecated, please see documentation " warning ("switch \"%s\" is deprecated, please see documentation "
"for details", option->opt_text); "for details", option->opt_text);
break; break;
......
...@@ -38,6 +38,14 @@ ...@@ -38,6 +38,14 @@
; decoder will convert the argument for you, or complain to the user ; decoder will convert the argument for you, or complain to the user
; if the argument is invalid. ; 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 ; Comments can appear on their own line anwhere in the file, preceded
; by a semicolon. Whitespace is permitted before the semicolon. ; by a semicolon. Whitespace is permitted before the semicolon.
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
-help -help
Common Common
Display this information
-param -param
Common Separate Common Separate
...@@ -36,12 +37,15 @@ Common ...@@ -36,12 +37,15 @@ Common
G G
Common Joined Separate UInteger Common Joined Separate UInteger
-G<number> Put global and static data smaller than <number> bytes into a special section (on some targets)
O O
Common JoinedOrMissing Common JoinedOrMissing
-O<number> Set optimization level to <number>
Os Os
Common Common
Optimize for space rather than speed
W W
Common RejectNegative Common RejectNegative
...@@ -63,12 +67,14 @@ Common ...@@ -63,12 +67,14 @@ Common
Wextra Wextra
Common Common
Print extra (possibly unwanted) warnings
Winline Winline
Common Common
Wlarger-than- Wlarger-than-
Common RejectNegative Joined UInteger Common RejectNegative Joined UInteger
-Wlarger-than-<number> Warn if an object is larger than <number> bytes
Wmissing-noreturn Wmissing-noreturn
Common Common
...@@ -105,6 +111,7 @@ Common ...@@ -105,6 +111,7 @@ Common
Wunused Wunused
Common Common
Enable all -Wunused- warnings
Wunused-function Wunused-function
Common Common
...@@ -123,6 +130,7 @@ Common ...@@ -123,6 +130,7 @@ Common
aux-info aux-info
Common Separate Common Separate
-aux-info <file> Emit declaration information into <file>
aux-info= aux-info=
Common Joined Common Joined
...@@ -135,9 +143,11 @@ Common Separate ...@@ -135,9 +143,11 @@ Common Separate
d d
Common Joined Common Joined
-d<letters> Enable dumps from specific passes of the compiler
dumpbase dumpbase
Common Separate Common Separate
-dumpbase <file> Set the file basename to be used for dumps
fPIC fPIC
Common Common
...@@ -198,9 +208,11 @@ Common ...@@ -198,9 +208,11 @@ Common
fcall-saved- fcall-saved-
Common Joined RejectNegative Common Joined RejectNegative
-fcall-saved-<register> Mark <register> as being preserved across functions
fcall-used- fcall-used-
Common Joined RejectNegative Common Joined RejectNegative
-fcall-used-<register> Mark <register> as being corrupted by function calls
fcaller-saves fcaller-saves
Common Common
...@@ -234,6 +246,7 @@ Common ...@@ -234,6 +246,7 @@ Common
fdiagnostics-show-location= fdiagnostics-show-location=
Common Joined RejectNegative Common Joined RejectNegative
-fdiagnostics-show-location=[once|every-line] How often to emit source location at the beginning of line-wrapped diagnostics
fdump-unnumbered fdump-unnumbered
Common Common
...@@ -261,6 +274,7 @@ Common ...@@ -261,6 +274,7 @@ Common
ffixed- ffixed-
Common Joined RejectNegative Common Joined RejectNegative
-ffixed-<register> Mark <register> as being unavailable to the compiler
ffloat-store ffloat-store
Common Common
...@@ -315,6 +329,7 @@ Common RejectNegative Joined UInteger ...@@ -315,6 +329,7 @@ Common RejectNegative Joined UInteger
finline-limit= finline-limit=
Common RejectNegative Joined UInteger Common RejectNegative Joined UInteger
-finline-limit=<number> Limit the size of inlined functions to <number>
finstrument-functions finstrument-functions
Common Common
...@@ -345,6 +360,7 @@ Common ...@@ -345,6 +360,7 @@ Common
fmessage-length= fmessage-length=
Common RejectNegative Joined UInteger Common RejectNegative Joined UInteger
-fmessage-length=<number> Limit diagnostics to <number> characters per line. 0 suppresses line-wrapping
fmove-all-movables fmove-all-movables
Common Common
...@@ -405,6 +421,7 @@ Common ...@@ -405,6 +421,7 @@ Common
frandom-seed= frandom-seed=
Common Joined RejectNegative Common Joined RejectNegative
-frandom-seed=<string> Make compile reproducible using <string>
freduce-all-givs freduce-all-givs
Common Common
...@@ -444,6 +461,7 @@ Common ...@@ -444,6 +461,7 @@ Common
fsched-verbose= fsched-verbose=
Common RejectNegative Joined Common RejectNegative Joined
-fsched-verbose=<number> Set the verbosity level of the scheduler
fsched2-use-superblocks fsched2-use-superblocks
Common Common
...@@ -483,9 +501,11 @@ Common ...@@ -483,9 +501,11 @@ Common
fstack-limit-register= fstack-limit-register=
Common RejectNegative Joined Common RejectNegative Joined
-fstack-limit-register=<register> Trap if the stack goes past <register>
fstack-limit-symbol= fstack-limit-symbol=
Common RejectNegative Joined Common RejectNegative Joined
-fstack-limit-symbol=<name> Trap if the stack goes past symbol <name>
fstrength-reduce fstrength-reduce
Common Common
...@@ -507,6 +527,7 @@ Common ...@@ -507,6 +527,7 @@ Common
ftls-model= ftls-model=
Common Joined RejectNegative Common Joined RejectNegative
-ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec] Set the default thread-local storage code generation model
ftracer ftracer
Common Common
...@@ -555,23 +576,30 @@ Common Joined ...@@ -555,23 +576,30 @@ Common Joined
o o
Common Joined Separate Common Joined Separate
-o <file> Place output into <file>
p p
Common Common
Enable function profiling
pedantic pedantic
Common Common
Issue warnings needed for strict compliance to the standard
pedantic-errors pedantic-errors
Common Common
Like -pedantic but issue them as errors
quiet quiet
Common Common
Do not display functions compiled or elapsed time
version version
Common Common
Display the compiler's version
w w
Common Common
Suppress warnings
; This comment is to ensure we retain the blank line above. ; This comment is to ensure we retain the blank line above.
...@@ -21,6 +21,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -21,6 +21,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "intl.h"
#include "coretypes.h" #include "coretypes.h"
#include "tm.h" #include "tm.h"
#include "tree.h" #include "tree.h"
...@@ -136,6 +137,8 @@ static char *write_langs (unsigned int lang_mask); ...@@ -136,6 +137,8 @@ static char *write_langs (unsigned int lang_mask);
static void complain_wrong_lang (const char *, const struct cl_option *, static void complain_wrong_lang (const char *, const struct cl_option *,
unsigned int lang_mask); unsigned int lang_mask);
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, size_t item_width);
static void print_help (void);
/* 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
...@@ -177,7 +180,7 @@ find_opt (const char *input, int lang_mask) ...@@ -177,7 +180,7 @@ find_opt (const char *input, int lang_mask)
{ {
md = (mn + mx) / 2; md = (mn + mx) / 2;
opt_len = cl_options[md].opt_len; 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) if (comp < 0)
mx = md; mx = md;
...@@ -197,7 +200,7 @@ find_opt (const char *input, int lang_mask) ...@@ -197,7 +200,7 @@ find_opt (const char *input, int lang_mask)
const struct cl_option *opt = &cl_options[mn]; const struct cl_option *opt = &cl_options[mn];
/* Is this switch a prefix of the input? */ /* 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 /* If language is OK, and the match is exact or the switch
takes a joined argument, return it. */ takes a joined argument, return it. */
...@@ -374,7 +377,7 @@ handle_option (const char **argv, unsigned int lang_mask) ...@@ -374,7 +377,7 @@ handle_option (const char **argv, unsigned int lang_mask)
value = integral_argument (arg); value = integral_argument (arg);
if (value == -1) 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); option->opt_text);
goto done; goto done;
} }
...@@ -612,7 +615,7 @@ common_handle_option (size_t scode, const char *arg, ...@@ -612,7 +615,7 @@ common_handle_option (size_t scode, const char *arg,
abort (); abort ();
case OPT__help: case OPT__help:
display_help (); print_help ();
exit_after_options = true; exit_after_options = true;
break; break;
...@@ -1477,3 +1480,83 @@ fast_math_flags_set_p (void) ...@@ -1477,3 +1480,83 @@ fast_math_flags_set_p (void)
&& flag_finite_math_only && flag_finite_math_only
&& !flag_errno_math); && !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); ...@@ -26,6 +26,7 @@ extern void decode_options (unsigned int argc, const char **argv);
struct cl_option struct cl_option
{ {
const char *opt_text; const char *opt_text;
const char *help;
unsigned short back_chain; unsigned short back_chain;
unsigned char opt_len; unsigned char opt_len;
unsigned int flags; unsigned int flags;
......
...@@ -37,7 +37,13 @@ ${AWK} ' ...@@ -37,7 +37,13 @@ ${AWK} '
# Ignore comments and blank lines # Ignore comments and blank lines
/^[ \t]*(;|$)/ { next } /^[ \t]*(;|$)/ { next }
# Note that RS="" falls foul of gawk 3.1.2 bugs # 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} ' ' "$@" | ${SORT} | ${AWK} '
function switch_flags (flags, result) function switch_flags (flags, result)
{ {
...@@ -74,6 +80,7 @@ ${AWK} ' ...@@ -74,6 +80,7 @@ ${AWK} '
} else { } else {
opts[n_opts] = $1 opts[n_opts] = $1
flags[n_opts] = $2 flags[n_opts] = $2
help[n_opts] = $3
n_opts++; n_opts++;
} }
} }
...@@ -86,6 +93,7 @@ ${AWK} ' ...@@ -86,6 +93,7 @@ ${AWK} '
comma = "," comma = ","
print "/* This file is auto-generated by opts.sh. */\n" > c_file 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 \"" h_file "\"" >> c_file
print "#include \"opts.h\"\n" >> c_file print "#include \"opts.h\"\n" >> c_file
print "const char * const lang_names[] =\n{" >> c_file print "const char * const lang_names[] =\n{" >> c_file
...@@ -140,10 +148,15 @@ ${AWK} ' ...@@ -140,10 +148,15 @@ ${AWK} '
if (i + 1 == n_opts) if (i + 1 == n_opts)
comma = "" comma = ""
if (help[i] == "")
hlp = "0"
else
hlp = "N_(\"" help[i] "\")";
printf(" %s,%s/* -%s */\n", enum, s, opts[i]) >> h_file printf(" %s,%s/* -%s */\n", enum, s, opts[i]) >> h_file
printf(" { \"%s\", (unsigned short) %s, %u,\n\t%s }%s\n", printf(" { \"-%s\",\n %s,\n %s, %u, %s }%s\n",
opts[i], back_chain[i], len, switch_flags(flags[i]), opts[i], hlp, back_chain[i], len,
comma) >> c_file switch_flags(flags[i]), comma) >> c_file
} }
print " N_OPTS\n};" >> h_file print " N_OPTS\n};" >> h_file
......
...@@ -3942,18 +3942,6 @@ display_help (void) ...@@ -3942,18 +3942,6 @@ display_help (void)
unsigned long i; unsigned long i;
const char *lang; 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--;) for (i = ARRAY_SIZE (f_options); i--;)
{ {
const char *description = f_options[i].description; const char *description = f_options[i].description;
...@@ -3963,8 +3951,6 @@ display_help (void) ...@@ -3963,8 +3951,6 @@ display_help (void)
f_options[i].string, _(description)); 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--;) for (i = LAST_PARAM; i--;)
{ {
const char *description = compiler_params[i].help; const char *description = compiler_params[i].help;
...@@ -3976,9 +3962,6 @@ display_help (void) ...@@ -3976,9 +3962,6 @@ display_help (void)
length > 0 ? length : 1, " ", length > 0 ? length : 1, " ",
_(description)); _(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--;) for (i = ARRAY_SIZE (W_options); i--;)
{ {
...@@ -3989,15 +3972,6 @@ display_help (void) ...@@ -3989,15 +3972,6 @@ display_help (void)
W_options[i].string, _(description)); 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--;) for (i = ARRAY_SIZE (debug_args); i--;)
{ {
if (debug_args[i].description != NULL) if (debug_args[i].description != NULL)
...@@ -4005,16 +3979,6 @@ display_help (void) ...@@ -4005,16 +3979,6 @@ display_help (void)
debug_args[i].arg, _(debug_args[i].description)); 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; undoc = 0;
lang = "language"; lang = "language";
......
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