Commit 40f943dd by Nick Clifton Committed by Nick Clifton

Improve --help support.

From-SVN: r21141
parent 0650ddf4
Tue Jul 14 14:15:30 1998 Nick Clifton <nickc@cygnus.com>
* gcc.c: Remove ANSI-C ism from --help code.
* toplev.c: Support --help with USE_CPPLIB.
Tue Jul 14 14:46:08 1998 Jeffrey A Law (law@cygnus.com) Tue Jul 14 14:46:08 1998 Jeffrey A Law (law@cygnus.com)
* mn10300.md (movsi, movsf, movdi, movdf): Remove "x" from I -> a * mn10300.md (movsi, movsf, movdi, movdf): Remove "x" from I -> a
......
...@@ -2444,9 +2444,9 @@ display_help () ...@@ -2444,9 +2444,9 @@ display_help ()
printf (" -print-multi-directory Display the root directory for versions of libgcc\n"); printf (" -print-multi-directory Display the root directory for versions of libgcc\n");
printf (" -print-multi-lib Display the mapping between command line options and\n"); printf (" -print-multi-lib Display the mapping between command line options and\n");
printf (" multiple library search directories\n"); printf (" multiple library search directories\n");
printf (" -Wa,<text> Pass <text> on to the assembler\n"); printf (" -Wa,<options> Pass comma-separated <options> on to the assembler\n");
printf (" -Wp,<text> Pass <text> on to the preprocessor\n"); printf (" -Wp,<options> Pass comma-separated <options> on to the preprocessor\n");
printf (" -Wl,<text> Pass <text> on to the linker\n"); printf (" -Wl,<options> Pass comma-separated <options> on to the linker\n");
printf (" -Xlinker <arg> Pass <arg> on to the linker\n"); printf (" -Xlinker <arg> Pass <arg> on to the linker\n");
printf (" -save-temps Do not delete intermediate files\n"); printf (" -save-temps Do not delete intermediate files\n");
printf (" -pipe Use pipes rather than intermediate files\n"); printf (" -pipe Use pipes rather than intermediate files\n");
...@@ -2459,7 +2459,7 @@ display_help () ...@@ -2459,7 +2459,7 @@ display_help ()
printf (" -S Compile only; do not assemble or link\n"); printf (" -S Compile only; do not assemble or link\n");
printf (" -c Compile and assemble, but do not link\n"); printf (" -c Compile and assemble, but do not link\n");
printf (" -o <file> Place the output into <file>\n"); printf (" -o <file> Place the output into <file>\n");
printf (" -x <language> Specifiy the language of the following input files\n"); printf (" -x <language> Specify the language of the following input files\n");
printf (" Permissable languages include: c c++ assembler none\n"); printf (" Permissable languages include: c c++ assembler none\n");
printf (" 'none' means revert to the default behaviour of\n"); printf (" 'none' means revert to the default behaviour of\n");
printf (" guessing the language based on the file's extension\n"); printf (" guessing the language based on the file's extension\n");
...@@ -2473,29 +2473,59 @@ display_help () ...@@ -2473,29 +2473,59 @@ display_help ()
sub-processes. */ sub-processes. */
} }
#define ADD_XXX_OPTION(name) \ static void
static void \ add_preprocessor_option (option, len)
add_##name##_option (option, len) \ char * option;
char * option; \ int len;
int len; \ {
{ \ n_preprocessor_options++;
n_##name##_options++; \
\ if (! preprocessor_options)
if (! ##name##_options) \ preprocessor_options
name##_options \ = (char **) xmalloc (n_preprocessor_options * sizeof (char **));
= (char **) xmalloc (n_##name##_options * sizeof (char **)); \ else
else \ preprocessor_options
name##_options \ = (char **) xrealloc (preprocessor_options,
= (char **) xrealloc (##name##_options, \ n_preprocessor_options * sizeof (char **));
n_##name##_options * sizeof (char **)); \
\ preprocessor_options [n_preprocessor_options - 1] = save_string (option, len);
name##_options [n_##name##_options - 1] = save_string (option, len); \ }
static void
add_assembler_option (option, len)
char * option;
int len;
{
n_assembler_options++;
if (! assembler_options)
assembler_options
= (char **) xmalloc (n_assembler_options * sizeof (char **));
else
assembler_options
= (char **) xrealloc (assembler_options,
n_assembler_options * sizeof (char **));
assembler_options [n_assembler_options - 1] = save_string (option, len);
} }
ADD_XXX_OPTION (preprocessor)
ADD_XXX_OPTION (assembler)
ADD_XXX_OPTION (linker)
static void
add_linker_option (option, len)
char * option;
int len;
{
n_linker_options++;
if (! linker_options)
linker_options
= (char **) xmalloc (n_linker_options * sizeof (char **));
else
linker_options
= (char **) xrealloc (linker_options,
n_linker_options * sizeof (char **));
linker_options [n_linker_options - 1] = save_string (option, len);
}
/* Create the vector `switches' and its contents. /* Create the vector `switches' and its contents.
Store its length in `n_switches'. */ Store its length in `n_switches'. */
...@@ -3089,7 +3119,7 @@ process_command (argc, argv) ...@@ -3089,7 +3119,7 @@ process_command (argc, argv)
infiles[n_infiles].language = "c"; infiles[n_infiles].language = "c";
infiles[n_infiles++].name = "help-dummy"; infiles[n_infiles++].name = "help-dummy";
/* Preserve the --help switch so that it can bet caught by the /* Preserve the --help switch so that it can be caught by the
cc1 spec string. */ cc1 spec string. */
switches[n_switches].part1 = "--help"; switches[n_switches].part1 = "--help";
switches[n_switches].args = 0; switches[n_switches].args = 0;
......
...@@ -858,7 +858,7 @@ lang_independent_options f_options[] = ...@@ -858,7 +858,7 @@ lang_independent_options f_options[] =
{"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1, {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
"Allow speculative motion of more loads" }, "Allow speculative motion of more loads" },
{"branch-count-reg",&flag_branch_on_count_reg, 1, {"branch-count-reg",&flag_branch_on_count_reg, 1,
"Replace add,compare,branch with branch on count register"}, "Replace add,compare,branch with branch on count reg"},
#endif /* HAIFA */ #endif /* HAIFA */
{"pic", &flag_pic, 1, {"pic", &flag_pic, 1,
"Generate position independent code, if possible"}, "Generate position independent code, if possible"},
...@@ -1030,6 +1030,7 @@ documented_lang_options[] = ...@@ -1030,6 +1030,7 @@ documented_lang_options[] =
/* These are for languages with USE_CPPLIB. */ /* These are for languages with USE_CPPLIB. */
/* These options are already documented in cpplib.c */ /* These options are already documented in cpplib.c */
{ "--help", "" },
{ "-A", "" }, { "-A", "" },
{ "-D", "" }, { "-D", "" },
{ "-I", "" }, { "-I", "" },
...@@ -3940,8 +3941,10 @@ display_help () ...@@ -3940,8 +3941,10 @@ display_help ()
long i; long i;
char * lang; char * lang;
#ifndef USE_CPPLIB
printf ("Usage: %s input [switches]\n", progname); printf ("Usage: %s input [switches]\n", progname);
printf ("Switches:\n"); printf ("Switches:\n");
#endif
printf (" -ffixed-<register> Mark <register> as being unavailable to the compiler\n"); 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-used-<register> Mark <register> as being corrupted by function calls\n");
printf (" -fcall-saved-<register> Mark <register> as being preserved across functions\n"); printf (" -fcall-saved-<register> Mark <register> as being preserved across functions\n");
...@@ -3982,7 +3985,7 @@ display_help () ...@@ -3982,7 +3985,7 @@ display_help ()
#endif #endif
printf (" -o <file> Place output into <file> \n"); printf (" -o <file> Place output into <file> \n");
printf (" -G <number> Put global and static data smaller than <number>\n"); printf (" -G <number> Put global and static data smaller than <number>\n");
printf (" bytes into a special section [on some targets]\n"); printf (" bytes into a special section (on some targets)\n");
for (i = NUM_ELEM (debug_args); i--;) for (i = NUM_ELEM (debug_args); i--;)
{ {
...@@ -4318,6 +4321,13 @@ main (argc, argv, envp) ...@@ -4318,6 +4321,13 @@ main (argc, argv, envp)
/* If the option is valid for *some* language, /* If the option is valid for *some* language,
treat it as valid even if this language doesn't understand it. */ treat it as valid even if this language doesn't understand it. */
int strings_processed = lang_decode_option (argc - i, argv + i); int strings_processed = lang_decode_option (argc - i, argv + i);
if (!strcmp (argv[i], "--help"))
{
display_help ();
exit (0);
}
if (strings_processed != 0) if (strings_processed != 0)
i += strings_processed - 1; i += strings_processed - 1;
} }
......
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