c-opts.c (print_help): Remove.
authorNeil Booth <neil@daikokuya.co.uk>
Tue, 15 Jul 2003 05:48:16 +0000 (05:48 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Tue, 15 Jul 2003 05:48:16 +0000 (05:48 +0000)
* c-opts.c (print_help): Remove.
(c_common_handle_option): Don't handle --help.
* c.opt: Document some options.
(--help): Remove.
* opts.c (print_filtered_help): New.
(print_help): Use it.

From-SVN: r69383

gcc/ChangeLog
gcc/c-opts.c
gcc/c.opt
gcc/opts.c

index d4a576014fe62c3b078fc17c9bd24661fdf261fc..0b94a6e1b862442b4d0ea4baf6af921386620b25 100644 (file)
@@ -1,3 +1,12 @@
+2003-07-15  Neil Booth  <neil@daikokuya.co.uk>
+
+       * c-opts.c (print_help): Remove.
+       (c_common_handle_option): Don't handle --help.
+       * c.opt: Document some options.
+       (--help): Remove.
+       * opts.c (print_filtered_help): New.
+       (print_help): Use it.
+
 2003-07-14  Geoffrey Keating  <geoffk@apple.com>
 
        * c-common.c (c_common_type_for_mode): Handle V4DFmode.
index 5bc88f92d285fea640b7dcdbdd8685cedb3581f6..3925c445d6846f245a1d92968aed8c40e481ca25 100644 (file)
@@ -99,7 +99,6 @@ static size_t include_cursor;
 static bool permit_fortran_options;
 
 static void set_Wimplicit (int);
-static void print_help (void);
 static void handle_OPT_d (const char *);
 static void set_std_cxx98 (int);
 static void set_std_c89 (int, int);
@@ -255,10 +254,6 @@ c_common_handle_option (size_t scode, const char *arg, int value)
       result = permit_fortran_options;
       break;
 
-    case OPT__help:
-      print_help ();
-      break;
-
     case OPT__output_pch_:
       pch_file = arg;
       break;
@@ -1538,91 +1533,3 @@ handle_OPT_d (const char *arg)
        break;
       }
 }
-
-/* Handle --help output.  */
-static void
-print_help (void)
-{
-  /* To keep the lines from getting too long for some compilers, limit
-     to about 500 characters (6 lines) per chunk.  */
-  fputs (_("\
-Switches:\n\
-  -include <file>           Include the contents of <file> before other files\n\
-  -imacros <file>           Accept definition of macros in <file>\n\
-  -iprefix <path>           Specify <path> as a prefix for next two options\n\
-  -iwithprefix <dir>        Add <dir> to the end of the system include path\n\
-  -iwithprefixbefore <dir>  Add <dir> to the end of the main include path\n\
-  -isystem <dir>            Add <dir> to the start of the system include path\n\
-"), stdout);
-  fputs (_("\
-  -idirafter <dir>          Add <dir> to the end of the system include path\n\
-  -I <dir>                  Add <dir> to the end of the main include path\n\
-  -I-                       Fine-grained include path control; see info docs\n\
-  -nostdinc                 Do not search system include directories\n\
-                             (dirs specified with -isystem will still be used)\n\
-  -nostdinc++               Do not search system include directories for C++\n\
-  -o <file>                 Put output into <file>\n\
-"), stdout);
-  fputs (_("\
-  -trigraphs                Support ISO C trigraphs\n\
-  -std=<std name>           Specify the conformance standard; one of:\n\
-                            gnu89, gnu99, c89, c99, iso9899:1990,\n\
-                            iso9899:199409, iso9899:1999, c++98\n\
-  -w                        Inhibit warning messages\n\
-  -W[no-]trigraphs          Warn if trigraphs are encountered\n\
-  -W[no-]comment{s}         Warn if one comment starts inside another\n\
-"), stdout);
-  fputs (_("\
-  -W[no-]traditional        Warn about features not present in traditional C\n\
-  -W[no-]undef              Warn if an undefined macro is used by #if\n\
-  -W[no-]import             Warn about the use of the #import directive\n\
-"), stdout);
-  fputs (_("\
-  -W[no-]error              Treat all warnings as errors\n\
-  -W[no-]system-headers     Do not suppress warnings from system headers\n\
-  -W[no-]all                Enable most preprocessor warnings\n\
-"), stdout);
-  fputs (_("\
-  -M                        Generate make dependencies\n\
-  -MM                       As -M, but ignore system header files\n\
-  -MD                       Generate make dependencies and compile\n\
-  -MMD                      As -MD, but ignore system header files\n\
-  -MF <file>                Write dependency output to the given file\n\
-  -MG                       Treat missing header file as generated files\n\
-"), stdout);
-  fputs (_("\
-  -MP                      Generate phony targets for all headers\n\
-  -MQ <target>              Add a MAKE-quoted target\n\
-  -MT <target>              Add an unquoted target\n\
-"), stdout);
-  fputs (_("\
-  -D<macro>                 Define a <macro> with string '1' as its value\n\
-  -D<macro>=<val>           Define a <macro> with <val> as its value\n\
-  -A<question>=<answer>     Assert the <answer> to <question>\n\
-  -A-<question>=<answer>    Disable the <answer> to <question>\n\
-  -U<macro>                 Undefine <macro> \n\
-  -v                        Display the version number\n\
-"), stdout);
-  fputs (_("\
-  -H                        Print the name of header files as they are used\n\
-  -C                        Do not discard comments\n\
-  -dM                       Display a list of macro definitions active at end\n\
-  -dD                       Preserve macro definitions in output\n\
-  -dN                       As -dD except that only the names are preserved\n\
-  -dI                       Include #include directives in the output\n\
-"), stdout);
-  fputs (_("\
-  -f[no-]preprocessed       Treat the input file as already preprocessed\n\
-  -ftabstop=<number>        Distance between tab stops for column reporting\n\
-  -ftarget-charset=<c>      Convert all strings and character constants\n\
-                            to character set <c>\n\
-  -ftarget-wide-charset=<c> Convert all wide strings and character constants\n\
-                            to character set <c>\n\
-"), stdout);
-  fputs (_("\
-  -isysroot <dir>           Set <dir> to be the system root directory\n\
-  -P                        Do not generate #line directives\n\
-  -remap                    Remap file names when including files\n\
-  --help                    Display this information\n\
-"), stdout);
-}
index 64e9fe02ddd0989a07f8c25425e4105b6571cda0..ca0c1d817213bbbc5dcaadd4905c171de12801cc 100644 (file)
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -67,71 +67,86 @@ C++
 Language
 ObjC++
 
