aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/common.opt1
-rw-r--r--gcc/doc/sourcebuild.texi9
-rw-r--r--gcc/java/ChangeLog4
-rw-r--r--gcc/java/lang.opt4
-rw-r--r--gcc/opts.c144
-rw-r--r--gcc/opts.sh2
-rw-r--r--gcc/params.def18
-rw-r--r--gcc/toplev.c12
9 files changed, 163 insertions, 47 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fea014e..98200dd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+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>
PR target/11556
diff --git a/gcc/common.opt b/gcc/common.opt
index 7f1e995..65341d1 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -28,6 +28,7 @@ Display this information
-param
Common Separate
+--param <param>=<value> Set paramter <param> to value. See below for a complete list of parameters
-target-help
Common
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 593ae1f..59ab3eb 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -601,12 +601,9 @@ Move to the stage directory files not included in @code{stagestuff} in
@item lang.opt
This file registers the set of switches that the front end accepts on
-the command line. The file format is documented in the file
-@file{c.opt}. These files are processed by the script @file{opts.sh}.
-@item lang-options.h
-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.
+the command line, and their --help text. The file format is
+documented in the file @file{c.opt}. These files are processed by the
+script @file{opts.sh}.
@item lang-specs.h
This file provides entries for @code{default_compilers} in
@file{gcc.c} which override the default of giving an error that a
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index bc27074..df76ce6 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,7 @@
+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>
* lang-options.h: Remove.
diff --git a/gcc/java/lang.opt b/gcc/java/lang.opt
index 6fd0a60..987eb82 100644
--- a/gcc/java/lang.opt
+++ b/gcc/java/lang.opt
@@ -34,7 +34,7 @@ Java
; Documented for C
MD_
-Java
+Java Undocumented
; Documented for C
MF
@@ -46,7 +46,7 @@ Java
; Documented for C
MMD_
-Java
+Java Undocumented
; Documented for C
MP
diff --git a/gcc/opts.c b/gcc/opts.c
index 6e96663..5659d2a 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -128,6 +128,12 @@ bool warn_unused_value;
/* Hack for cooperation between set_Wunused and set_Wextra. */
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 int common_handle_option (size_t scode, const char *arg, int value);
static void handle_param (const char *);
@@ -137,9 +143,11 @@ 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, int item_width);
+static void wrap_help (const char *help, const char *item, unsigned int);
static void print_help (void);
+static void print_param_help (void);
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
matches. Returns its index in the option array, and N_OPTS
@@ -1487,39 +1495,104 @@ static void
print_help (void)
{
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"));
print_filtered_help (CL_COMMON);
+ print_param_help ();
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]);
print_filtered_help (1U << i);
}
- puts ( "\n" );
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. */
static void
print_filtered_help (unsigned int flag)
{
- size_t i, len;
- unsigned int filter;
+ unsigned int i, len, filter, indent = 0;
+ 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. */
- filter = flag;
- if (flag != CL_COMMON)
- filter |= CL_COMMON;
+ for (i = 0; i < cl_options_count; i++)
+ {
+ if ((cl_options[i].flags & filter) != flag)
+ 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++)
{
- const char *help;
- const char *opt, *tab;
-
if ((cl_options[i].flags & filter) != flag)
continue;
@@ -1527,10 +1600,15 @@ print_filtered_help (unsigned int flag)
if (cl_options[i].flags & CL_UNDOCUMENTED)
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;
if (!help)
- continue;
+ help = undocumented_msg;
/* Get the translation. */
help = _(help);
@@ -1550,14 +1628,42 @@ print_filtered_help (unsigned int flag)
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
word-wrapped HELP in a second column. */
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;
remaining = strlen (help);
@@ -1565,6 +1671,8 @@ wrap_help (const char *help, const char *item, int item_width)
do
{
room = columns - 3 - MAX (col_width, item_width);
+ if (room > columns)
+ room = 0;
len = remaining;
if (room < len)
@@ -1577,7 +1685,9 @@ wrap_help (const char *help, const char *item, int item_width)
break;
if (help[i] == ' ')
len = i;
- else if (help[i] == '-')
+ else if ((help[i] == '-' || help[i] == '/')
+ && help[i + 1] != ' '
+ && ISALPHA (help[i - 1]))
len = i + 1;
}
}
diff --git a/gcc/opts.sh b/gcc/opts.sh
index 13cd4c4..871c855 100644
--- a/gcc/opts.sh
+++ b/gcc/opts.sh
@@ -42,7 +42,7 @@ ${AWK} '
# Note that RS="" falls foul of gawk 3.1.2 bugs
/^[^ \t]/ { record = $0
do { getline tmp;
- if (tmp != "" )
+ if (!(tmp ~ "^[ \t]*(;|$)"))
record = record "\034" tmp
} while (tmp != "")
print record
diff --git a/gcc/params.def b/gcc/params.def
index cb527f0..1d50e2b 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -158,11 +158,11 @@ DEFPARAM(PARAM_LARGE_FUNCTION_INSNS,
10000)
DEFPARAM(PARAM_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)
DEFPARAM(PARAM_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)
/* 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"
75)
DEFPARAM(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)
DEFPARAM(TRACER_MIN_BRANCH_RATIO,
"tracer-min-branch-ratio",
"Stop reverse growth if the reverse probability of best edge is less \
-than this threshold (in percents)",
+than this threshold (in percent)",
10)
DEFPARAM(TRACER_MIN_BRANCH_PROBABILITY_FEEDBACK,
"tracer-min-branch-probability-feedback",
"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)
DEFPARAM(TRACER_MIN_BRANCH_PROBABILITY,
"tracer-min-branch-probability",
"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)
/* The maximum number of incoming edges to consider for crossjumping. */
@@ -280,7 +280,7 @@ DEFPARAM(PARAM_MAX_CROSSJUMP_EDGES,
/* The maximum length of path considered in cse. */
DEFPARAM(PARAM_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)
#ifdef ENABLE_GC_ALWAYS_COLLECT
@@ -294,12 +294,12 @@ DEFPARAM(PARAM_MAX_CSE_PATH_LENGTH,
DEFPARAM(GGC_MIN_EXPAND,
"ggc-min-expand",
"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)
DEFPARAM(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)
#undef GGC_MIN_EXPAND_DEFAULT
diff --git a/gcc/toplev.c b/gcc/toplev.c
index cf61228..3bf60111 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -3591,18 +3591,6 @@ display_help (void)
{
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--;)
{
if (debug_args[i].description != NULL)