Commit 4b7091eb by Neil Booth Committed by Neil Booth

Makefile.in (c-opts.o): Update

	* Makefile.in (c-opts.o): Update
	* c-opts.c: Include intl.h.
	(print_help): Move from cppinit.c.  Remove unused options.
	(COMMAND_LINE_OPTIONS): Move more from cppinit.c.
	(missing_arg): Complain for switches without an argument.
	(c_common_decode_option): Reject missing joined arguments.
	Handle new switches from cppinit.c.
	* cppinit.c (COMMAND_LINE_OPTIONS): Move some switches to c-opts.c.
	(cpp_handle_option): Similarly.
	(print_help): Moved to c-opts.c.
	* cpplib.h (struct cpp_options): Remove help_only.
	* gcc.c (cpp_unique_options): Remove -$.
	* doc/cppopts.texi: Undocument -h.

From-SVN: r56155
parent f45f9aed
2002-08-09 Neil Booth <neil@daikokuya.co.uk>
* Makefile.in (c-opts.o): Update
* c-opts.c: Include intl.h.
(print_help): Move from cppinit.c. Remove unused options.
(COMMAND_LINE_OPTIONS): Move more from cppinit.c.
(missing_arg): Complain for switches without an argument.
(c_common_decode_option): Reject missing joined arguments.
Handle new switches from cppinit.c.
* cppinit.c (COMMAND_LINE_OPTIONS): Move some switches to c-opts.c.
(cpp_handle_option): Similarly.
(print_help): Moved to c-opts.c.
* cpplib.h (struct cpp_options): Remove help_only.
* gcc.c (cpp_unique_options): Remove -$.
* doc/cppopts.texi: Undocument -h.
2002-08-08 Jakub Jelinek <jakub@redhat.com> 2002-08-08 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.c (legitimate_constant_p): UNSPEC_TP is not * config/i386/i386.c (legitimate_constant_p): UNSPEC_TP is not
......
...@@ -1241,7 +1241,8 @@ c-pretty-print.o : c-pretty-print.c c-pretty-print.h pretty-print.h \ ...@@ -1241,7 +1241,8 @@ c-pretty-print.o : c-pretty-print.c c-pretty-print.h pretty-print.h \
$(C_COMMON_H) $(CONFIG_H) $(SYSTEM_H) real.h $(C_COMMON_H) $(CONFIG_H) $(SYSTEM_H) real.h
c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_COMMON_H) \ c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_COMMON_H) \
c-pragma.h flags.h toplev.h langhooks.h tree-inline.h diagnostic.h c-pragma.h flags.h toplev.h langhooks.h tree-inline.h diagnostic.h \
intl.h
# A file used by all variants of C and some other languages. # A file used by all variants of C and some other languages.
......
...@@ -29,6 +29,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -29,6 +29,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "langhooks.h" #include "langhooks.h"
#include "tree-inline.h" #include "tree-inline.h"
#include "diagnostic.h" #include "diagnostic.h"
#include "intl.h"
static cpp_options *cpp_opts; static cpp_options *cpp_opts;
...@@ -37,6 +38,8 @@ static size_t parse_option PARAMS ((const char *, int)); ...@@ -37,6 +38,8 @@ static size_t parse_option PARAMS ((const char *, int));
static void set_Wimplicit PARAMS ((int)); static void set_Wimplicit PARAMS ((int));
static void complain_wrong_lang PARAMS ((size_t)); static void complain_wrong_lang PARAMS ((size_t));
static void write_langs PARAMS ((char *, int)); static void write_langs PARAMS ((char *, int));
static void print_help PARAMS ((void));
static void handle_OPT_d PARAMS ((const char *));
#define CL_C_ONLY (1 << 0) /* Only C. */ #define CL_C_ONLY (1 << 0) /* Only C. */
#define CL_OBJC_ONLY (1 << 1) /* Only ObjC. */ #define CL_OBJC_ONLY (1 << 1) /* Only ObjC. */
...@@ -68,15 +71,19 @@ static void write_langs PARAMS ((char *, int)); ...@@ -68,15 +71,19 @@ static void write_langs PARAMS ((char *, int));
If you request an argument with CL_JOINED, CL_SEPARATE or their If you request an argument with CL_JOINED, CL_SEPARATE or their
combination CL_ARG, it is stored in the variable "arg", which is combination CL_ARG, it is stored in the variable "arg", which is
guaranteed non-NULL. It points to the argument either within the guaranteed to be non-NULL and to not be an empty string. It points
argv[] vector or within one of its strings, and so the text is not to the argument either within the argv[] vector or within one of
temporary and copies need not be made. that vector's strings, and so the text is permanent and copies need
not be made. Be sure to add an error message in missing_arg() if
If you use the CL_SEPARATE flag (which is also in CL_ARG) be sure the default is not appropriate. */
to add an error message in missing_arg(). */
#define COMMAND_LINE_OPTIONS \ #define COMMAND_LINE_OPTIONS \
OPT("-help", CL_ALL, OPT__help) \
OPT("C", CL_ALL, OPT_C) \
OPT("CC", CL_ALL, OPT_CC) \
OPT("E", CL_ALL, OPT_E) \ OPT("E", CL_ALL, OPT_E) \
OPT("H", CL_ALL, OPT_H) \
OPT("P", CL_ALL, OPT_P) \
OPT("Wall", CL_ALL, OPT_Wall) \ OPT("Wall", CL_ALL, OPT_Wall) \
OPT("Wbad-function-cast", CL_C, OPT_Wbad_function_cast) \ OPT("Wbad-function-cast", CL_C, OPT_Wbad_function_cast) \
OPT("Wcast-qual", CL_ALL, OPT_Wcast_qual) \ OPT("Wcast-qual", CL_ALL, OPT_Wcast_qual) \
...@@ -138,6 +145,7 @@ static void write_langs PARAMS ((char *, int)); ...@@ -138,6 +145,7 @@ static void write_langs PARAMS ((char *, int));
OPT("Wunused-macros", CL_ALL, OPT_Wunused_macros) \ OPT("Wunused-macros", CL_ALL, OPT_Wunused_macros) \
OPT("Wwrite-strings", CL_ALL, OPT_Wwrite_strings) \ OPT("Wwrite-strings", CL_ALL, OPT_Wwrite_strings) \
OPT("ansi", CL_ALL, OPT_ansi) \ OPT("ansi", CL_ALL, OPT_ansi) \
OPT("d", CL_ALL | CL_JOINED, OPT_d) \
OPT("faccess-control", CL_CXX, OPT_faccess_control) \ OPT("faccess-control", CL_CXX, OPT_faccess_control) \
OPT("fall-virtual", CL_CXX, OPT_fall_virtual) \ OPT("fall-virtual", CL_CXX, OPT_fall_virtual) \
OPT("falt-external-templates",CL_CXX, OPT_falt_external_templates) \ OPT("falt-external-templates",CL_CXX, OPT_falt_external_templates) \
...@@ -202,6 +210,8 @@ static void write_langs PARAMS ((char *, int)); ...@@ -202,6 +210,8 @@ static void write_langs PARAMS ((char *, int));
OPT("fweak", CL_CXX, OPT_fweak) \ OPT("fweak", CL_CXX, OPT_fweak) \
OPT("fxref", CL_CXX, OPT_fxref) \ OPT("fxref", CL_CXX, OPT_fxref) \
OPT("gen-decls", CL_OBJC, OPT_gen_decls) \ OPT("gen-decls", CL_OBJC, OPT_gen_decls) \
OPT("nostdinc", CL_ALL, OPT_nostdinc) \
OPT("nostdinc++", CL_ALL, OPT_nostdincplusplus) \
OPT("pedantic", CL_ALL, OPT_pedantic) \ OPT("pedantic", CL_ALL, OPT_pedantic) \
OPT("pedantic-errors", CL_ALL, OPT_pedantic_errors) \ OPT("pedantic-errors", CL_ALL, OPT_pedantic_errors) \
OPT("print-objc-runtime-info", CL_OBJC, OPT_print_objc_runtime_info) \ OPT("print-objc-runtime-info", CL_OBJC, OPT_print_objc_runtime_info) \
...@@ -217,7 +227,11 @@ static void write_langs PARAMS ((char *, int)); ...@@ -217,7 +227,11 @@ static void write_langs PARAMS ((char *, int));
OPT("std=iso9899:199409", CL_C, OPT_std_iso9899_199409) \ OPT("std=iso9899:199409", CL_C, OPT_std_iso9899_199409) \
OPT("std=iso9899:1999", CL_C, OPT_std_iso9899_1999) \ OPT("std=iso9899:1999", CL_C, OPT_std_iso9899_1999) \
OPT("std=iso9899:199x", CL_C, OPT_std_iso9899_199x) \ OPT("std=iso9899:199x", CL_C, OPT_std_iso9899_199x) \
OPT("undef", CL_ALL, OPT_undef) OPT("traditional-cpp", CL_ALL, OPT_traditional_cpp) \
OPT("trigraphs", CL_ALL, OPT_trigraphs) \
OPT("undef", CL_ALL, OPT_undef) \
OPT("v", CL_ALL, OPT_v) \
OPT("w", CL_ALL, OPT_w)
#define OPT(text, flags, code) code, #define OPT(text, flags, code) code,
enum opt_code enum opt_code
...@@ -260,6 +274,32 @@ opt_comp (p1, p2) ...@@ -260,6 +274,32 @@ opt_comp (p1, p2)
} }
#endif #endif
/* Complain that switch OPT_INDEX expects an argument but none was
provided. */
static void
missing_arg (opt_index)
size_t opt_index;
{
switch (opt_index)
{
case OPT_Wformat_eq:
case OPT_d:
case OPT_fbuiltin_:
case OPT_fdump:
case OPT_fname_mangling:
case OPT_ftabstop:
case OPT_ftemplate_depth:
case OPT_std_bad:
default:
error ("missing argument to \"-%s\"", cl_options[opt_index].opt_text);
break;
case OPT_fconstant_string_class:
error ("no class name specified with -fconstant-string-class=");
break;
}
}
/* 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 on matches. Returns its index in the option array, and N_OPTS on
failure. failure.
...@@ -431,6 +471,8 @@ c_common_decode_option (argc, argv) ...@@ -431,6 +471,8 @@ c_common_decode_option (argc, argv)
opt_index = parse_option (opt + 1, lang_flag); opt_index = parse_option (opt + 1, lang_flag);
if (opt_index == N_OPTS) if (opt_index == N_OPTS)
goto done; goto done;
result = 1;
option = &cl_options[opt_index]; option = &cl_options[opt_index];
/* Sort out any argument the switch takes. */ /* Sort out any argument the switch takes. */
...@@ -444,32 +486,54 @@ c_common_decode_option (argc, argv) ...@@ -444,32 +486,54 @@ c_common_decode_option (argc, argv)
arg = argv[0] + cl_options[opt_index].opt_len + 1; arg = argv[0] + cl_options[opt_index].opt_len + 1;
if (!on) if (!on)
arg += strlen ("no-"); arg += strlen ("no-");
if (*arg == '\0' && (option->flags & CL_SEPARATE))
arg = 0;
} }
/* If arg is still 0, we can only be a CL_SEPARATE switch. */ /* If we don't have an argument, and CL_SEPARATE, try the next
if (arg == 0) argument in the vector. */
if (!arg || (*arg == '\0' && option->flags & CL_SEPARATE))
{ {
arg = argv[1]; arg = argv[1];
if (!arg) result = 2;
}
if (!arg || *arg == '\0')
{ {
missing_arg (opt_index); missing_arg (opt_index);
result = argc; result = argc;
goto done; goto done;
} }
} }
}
switch (code = cl_options[opt_index].opt_code) switch (code = option->opt_code)
{ {
case N_OPTS: /* Shut GCC up. */ case N_OPTS: /* Shut GCC up. */
break; break;
case OPT__help:
print_help ();
break;
case OPT_C:
cpp_opts->discard_comments = 0;
break;
case OPT_CC:
cpp_opts->discard_comments = 0;
cpp_opts->discard_comments_in_macro_exp = 0;
break;
case OPT_E: case OPT_E:
flag_preprocess_only = 1; flag_preprocess_only = 1;
break; break;
case OPT_H:
cpp_opts->print_include_names = 1;
break;
case OPT_P:
cpp_opts->no_line_commands = 1;
break;
case OPT_Wall: case OPT_Wall:
set_Wunused (on); set_Wunused (on);
set_Wformat (on); set_Wformat (on);
...@@ -558,10 +622,8 @@ c_common_decode_option (argc, argv) ...@@ -558,10 +622,8 @@ c_common_decode_option (argc, argv)
case OPT_Werror_implicit_function_decl: case OPT_Werror_implicit_function_decl:
if (!on) if (!on)
{
result = 0; result = 0;
goto done; else
}
mesg_implicit_function_declaration = 2; mesg_implicit_function_declaration = 2;
break; break;
...@@ -757,6 +819,10 @@ c_common_decode_option (argc, argv) ...@@ -757,6 +819,10 @@ c_common_decode_option (argc, argv)
warn_write_strings = on; warn_write_strings = on;
break; break;
case OPT_d:
handle_OPT_d (arg);
break;
case OPT_fcond_mismatch: case OPT_fcond_mismatch:
if (c_language == clk_c || c_language == clk_objective_c) if (c_language == clk_c || c_language == clk_objective_c)
{ {
...@@ -804,10 +870,8 @@ c_common_decode_option (argc, argv) ...@@ -804,10 +870,8 @@ c_common_decode_option (argc, argv)
case OPT_fbuiltin_: case OPT_fbuiltin_:
if (on) if (on)
{
result = 0; result = 0;
goto done; else
}
disable_builtin_function (arg); disable_builtin_function (arg);
break; break;
...@@ -817,10 +881,7 @@ c_common_decode_option (argc, argv) ...@@ -817,10 +881,7 @@ c_common_decode_option (argc, argv)
case OPT_fdump: case OPT_fdump:
if (!on || !dump_switch_p (argv[0] + strlen ("-f"))) if (!on || !dump_switch_p (argv[0] + strlen ("-f")))
{
result = 0; result = 0;
goto done;
}
break; break;
case OPT_ffreestanding: case OPT_ffreestanding:
...@@ -877,9 +938,6 @@ c_common_decode_option (argc, argv) ...@@ -877,9 +938,6 @@ c_common_decode_option (argc, argv)
break; break;
case OPT_fconstant_string_class: case OPT_fconstant_string_class:
if (*arg == 0)
error ("no class name specified with -fconstant-string-class=");
else
constant_string_class_name = arg; constant_string_class_name = arg;
break; break;
...@@ -980,7 +1038,6 @@ c_common_decode_option (argc, argv) ...@@ -980,7 +1038,6 @@ c_common_decode_option (argc, argv)
return 0; return 0;
/* It is documented that we silently ignore silly values. */ /* It is documented that we silently ignore silly values. */
if (*arg)
{ {
char *endptr; char *endptr;
long tabstop = strtol (arg, &endptr, 10); long tabstop = strtol (arg, &endptr, 10);
...@@ -1009,6 +1066,17 @@ c_common_decode_option (argc, argv) ...@@ -1009,6 +1066,17 @@ c_common_decode_option (argc, argv)
flag_gen_declaration = 1; flag_gen_declaration = 1;
break; break;
case OPT_nostdinc:
/* No default include directories. You must specify all
include-file directories with -I. */
cpp_opts->no_standard_includes = 1;
break;
case OPT_nostdincplusplus:
/* No default C++-specific include directories. */
cpp_opts->no_standard_cplusplus_includes = 1;
break;
/* We need to handle the -pedantic switches here, rather than in /* We need to handle the -pedantic switches here, rather than in
c_common_post_options, so that a subsequent -Wno-endif-labels c_common_post_options, so that a subsequent -Wno-endif-labels
is not overridden. */ is not overridden. */
...@@ -1091,12 +1159,26 @@ c_common_decode_option (argc, argv) ...@@ -1091,12 +1159,26 @@ c_common_decode_option (argc, argv)
flag_isoc94 = 1; flag_isoc94 = 1;
break; break;
case OPT_trigraphs:
cpp_opts->trigraphs = 1;
break;
case OPT_traditional_cpp:
cpp_opts->traditional = 1;
break;
case OPT_undef: case OPT_undef:
flag_undef = 1; flag_undef = 1;
break; break;
}
result = 1 + (arg == argv[1]); case OPT_w:
cpp_opts->inhibit_warnings = 1;
break;
case OPT_v:
cpp_opts->verbose = 1;
break;
}
done: done:
if (dup) if (dup)
...@@ -1167,15 +1249,33 @@ set_Wimplicit (on) ...@@ -1167,15 +1249,33 @@ set_Wimplicit (on)
mesg_implicit_function_declaration = 0; mesg_implicit_function_declaration = 0;
} }
/* Complain that switch OPT_INDEX expects an argument but none was /* Args to -d specify what to dump. Silently ignore
provided. This is currenlty unused, as the C front ends have no unrecognised options; they may be aimed at toplev.c. */
switches that take separate arguments. Will be used when cpplib's
switches are integrated. */
static void static void
missing_arg (opt_index) handle_OPT_d (arg)
size_t opt_index ATTRIBUTE_UNUSED; const char *arg;
{ {
abort (); char c;
while ((c = *arg++) != '\0')
switch (c)
{
case 'M':
cpp_opts->dump_macros = dump_only;
break;
case 'N':
cpp_opts->dump_macros = dump_names;
break;
case 'D':
cpp_opts->dump_macros = dump_definitions;
break;
case 'I':
cpp_opts->dump_includes = 1;
break;
}
} }
/* Write a slash-separated list of languages in FLAGS to BUF. */ /* Write a slash-separated list of languages in FLAGS to BUF. */
...@@ -1214,3 +1314,84 @@ complain_wrong_lang (opt_index) ...@@ -1214,3 +1314,84 @@ complain_wrong_lang (opt_index)
warning ("\"-%s\" is valid for %s but not for %s", warning ("\"-%s\" is valid for %s but not for %s",
cl_options[opt_index].opt_text, ok_langs, bad_langs); cl_options[opt_index].opt_text, ok_langs, bad_langs);
} }
/* Handle --help output. */
static void
print_help ()
{
/* 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\
-P Do not generate #line directives\n\
-remap Remap file names when including files\n\
--help Display this information\n\
"), stdout);
}
...@@ -87,7 +87,6 @@ struct cpp_pending ...@@ -87,7 +87,6 @@ struct cpp_pending
} while (0) } while (0)
#endif #endif
static void print_help PARAMS ((void));
static void path_include PARAMS ((cpp_reader *, static void path_include PARAMS ((cpp_reader *,
char *, int)); char *, int));
static void init_library PARAMS ((void)); static void init_library PARAMS ((void));
...@@ -1136,14 +1135,8 @@ new_pending_directive (pend, text, handler) ...@@ -1136,14 +1135,8 @@ new_pending_directive (pend, text, handler)
/* This is the list of all command line options, with the leading /* This is the list of all command line options, with the leading
"-" removed. It must be sorted in ASCII collating order. */ "-" removed. It must be sorted in ASCII collating order. */
#define COMMAND_LINE_OPTIONS \ #define COMMAND_LINE_OPTIONS \
DEF_OPT("-help", 0, OPT__help) \
DEF_OPT("-target-help", 0, OPT_target__help) \
DEF_OPT("-version", 0, OPT__version) \
DEF_OPT("A", no_ass, OPT_A) \ DEF_OPT("A", no_ass, OPT_A) \
DEF_OPT("C", 0, OPT_C) \
DEF_OPT("CC", 0, OPT_CC) \
DEF_OPT("D", no_mac, OPT_D) \ DEF_OPT("D", no_mac, OPT_D) \
DEF_OPT("H", 0, OPT_H) \
DEF_OPT("I", no_dir, OPT_I) \ DEF_OPT("I", no_dir, OPT_I) \
DEF_OPT("M", 0, OPT_M) \ DEF_OPT("M", 0, OPT_M) \
DEF_OPT("MD", no_fil, OPT_MD) \ DEF_OPT("MD", no_fil, OPT_MD) \
...@@ -1154,10 +1147,7 @@ new_pending_directive (pend, text, handler) ...@@ -1154,10 +1147,7 @@ new_pending_directive (pend, text, handler)
DEF_OPT("MP", 0, OPT_MP) \ DEF_OPT("MP", 0, OPT_MP) \
DEF_OPT("MQ", no_tgt, OPT_MQ) \ DEF_OPT("MQ", no_tgt, OPT_MQ) \
DEF_OPT("MT", no_tgt, OPT_MT) \ DEF_OPT("MT", no_tgt, OPT_MT) \
DEF_OPT("P", 0, OPT_P) \
DEF_OPT("U", no_mac, OPT_U) \ DEF_OPT("U", no_mac, OPT_U) \
DEF_OPT("d", no_arg, OPT_d) \
DEF_OPT("h", 0, OPT_h) \
DEF_OPT("idirafter", no_dir, OPT_idirafter) \ DEF_OPT("idirafter", no_dir, OPT_idirafter) \
DEF_OPT("imacros", no_fil, OPT_imacros) \ DEF_OPT("imacros", no_fil, OPT_imacros) \
DEF_OPT("include", no_fil, OPT_include) \ DEF_OPT("include", no_fil, OPT_include) \
...@@ -1170,8 +1160,6 @@ new_pending_directive (pend, text, handler) ...@@ -1170,8 +1160,6 @@ new_pending_directive (pend, text, handler)
DEF_OPT("lang-c++", 0, OPT_lang_cplusplus) \ DEF_OPT("lang-c++", 0, OPT_lang_cplusplus) \
DEF_OPT("lang-c89", 0, OPT_lang_c89) \ DEF_OPT("lang-c89", 0, OPT_lang_c89) \
DEF_OPT("lang-objc", 0, OPT_lang_objc) \ DEF_OPT("lang-objc", 0, OPT_lang_objc) \
DEF_OPT("nostdinc", 0, OPT_nostdinc) \
DEF_OPT("nostdinc++", 0, OPT_nostdincplusplus) \
DEF_OPT("o", no_fil, OPT_o) \ DEF_OPT("o", no_fil, OPT_o) \
DEF_OPT("remap", 0, OPT_remap) \ DEF_OPT("remap", 0, OPT_remap) \
DEF_OPT("std=c++98", 0, OPT_std_cplusplus98) \ DEF_OPT("std=c++98", 0, OPT_std_cplusplus98) \
...@@ -1184,11 +1172,7 @@ new_pending_directive (pend, text, handler) ...@@ -1184,11 +1172,7 @@ new_pending_directive (pend, text, handler)
DEF_OPT("std=iso9899:1990", 0, OPT_std_iso9899_1990) \ DEF_OPT("std=iso9899:1990", 0, OPT_std_iso9899_1990) \
DEF_OPT("std=iso9899:199409", 0, OPT_std_iso9899_199409) \ DEF_OPT("std=iso9899:199409", 0, OPT_std_iso9899_199409) \
DEF_OPT("std=iso9899:1999", 0, OPT_std_iso9899_1999) \ DEF_OPT("std=iso9899:1999", 0, OPT_std_iso9899_1999) \
DEF_OPT("std=iso9899:199x", 0, OPT_std_iso9899_199x) \ DEF_OPT("std=iso9899:199x", 0, OPT_std_iso9899_199x)
DEF_OPT("traditional-cpp", 0, OPT_traditional_cpp) \
DEF_OPT("trigraphs", 0, OPT_trigraphs) \
DEF_OPT("v", 0, OPT_v) \
DEF_OPT("w", 0, OPT_w)
#define DEF_OPT(text, msg, code) code, #define DEF_OPT(text, msg, code) code,
enum opt_code enum opt_code
...@@ -1334,48 +1318,13 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1334,48 +1318,13 @@ cpp_handle_option (pfile, argc, argv)
{ {
case N_OPTS: /* Shut GCC up. */ case N_OPTS: /* Shut GCC up. */
break; break;
case OPT_w:
CPP_OPTION (pfile, inhibit_warnings) = 1;
break;
case OPT_h:
case OPT__help:
print_help ();
/* fall through */
case OPT_target__help:
case OPT__version:
/* Nothing to do for these cases, but we need to be sure
help_only is set. */
CPP_OPTION (pfile, help_only) = 1;
break;
case OPT_v:
CPP_OPTION (pfile, verbose) = 1;
break;
case OPT_C:
CPP_OPTION (pfile, discard_comments) = 0;
break;
case OPT_CC:
CPP_OPTION (pfile, discard_comments) = 0;
CPP_OPTION (pfile, discard_comments_in_macro_exp) = 0;
break;
case OPT_P:
CPP_OPTION (pfile, no_line_commands) = 1;
break;
case OPT_H:
CPP_OPTION (pfile, print_include_names) = 1;
break;
case OPT_D: case OPT_D:
new_pending_directive (pend, arg, cpp_define); new_pending_directive (pend, arg, cpp_define);
break; break;
case OPT_trigraphs:
CPP_OPTION (pfile, trigraphs) = 1;
break;
case OPT_remap: case OPT_remap:
CPP_OPTION (pfile, remap) = 1; CPP_OPTION (pfile, remap) = 1;
break; break;
case OPT_traditional_cpp:
CPP_OPTION (pfile, traditional) = 1;
break;
case OPT_iprefix: case OPT_iprefix:
CPP_OPTION (pfile, include_prefix) = arg; CPP_OPTION (pfile, include_prefix) = arg;
CPP_OPTION (pfile, include_prefix_len) = strlen (arg); CPP_OPTION (pfile, include_prefix_len) = strlen (arg);
...@@ -1416,15 +1365,6 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1416,15 +1365,6 @@ cpp_handle_option (pfile, argc, argv)
case OPT_std_c99: case OPT_std_c99:
set_lang (pfile, CLK_STDC99); set_lang (pfile, CLK_STDC99);
break; break;
case OPT_nostdinc:
/* -nostdinc causes no default include directories.
You must specify all include-file directories with -I. */
CPP_OPTION (pfile, no_standard_includes) = 1;
break;
case OPT_nostdincplusplus:
/* -nostdinc++ causes no default C++-specific include directories. */
CPP_OPTION (pfile, no_standard_cplusplus_includes) = 1;
break;
case OPT_o: case OPT_o:
if (CPP_OPTION (pfile, out_fname) == NULL) if (CPP_OPTION (pfile, out_fname) == NULL)
CPP_OPTION (pfile, out_fname) = arg; CPP_OPTION (pfile, out_fname) = arg;
...@@ -1434,31 +1374,6 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1434,31 +1374,6 @@ cpp_handle_option (pfile, argc, argv)
return argc; return argc;
} }
break; break;
case OPT_d:
/* Args to -d specify what parts of macros to dump.
Silently ignore unrecognised options; they may
be aimed at the compiler proper. */
{
char c;
while ((c = *arg++) != '\0')
switch (c)
{
case 'M':
CPP_OPTION (pfile, dump_macros) = dump_only;
break;
case 'N':
CPP_OPTION (pfile, dump_macros) = dump_names;
break;
case 'D':
CPP_OPTION (pfile, dump_macros) = dump_definitions;
break;
case 'I':
CPP_OPTION (pfile, dump_includes) = 1;
break;
}
}
break;
case OPT_MG: case OPT_MG:
CPP_OPTION (pfile, print_deps_missing_files) = 1; CPP_OPTION (pfile, print_deps_missing_files) = 1;
...@@ -1751,103 +1666,3 @@ init_dependency_output (pfile) ...@@ -1751,103 +1666,3 @@ init_dependency_output (pfile)
was specified with -o. out_fname is non-NULL here. */ was specified with -o. out_fname is non-NULL here. */
CPP_OPTION (pfile, deps_file) = CPP_OPTION (pfile, out_fname); CPP_OPTION (pfile, deps_file) = CPP_OPTION (pfile, out_fname);
} }
/* Handle --help output. */
static void
print_help ()
{
/* 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 (_("\
-pedantic Issue all warnings demanded by strict ISO C\n\
-pedantic-errors Issue -pedantic warnings as errors instead\n\
-trigraphs Support ISO C trigraphs\n\
-lang-c Assume that the input sources are in C\n\
-lang-c89 Assume that the input sources are in C89\n\
"), stdout);
fputs (_("\
-lang-c++ Assume that the input sources are in C++\n\
-lang-objc Assume that the input sources are in ObjectiveC\n\
-lang-asm Assume that the input sources are in assembler\n\
"), stdout);
fputs (_("\
-std=<std name> Specify the conformance standard; one of:\n\
gnu89, gnu99, c89, c99, iso9899:1990,\n\
iso9899:199409, iso9899:1999\n\
-w Inhibit warning messages\n\
-Wtrigraphs Warn if trigraphs are encountered\n\
-Wno-trigraphs Do not warn about trigraphs\n\
-Wcomment{s} Warn if one comment starts inside another\n\
"), stdout);
fputs (_("\
-Wno-comment{s} Do not warn about comments\n\
-Wtraditional Warn about features not present in traditional C\n\
-Wno-traditional Do not warn about traditional C\n\
-Wundef Warn if an undefined macro is used by #if\n\
-Wno-undef Do not warn about testing undefined macros\n\
-Wimport Warn about the use of the #import directive\n\
"), stdout);
fputs (_("\
-Wno-import Do not warn about the use of #import\n\
-Werror Treat all warnings as errors\n\
-Wno-error Do not treat warnings as errors\n\
-Wsystem-headers Do not suppress warnings from system headers\n\
-Wno-system-headers Suppress warnings from system headers\n\
-Wall Enable all 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 (_("\
-fpreprocessed Treat the input file as already preprocessed\n\
-ftabstop=<number> Distance between tab stops for column reporting\n\
-P Do not generate #line directives\n\
-remap Remap file names when including files\n\
--version Display version information\n\
-h or --help Display this information\n\
"), stdout);
}
...@@ -395,11 +395,6 @@ struct cpp_options ...@@ -395,11 +395,6 @@ struct cpp_options
/* Nonzero means handle C++ alternate operator names. */ /* Nonzero means handle C++ alternate operator names. */
unsigned char operator_names; unsigned char operator_names;
/* True if --help, --version or --target-help appeared in the
options. Stand-alone CPP should then bail out after option
parsing; drivers might want to continue printing help. */
unsigned char help_only;
/* True for traditional preprocessing. */ /* True for traditional preprocessing. */
unsigned char traditional; unsigned char traditional;
......
...@@ -607,10 +607,8 @@ Replacement: [ ] @{ @} # \ ^ | ~ ...@@ -607,10 +607,8 @@ Replacement: [ ] @{ @} # \ ^ | ~
Enable special code to work around file systems which only permit very Enable special code to work around file systems which only permit very
short file names, such as MS-DOS@. short file names, such as MS-DOS@.
@item -h
@itemx --help @itemx --help
@itemx --target-help @itemx --target-help
@opindex h
@opindex help @opindex help
@opindex target-help @opindex target-help
Print text describing all the command line options instead of Print text describing all the command line options instead of
......
...@@ -670,7 +670,7 @@ static const char *trad_capable_cpp = ...@@ -670,7 +670,7 @@ static const char *trad_capable_cpp =
static const char *cpp_unique_options = static const char *cpp_unique_options =
"%{C:%{!E:%eGNU C does not support -C without using -E}}\ "%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{CC:%{!E:%eGNU C does not support -CC without using -E}}\ %{CC:%{!E:%eGNU C does not support -CC without using -E}}\
%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*} %{P} %{$} %I\ %{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*} %{P} %I\
%{MD:-MD %W{!o: %b.d}%W{o*:%.d%*}}\ %{MD:-MD %W{!o: %b.d}%W{o*:%.d%*}}\
%{MMD:-MMD %W{!o: %b.d}%W{o*:%.d%*}}\ %{MMD:-MMD %W{!o: %b.d}%W{o*:%.d%*}}\
%{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*}\ %{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
......
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