--help
-C ObjC C++ ObjC++
-
 -output-pch=
 C ObjC C++ ObjC++ Joined Separate
 
 A
 C ObjC C++ ObjC++ Joined Separate
+-A<question>=<answer>  Assert the <answer> to <question>.  Putting '-' before <question> disables the <answer> to <question>
 
 C
 C ObjC C++ ObjC++
+Do not discard comments
 
 CC
 C ObjC C++ ObjC++
+Do not discard comments in macro expansions
 
 D
 C ObjC C++ ObjC++ Joined Separate
+-D<macro>[=<val>]      Define a <macro> with <val> as its value.  If just <macro> is given, <val> is taken to be 1
 
 E
 C ObjC C++ ObjC++
 
 H
 C ObjC C++ ObjC++
+Print the name of header files as they are used
 
 I
 C ObjC C++ ObjC++ Joined Separate
+-I <dir>       Add <dir> to the end of the main include path.  -I- gives more include path control; see info documentation
 
 M
 C ObjC C++ ObjC++
+Generate make dependencies
 
 MD
 C ObjC C++ ObjC++ Separate
+Generate make dependencies and compile
 
 MF
 C ObjC C++ ObjC++ Joined Separate
+-MF <file>     Write dependency output to the given file
 
 MG
 C ObjC C++ ObjC++
+Treat missing header files as generated files
 
 MM
 C ObjC C++ ObjC++
+Like -M but ignore system header files
 
 MMD
 C ObjC C++ ObjC++ Separate
+Like -MD but ignore system header files
 
 MP
 C ObjC C++ ObjC++
+Generate phony targets for all headers
 
 MQ
 C ObjC C++ ObjC++ Joined Separate
+-MQ <target>   Add a MAKE-quoted target
 
 MT
 C ObjC C++ ObjC++ Joined Separate
+-MT <target>   Add an unquoted target
 
 P
 C ObjC C++ ObjC++
+Do not generate #line directives
 
 U
 C ObjC C++ ObjC++ Joined Separate
+-U<macro>      Undefine <macro>
 
 Wabi
 C++ ObjC++
 
 Wall
 C ObjC C++ ObjC++
+Enable most preprocessor warnings
 
 Wbad-function-cast
 C ObjC
@@ -144,9 +159,11 @@ C ObjC C++ ObjC++
 
 Wcomment
 C ObjC C++ ObjC++
