Commit 2cc98056 by Neil Booth Committed by Neil Booth

common.opt: Document --param.

	* common.opt:  Document --param.
	* opts.c (columns, undocumented_msg): New.
	(print_help): Get number of columns from environment.  Print
	--param help.  Tweak newline handling.
	(print_param_help): New.
	(print_filtered_help): Better handling of duplicates.  Complain
	about undocumented switches.
	(print_switch): New.
	(wrap_help): Improve wrapping, use COLUMNS.
	* opts.sh: Ignore comments in records.
	* params.def: Fix typos and remove trailing periods.
	* toplev.c (display_help): Don't dump --param help.
	* doc/sourcebuild.texi: Update.
java:
	* lang.opt: Don't show -MD_ and -MDD_.

From-SVN: r69581
parent 0e38b30b
2003-07-19 Neil Booth <neil@daikokuya.co.uk>
* common.opt: Document --param.
* opts.c (columns, undocumented_msg): New.
(print_help): Get number of columns from environment. Print
--param help. Tweak newline handling.
(print_param_help): New.
(print_filtered_help): Better handling of duplicates. Complain
about undocumented switches.
(print_switch): New.
(wrap_help): Improve wrapping, use COLUMNS.
* opts.sh: Ignore comments in records.
* params.def: Fix typos and remove trailing periods.
* toplev.c (display_help): Don't dump --param help.
* doc/sourcebuild.texi: Update.
2003-07-18 Richard Henderson <rth@redhat.com> 2003-07-18 Richard Henderson <rth@redhat.com>
PR target/11556 PR target/11556
......
...@@ -28,6 +28,7 @@ Display this information ...@@ -28,6 +28,7 @@ Display this information
-param -param
Common Separate Common Separate
--param <param>=<value> Set paramter <param> to value. See below for a complete list of parameters
-target-help -target-help
Common Common
......
...@@ -601,12 +601,9 @@ Move to the stage directory files not included in @code{stagestuff} in ...@@ -601,12 +601,9 @@ Move to the stage directory files not included in @code{stagestuff} in
@item lang.opt @item lang.opt
This file registers the set of switches that the front end accepts on This file registers the set of switches that the front end accepts on
the command line. The file format is documented in the file the command line, and their --help text. The file format is
@file{c.opt}. These files are processed by the script @file{opts.sh}. documented in the file @file{c.opt}. These files are processed by the
@item lang-options.h script @file{opts.sh}.
This file provides entries for @code{documented_lang_options} in
@file{toplev.c} describing command-line options the front end accepts
for @option{--help} output.
@item lang-specs.h @item lang-specs.h
This file provides entries for @code{default_compilers} in This file provides entries for @code{default_compilers} in
@file{gcc.c} which override the default of giving an error that a @file{gcc.c} which override the default of giving an error that a
......
2003-07-19 Neil Booth <neil@daikokuya.co.uk>
* lang.opt: Don't show -MD_ and -MDD_.
2003-07-18 Neil Booth <neil@daikokuya.co.uk> 2003-07-18 Neil Booth <neil@daikokuya.co.uk>
* lang-options.h: Remove. * lang-options.h: Remove.
......
...@@ -34,7 +34,7 @@ Java ...@@ -34,7 +34,7 @@ Java
; Documented for C ; Documented for C
MD_ MD_
Java Java Undocumented
; Documented for C ; Documented for C
MF MF
...@@ -46,7 +46,7 @@ Java ...@@ -46,7 +46,7 @@ Java
; Documented for C ; Documented for C
MMD_ MMD_
Java Java Undocumented
; Documented for C ; Documented for C
MP MP
......
...@@ -128,6 +128,12 @@ bool warn_unused_value; ...@@ -128,6 +128,12 @@ bool warn_unused_value;
/* Hack for cooperation between set_Wunused and set_Wextra. */ /* Hack for cooperation between set_Wunused and set_Wextra. */
static bool maybe_warn_unused_parameter; static bool maybe_warn_unused_parameter;
/* Columns of --help display. */
static unsigned int columns = 80;
/* What to print when a switch has no documentation. */
static const char undocumented_msg[] = N_("This switch lacks documentation");
static size_t find_opt (const char *, int); static size_t find_opt (const char *, int);
static int common_handle_option (size_t scode, const char *arg, int value); static int common_handle_option (size_t scode, const char *arg, int value);
static void handle_param (const char *); static void handle_param (const char *);
...@@ -137,9 +143,11 @@ static char *write_langs (unsigned int lang_mask); ...@@ -137,9 +143,11 @@ 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, int item_width); static void wrap_help (const char *help, const char *item, unsigned int);
static void print_help (void); static void print_help (void);
static void print_param_help (void);
static void print_filtered_help (unsigned int flag); static void print_filtered_help (unsigned int flag);
static unsigned int print_switch (const char *text, unsigned int indent);
/* 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
...@@ -1487,39 +1495,104 @@ static void ...@@ -1487,39 +1495,104 @@ static void
print_help (void) print_help (void)
{ {
size_t i; size_t i;
const char *p;
GET_ENVIRONMENT (p, "COLUMNS");
if (p)
{
int value = atoi (p);
if (value > 0)
columns = value;
}
puts (_("The following options are language-independent:\n")); puts (_("The following options are language-independent:\n"));
print_filtered_help (CL_COMMON); print_filtered_help (CL_COMMON);
print_param_help ();
for (i = 0; lang_names[i]; i++) for (i = 0; lang_names[i]; i++)
{ {
printf (_("\nThe %s front end recognizes the following options:\n"), printf (_("The %s front end recognizes the following options:\n\n"),
lang_names[i]); lang_names[i]);
print_filtered_help (1U << i); print_filtered_help (1U << i);
} }
puts ( "\n" );
display_help (); display_help ();
} }
/* Print the help for --param. */
static void
print_param_help (void)
{
size_t i;
puts (_("The --param option recognizes the following as parameters:\n"));
for (i = 0; i < LAST_PARAM; i++)
{
const char *help = compiler_params[i].help;
const char *param = compiler_params[i].option;
if (help == NULL || *help == '\0')
help = undocumented_msg;
/* Get the translation. */
help = _(help);
wrap_help (help, param, strlen (param));
}
putchar ('\n');
}
/* Print help for a specific front-end, etc. */ /* Print help for a specific front-end, etc. */
static void static void
print_filtered_help (unsigned int flag) print_filtered_help (unsigned int flag)
{ {
size_t i, len; unsigned int i, len, filter, indent = 0;
unsigned int filter; bool duplicates = false;
const char *help, *opt, *tab;
static char *printed;
if (flag == CL_COMMON)
{
filter = flag;
if (!printed)
printed = xmalloc (cl_options_count);
memset (printed, 0, cl_options_count);
}
else
{
/* Don't print COMMON options twice. */
filter = flag | CL_COMMON;
/* Don't print COMMON options twice. */ for (i = 0; i < cl_options_count; i++)
filter = flag; {
if (flag != CL_COMMON) if ((cl_options[i].flags & filter) != flag)
filter |= CL_COMMON; continue;
/* Skip help for internal switches. */
if (cl_options[i].flags & CL_UNDOCUMENTED)
continue;
/* Skip switches that have already been printed, mark them to be
listed later. */
if (printed[i])
{
duplicates = true;
indent = print_switch (cl_options[i].opt_text, indent);
}
}
if (duplicates)
{
putchar ('\n');
putchar ('\n');
}
}
for (i = 0; i < cl_options_count; i++) for (i = 0; i < cl_options_count; i++)
{ {
const char *help;
const char *opt, *tab;
if ((cl_options[i].flags & filter) != flag) if ((cl_options[i].flags & filter) != flag)
continue; continue;
...@@ -1527,10 +1600,15 @@ print_filtered_help (unsigned int flag) ...@@ -1527,10 +1600,15 @@ print_filtered_help (unsigned int flag)
if (cl_options[i].flags & CL_UNDOCUMENTED) if (cl_options[i].flags & CL_UNDOCUMENTED)
continue; continue;
/* During transition, ignore switches with no help. */ /* Skip switches that have already been printed. */
if (printed[i])
continue;
printed[i] = true;
help = cl_options[i].help; help = cl_options[i].help;
if (!help) if (!help)
continue; help = undocumented_msg;
/* Get the translation. */ /* Get the translation. */
help = _(help); help = _(help);
...@@ -1550,14 +1628,42 @@ print_filtered_help (unsigned int flag) ...@@ -1550,14 +1628,42 @@ print_filtered_help (unsigned int flag)
wrap_help (help, opt, len); wrap_help (help, opt, len);
} }
putchar ('\n');
}
/* Output ITEM, of length ITEM_WIDTH, in the left column, followed by
word-wrapped HELP in a second column. */
static unsigned int
print_switch (const char *text, unsigned int indent)
{
unsigned int len = strlen (text) + 1; /* trailing comma */
if (indent)
{
putchar (',');
if (indent + len > columns)
{
putchar ('\n');
putchar (' ');
indent = 1;
}
}
else
putchar (' ');
putchar (' ');
fputs (text, stdout);
return indent + len + 1;
} }
/* Output ITEM, of length ITEM_WIDTH, in the left column, followed by /* Output ITEM, of length ITEM_WIDTH, in the left column, followed by
word-wrapped HELP in a second column. */ word-wrapped HELP in a second column. */
static void static void
wrap_help (const char *help, const char *item, int item_width) wrap_help (const char *help, const char *item, unsigned int item_width)
{ {
const int columns = 80, col_width = 27; unsigned int col_width = 27;
unsigned int remaining, room, len; unsigned int remaining, room, len;
remaining = strlen (help); remaining = strlen (help);
...@@ -1565,6 +1671,8 @@ wrap_help (const char *help, const char *item, int item_width) ...@@ -1565,6 +1671,8 @@ wrap_help (const char *help, const char *item, int item_width)
do do
{ {
room = columns - 3 - MAX (col_width, item_width); room = columns - 3 - MAX (col_width, item_width);
if (room > columns)
room = 0;
len = remaining; len = remaining;
if (room < len) if (room < len)
...@@ -1577,7 +1685,9 @@ wrap_help (const char *help, const char *item, int item_width) ...@@ -1577,7 +1685,9 @@ wrap_help (const char *help, const char *item, int item_width)
break; break;
if (help[i] == ' ') if (help[i] == ' ')
len = i; len = i;
else if (help[i] == '-') else if ((help[i] == '-' || help[i] == '/')
&& help[i + 1] != ' '
&& ISALPHA (help[i - 1]))
len = i + 1; len = i + 1;
} }
} }
......
...@@ -42,7 +42,7 @@ ${AWK} ' ...@@ -42,7 +42,7 @@ ${AWK} '
# Note that RS="" falls foul of gawk 3.1.2 bugs # Note that RS="" falls foul of gawk 3.1.2 bugs
/^[^ \t]/ { record = $0 /^[^ \t]/ { record = $0
do { getline tmp; do { getline tmp;
if (tmp != "" ) if (!(tmp ~ "^[ \t]*(;|$)"))
record = record "\034" tmp record = record "\034" tmp
} while (tmp != "") } while (tmp != "")
print record print record
......
...@@ -158,11 +158,11 @@ DEFPARAM(PARAM_LARGE_FUNCTION_INSNS, ...@@ -158,11 +158,11 @@ DEFPARAM(PARAM_LARGE_FUNCTION_INSNS,
10000) 10000)
DEFPARAM(PARAM_LARGE_FUNCTION_GROWTH, DEFPARAM(PARAM_LARGE_FUNCTION_GROWTH,
"large-function-growth", "large-function-growth",
"Maximal growth due to inlining of large function (in percents)", "Maximal growth due to inlining of large function (in percent)",
100) 100)
DEFPARAM(PARAM_INLINE_UNIT_GROWTH, DEFPARAM(PARAM_INLINE_UNIT_GROWTH,
"inline-unit-growth", "inline-unit-growth",
"how much can given compilation unit grow because of the inlining (in percents)", "how much can given compilation unit grow because of the inlining (in percent)",
50) 50)
/* The GCSE optimization will be disabled if it would require /* The GCSE optimization will be disabled if it would require
...@@ -253,22 +253,22 @@ must be covered by trace formation. Used when profile feedback is not available" ...@@ -253,22 +253,22 @@ must be covered by trace formation. Used when profile feedback is not available"
75) 75)
DEFPARAM(TRACER_MAX_CODE_GROWTH, DEFPARAM(TRACER_MAX_CODE_GROWTH,
"tracer-max-code-growth", "tracer-max-code-growth",
"Maximal code growth caused by tail duplication (in percents)", "Maximal code growth caused by tail duplication (in percent)",
100) 100)
DEFPARAM(TRACER_MIN_BRANCH_RATIO, DEFPARAM(TRACER_MIN_BRANCH_RATIO,
"tracer-min-branch-ratio", "tracer-min-branch-ratio",
"Stop reverse growth if the reverse probability of best edge is less \ "Stop reverse growth if the reverse probability of best edge is less \
than this threshold (in percents)", than this threshold (in percent)",
10) 10)
DEFPARAM(TRACER_MIN_BRANCH_PROBABILITY_FEEDBACK, DEFPARAM(TRACER_MIN_BRANCH_PROBABILITY_FEEDBACK,
"tracer-min-branch-probability-feedback", "tracer-min-branch-probability-feedback",
"Stop forward growth if the probability of best edge is less than \ "Stop forward growth if the probability of best edge is less than \
this threshold (in percents). Used when profile feedback is available", this threshold (in percent). Used when profile feedback is available",
80) 80)
DEFPARAM(TRACER_MIN_BRANCH_PROBABILITY, DEFPARAM(TRACER_MIN_BRANCH_PROBABILITY,
"tracer-min-branch-probability", "tracer-min-branch-probability",
"Stop forward growth if the probability of best edge is less than \ "Stop forward growth if the probability of best edge is less than \
this threshold (in percents). Used when profile feedback is not available", this threshold (in percent). Used when profile feedback is not available",
50) 50)
/* The maximum number of incoming edges to consider for crossjumping. */ /* The maximum number of incoming edges to consider for crossjumping. */
...@@ -280,7 +280,7 @@ DEFPARAM(PARAM_MAX_CROSSJUMP_EDGES, ...@@ -280,7 +280,7 @@ DEFPARAM(PARAM_MAX_CROSSJUMP_EDGES,
/* The maximum length of path considered in cse. */ /* The maximum length of path considered in cse. */
DEFPARAM(PARAM_MAX_CSE_PATH_LENGTH, DEFPARAM(PARAM_MAX_CSE_PATH_LENGTH,
"max-cse-path-length", "max-cse-path-length",
"The maximum length of path considered in cse.", "The maximum length of path considered in cse",
10) 10)
#ifdef ENABLE_GC_ALWAYS_COLLECT #ifdef ENABLE_GC_ALWAYS_COLLECT
...@@ -294,12 +294,12 @@ DEFPARAM(PARAM_MAX_CSE_PATH_LENGTH, ...@@ -294,12 +294,12 @@ DEFPARAM(PARAM_MAX_CSE_PATH_LENGTH,
DEFPARAM(GGC_MIN_EXPAND, DEFPARAM(GGC_MIN_EXPAND,
"ggc-min-expand", "ggc-min-expand",
"Minimum heap expansion to trigger garbage collection, as \ "Minimum heap expansion to trigger garbage collection, as \
a percentage of the total size of the heap.", a percentage of the total size of the heap",
GGC_MIN_EXPAND_DEFAULT) GGC_MIN_EXPAND_DEFAULT)
DEFPARAM(GGC_MIN_HEAPSIZE, DEFPARAM(GGC_MIN_HEAPSIZE,
"ggc-min-heapsize", "ggc-min-heapsize",
"Minimum heap size before we start collecting garbage, in kilobytes.", "Minimum heap size before we start collecting garbage, in kilobytes",
GGC_MIN_HEAPSIZE_DEFAULT) GGC_MIN_HEAPSIZE_DEFAULT)
#undef GGC_MIN_EXPAND_DEFAULT #undef GGC_MIN_EXPAND_DEFAULT
......
...@@ -3591,18 +3591,6 @@ display_help (void) ...@@ -3591,18 +3591,6 @@ display_help (void)
{ {
unsigned long i; unsigned long i;
for (i = LAST_PARAM; i--;)
{
const char *description = compiler_params[i].help;
const int length = 21 - strlen (compiler_params[i].option);
if (description != NULL && *description != 0)
printf (" --param %s=<value>%.*s%s\n",
compiler_params[i].option,
length > 0 ? length : 1, " ",
_(description));
}
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)
......
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