+Warn about possibly nested block comments, and C++ comments spanning more than one physical line
 
 Wcomments
 C ObjC C++ ObjC++
+Synonym for -Wcomment
 
 Wconversion
 C ObjC C++ ObjC++
@@ -165,9 +182,11 @@ C++ ObjC++
 
 Wendif-labels
 C ObjC C++ ObjC++
+Warn about stray tokens after #elif and #endif
 
 Werror
 C ObjC C++ ObjC++
+; Documented in common.opt
 
 Werror-implicit-function-declaration
 C ObjC RejectNegative
@@ -207,6 +226,7 @@ C ObjC
 
 Wimport
 C ObjC C++ ObjC++
+Warn about uses of the #import directive
 
 Winvalid-offsetof
 C++ ObjC++
@@ -294,24 +314,29 @@ C++ ObjC++
 
 Wsystem-headers
 C ObjC C++ ObjC++
+Do not suppress warnings from system headers
 
 Wtraditional
 C ObjC
+Warn about features not present in traditional C
 
 Wtrigraphs
 C ObjC C++ ObjC++
+Warn if trigraphs are encountered that might affect the meaning of the program
 
 Wundeclared-selector
 ObjC ObjC++
 
 Wundef
 C ObjC C++ ObjC++
+Warn if an undefined macro is used in an #if directive
 
 Wunknown-pragmas
 C ObjC C++ ObjC++
 
 Wunused-macros
 C ObjC C++ ObjC++
+Warn about macros defined in the main file that are not used
 
 Wwrite-strings
 C ObjC C++ ObjC++
@@ -321,6 +346,7 @@ C ObjC C++ ObjC++
 
 d
 C ObjC C++ ObjC++ Joined
+; Documented in common.opt.  FIXME - what about -dI, -dD, -dN and -dD?
 
 fabi-version=
 C++ ObjC++ Joined UInteger
@@ -363,6 +389,7 @@ C++ ObjC++
 
 fdollars-in-identifiers
 C ObjC C++ ObjC++
+Permit '$' as an identifier character
 
 fdump-
 C ObjC C++ ObjC++ Joined RejectNegative
@@ -378,6 +405,7 @@ C++ ObjC++
 
 fexec-charset=
 C ObjC C++ ObjC++ Joined RejectNegative
+-fexec-charset=<cset>  Convert all strings and character constants to character set <cset>
 
 fexternal-templates
 C++ ObjC++
@@ -459,6 +487,7 @@ C++ ObjC++
 
 fpreprocessed
 C ObjC C++ ObjC++
+Treat the input file as already preprocessed
 
 frepo
 C++ ObjC++
@@ -495,6 +524,7 @@ C++ ObjC++
 
 ftabstop=
 C ObjC C++ ObjC++ Joined RejectNegative UInteger
+-ftabstop=<number>     Distance between tab stops for column reporting
 
 ftemplate-depth-
 C++ ObjC++ Joined RejectNegative UInteger 
@@ -522,6 +552,7 @@ C++ ObjC++
 
 fwide-exec-charset=
 C ObjC C++ ObjC++ Joined RejectNegative
+-fwide-exec-charset=<cset>     Convert all wide strings and character constants to character set <cset>
 
 fxref
 C++ ObjC++
@@ -531,104 +562,137 @@ ObjC ObjC++
 
 idirafter
 C ObjC C++ ObjC++ Joined Separate
+-idirafter <dir>       Add <dir> to the end of the system include path
 
 imacros
 C ObjC C++ ObjC++ Joined Separate
+-imacros <file>        Accept definition of macros in <file>
 
 include
 C ObjC C++ ObjC++ Joined Separate
+-include <file>        Include the contents of <file> before other files
 
 iprefix
 C ObjC C++ ObjC++ Joined Separate
+-iprefix <path>        Specify <path> as a prefix for next two options
 
 isysroot
 C ObjC C++ ObjC++ Joined Separate
+-isysroot <dir>        Set <dir> to be the system root directory
 
 isystem
 C ObjC C++ ObjC++ Joined Separate
+-isystem <dir> Add <dir> to the start of the system include path
 
 iwithprefix
 C ObjC C++ ObjC++ Joined Separate
+-iwithprefix <dir>     Add <dir> to the end of the system include path
 
 iwithprefixbefore
 C ObjC C++ ObjC++ Joined Separate
+-iwithprefixbefore <dir>       Add <dir> to the end of the main include path
 
 lang-asm
 C
+For internal use only
 
 lang-objc
 C ObjC C++ ObjC++
+For internal use only
 
 nostdinc
 C ObjC C++ ObjC++
+Do not search standard system include directories (those specified with -isystem will still be used)
 
 nostdinc++
-C ObjC C++ ObjC++
+C++ ObjC++
+Do not search standard system include directories for C++
 
 o
 C ObjC C++ ObjC++ Joined Separate
+; Documented in common.opt
 
 pedantic
 C ObjC C++ ObjC++
+; Documented in common.opt
 
 pedantic-errors
 C ObjC C++ ObjC++
+; Documented in common.opt
 
 print-objc-runtime-info
 ObjC ObjC++
 
 remap
 C ObjC C++ ObjC++
+Remap file names when including files
 
 std=c++98
 C++ ObjC++
+Conform to the ISO 1998 C++ standard
 
 std=c89
 C ObjC
+Conform to the ISO 1990 C standard
 
 std=c99
 C ObjC
+Conform to the ISO 1999 C standard
 
 std=c9x
 C ObjC
+Deprecated in favor of -std=c99
 
 std=gnu++98
 C++ ObjC++
+Conform to the ISO 1998 C++ standard with GNU extensions
 
 std=gnu89
 C ObjC
+Conform to the ISO 1990 C standard with GNU extensions
 
 std=gnu99
 C ObjC
+Conform to the ISO 1999 C standard with GNU extensions
 
 std=gnu9x
 C ObjC
+Deprecated in favor of -std=gnu99
 
 std=iso9899:1990
 C ObjC
+Deprecated in favor of -std=c89
 
 std=iso9899:199409
 C ObjC
+Conform to the ISO 1990 C standard as amended in 1994
 
 std=iso9899:1999
 C ObjC
+Deprecated in favor of -std=c99
 
 std=iso9899:199x
 C ObjC
+Deprecated in favor of -std=c99
 
 traditional-cpp
 C ObjC C++ ObjC++
+Enable traditional preprocessing
 
 trigraphs
 C ObjC C++ ObjC++
+-trigraphs     Support ISO C trigraphs
 
 undef
 C ObjC C++ ObjC++
+Do not predefine system-specific and GCC-specific macros
 
 v
 C ObjC C++ ObjC++
+Enable verbose output
 
 w
 C ObjC C++ ObjC++
+; Documented in common.opt
 
 ; This comment is to ensure we retain the blank line above.
index 64f5ec6cda3202e977ad323d288663f208a3a04d..7a203dcc2ec3ea76fcca8c622a6d7c3a039d2dad 100644 (file)
@@ -139,6 +139,7 @@ static void complain_wrong_lang (const char *, const struct cl_option *,
 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 print_help (void);
+static void print_filtered_help (unsigned int flag);
 
 /* Perform a binary search to find which option the command-line INPUT
    matches.  Returns its index in the option array, and N_OPTS
@@ -1484,17 +1485,46 @@ fast_math_flags_set_p (void)
 /* Output --help text.  */
 static void
 print_help (void)
+{
+  size_t i;
+
+  puts (_("The following options are language-independent:\n"));
+
+  print_filtered_help (CL_COMMON);
+
+  for (i = 0; lang_names[i]; i++)
+    {
+      printf (_("\nThe %s front end recognizes the following options:\n"),
+             lang_names[i]);
+      print_filtered_help (1U << i);
+    }
+
+  puts ( "\n" );
+  display_help ();
+}
+
+/* Print help for a specific front-end, etc.  */
+static void
+print_filtered_help (unsigned int flag)
 {
   size_t i, len;
+  unsigned int filter;
 
-  puts (_("\nThe following options are language-independent:\n"));
+  /* Don't print COMMON options twice.  */
+  filter = flag;
+  if (flag != CL_COMMON)
+    filter |= CL_COMMON;
 
   for (i = 0; i < cl_options_count; i++)
     {
-      const char *help = cl_options[i].help;
+      const char *help;
       const char *opt, *tab;
 
+      if ((cl_options[i].flags & filter) != flag)
+       continue;
+
       /* During transition, ignore switches with no help.  */
+      help = cl_options[i].help;
       if (!help)
        continue;
 
@@ -1516,9 +1546,6 @@ print_help (void)
 
       wrap_help (help, opt, len);
     }
-
-  puts ( "\n" );
-  display_help ();
 }
 
 /* Output ITEM, of length ITEM_WIDTH, in the left column, followed by