Makefile.in: Update.
[platform/upstream/gcc.git] / gcc / c-opts.c
1 /* C/ObjC/C++ command line option handling.
2    Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3    Contributed by Neil Booth.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING.  If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.  */
21
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "tm.h"
26 #include "tree.h"
27 #include "c-common.h"
28 #include "c-pragma.h"
29 #include "flags.h"
30 #include "toplev.h"
31 #include "langhooks.h"
32 #include "tree-inline.h"
33 #include "diagnostic.h"
34 #include "intl.h"
35 #include "cppdefault.h"
36 #include "c-incpath.h"
37 #include "debug.h"              /* For debug_hooks.  */
38
39 #ifndef TARGET_SYSTEM_ROOT
40 # define TARGET_SYSTEM_ROOT NULL
41 #endif
42
43 static int saved_lineno;
44
45 /* CPP's options.  */
46 static cpp_options *cpp_opts;
47
48 /* Input filename.  */
49 static const char *in_fname;
50
51 /* Filename and stream for preprocessed output.  */
52 static const char *out_fname;
53 static FILE *out_stream;
54
55 /* Append dependencies to deps_file.  */
56 static bool deps_append;
57
58 /* If dependency switches (-MF etc.) have been given.  */
59 static bool deps_seen;
60
61 /* If -v seen.  */
62 static bool verbose;
63
64 /* Dependency output file.  */
65 static const char *deps_file;
66
67 /* The prefix given by -iprefix, if any.  */
68 static const char *iprefix;
69
70 /* The system root, if any.  Overridden by -isysroot.  */
71 static const char *sysroot = TARGET_SYSTEM_ROOT;
72
73 /* Zero disables all standard directories for headers.  */
74 static bool std_inc = true;
75
76 /* Zero disables the C++-specific standard directories for headers.  */
77 static bool std_cxx_inc = true;
78
79 /* If the quote chain has been split by -I-.  */
80 static bool quote_chain_split;
81
82 /* If -Wunused-macros.  */
83 static bool warn_unused_macros;
84
85 /* Number of deferred options, deferred options array size.  */
86 static size_t deferred_count, deferred_size;
87
88 /* Number of deferred options scanned for -include.  */
89 static size_t include_cursor;
90
91 static void missing_arg PARAMS ((size_t));
92 static size_t find_opt PARAMS ((const char *, int));
93 static void set_Wimplicit PARAMS ((int));
94 static void complain_wrong_lang PARAMS ((size_t));
95 static void write_langs PARAMS ((char *, int));
96 static void print_help PARAMS ((void));
97 static void handle_OPT_d PARAMS ((const char *));
98 static void set_std_cxx98 PARAMS ((int));
99 static void set_std_c89 PARAMS ((int, int));
100 static void set_std_c99 PARAMS ((int));
101 static void check_deps_environment_vars PARAMS ((void));
102 static void handle_deferred_opts PARAMS ((void));
103 static void sanitize_cpp_opts PARAMS ((void));
104 static void add_prefixed_path PARAMS ((const char *, size_t));
105 static void push_command_line_include PARAMS ((void));
106 static void cb_file_change PARAMS ((cpp_reader *, const struct line_map *));
107 static void finish_options PARAMS ((void));
108
109 #ifndef STDC_0_IN_SYSTEM_HEADERS
110 #define STDC_0_IN_SYSTEM_HEADERS 0
111 #endif
112
113 #define CL_C_ONLY       (1 << 0) /* Only C.  */
114 #define CL_OBJC_ONLY    (1 << 1) /* Only ObjC.  */
115 #define CL_CXX_ONLY     (1 << 2) /* Only C++.  */
116 #define CL_OBJCXX_ONLY  (1 << 3) /* Only ObjC++.  */
117 #define CL_JOINED       (1 << 4) /* If takes joined argument.  */
118 #define CL_SEPARATE     (1 << 5) /* If takes a separate argument.  */
119
120 #define CL_ARG          (CL_JOINED | CL_SEPARATE)
121 #define CL_C            (CL_C_ONLY | CL_OBJC_ONLY)
122 #define CL_OBJC         (CL_OBJC_ONLY | CL_OBJCXX_ONLY)
123 #define CL_CXX          (CL_CXX_ONLY | CL_OBJCXX_ONLY)
124 #define CL_ALL          (CL_C | CL_CXX)
125
126 /* This is the list of all command line options, with the leading "-"
127    removed.  It must be sorted in ASCII collating order.  All options
128    beginning with "f" or "W" are implicitly assumed to take a "no-"
129    form; this form should not be listed.  The variable "on" is true if
130    the positive form is given, otherwise it is false.  If you don't
131    want to allow a "no-" form, your handler should reject "on" being
132    false by returning zero.  See, for example, the handling of
133    -ftabstop=.
134
135    If the user gives an option to a front end that doesn't support it,
136    an error is output, mentioning which front ends the option is valid
137    for.  If you don't want this, you must accept it for all front
138    ends, and test for the front end in the option handler.  See, for
139    example, the handling of -Wno-strict-prototypes for C++.
140
141    If you request an argument with CL_JOINED, CL_SEPARATE or their
142    combination CL_ARG, it is stored in the variable "arg", which is
143    guaranteed to be non-NULL and to not be an empty string.  It points
144    to the argument either within the argv[] vector or within one of
145    that vector's strings, and so the text is permanent and copies need
146    not be made.  Be sure to add an error message in missing_arg() if
147    the default is not appropriate.  */
148
149 #define COMMAND_LINE_OPTIONS                                                 \
150   OPT("-help",                  CL_ALL,   OPT__help)                         \
151   OPT("-output-pch=",           CL_ALL | CL_ARG, OPT__output_pch)            \
152   OPT("A",                      CL_ALL | CL_ARG, OPT_A)                      \
153   OPT("C",                      CL_ALL,   OPT_C)                             \
154   OPT("CC",                     CL_ALL,   OPT_CC)                            \
155   OPT("D",                      CL_ALL | CL_ARG, OPT_D)                      \
156   OPT("E",                      CL_ALL,   OPT_E)                             \
157   OPT("H",                      CL_ALL,   OPT_H)                             \
158   OPT("I",                      CL_ALL | CL_ARG, OPT_I)                      \
159   OPT("M",                      CL_ALL,   OPT_M)                             \
160   OPT("MD",                     CL_ALL | CL_SEPARATE, OPT_MD)                \
161   OPT("MF",                     CL_ALL | CL_ARG, OPT_MF)                     \
162   OPT("MG",                     CL_ALL,   OPT_MG)                            \
163   OPT("MM",                     CL_ALL,   OPT_MM)                            \
164   OPT("MMD",                    CL_ALL | CL_SEPARATE, OPT_MMD)               \
165   OPT("MP",                     CL_ALL,   OPT_MP)                            \
166   OPT("MQ",                     CL_ALL | CL_ARG, OPT_MQ)                     \
167   OPT("MT",                     CL_ALL | CL_ARG, OPT_MT)                     \
168   OPT("P",                      CL_ALL,   OPT_P)                             \
169   OPT("U",                      CL_ALL | CL_ARG, OPT_U)                      \
170   OPT("Wabi",                   CL_CXX,   OPT_Wabi)                          \
171   OPT("Wall",                   CL_ALL,   OPT_Wall)                          \
172   OPT("Wbad-function-cast",     CL_C,     OPT_Wbad_function_cast)            \
173   OPT("Wcast-qual",             CL_ALL,   OPT_Wcast_qual)                    \
174   OPT("Wchar-subscripts",       CL_ALL,   OPT_Wchar_subscripts)              \
175   OPT("Wcomment",               CL_ALL,   OPT_Wcomment)                      \
176   OPT("Wcomments",              CL_ALL,   OPT_Wcomments)                     \
177   OPT("Wconversion",            CL_ALL,   OPT_Wconversion)                   \
178   OPT("Wctor-dtor-privacy",     CL_CXX,   OPT_Wctor_dtor_privacy)            \
179   OPT("Wdeprecated",            CL_CXX,   OPT_Wdeprecated)                   \
180   OPT("Wdiv-by-zero",           CL_C,     OPT_Wdiv_by_zero)                  \
181   OPT("Weffc++",                CL_CXX,   OPT_Weffcxx)                       \
182   OPT("Wendif-labels",          CL_ALL,   OPT_Wendif_labels)                 \
183   OPT("Werror",                 CL_ALL,   OPT_Werror)                        \
184   OPT("Werror-implicit-function-declaration",                                \
185                                 CL_C,     OPT_Werror_implicit_function_decl) \
186   OPT("Wfloat-equal",           CL_ALL,   OPT_Wfloat_equal)                  \
187   OPT("Wformat",                CL_ALL,   OPT_Wformat)                       \
188   OPT("Wformat-extra-args",     CL_ALL,   OPT_Wformat_extra_args)            \
189   OPT("Wformat-nonliteral",     CL_ALL,   OPT_Wformat_nonliteral)            \
190   OPT("Wformat-security",       CL_ALL,   OPT_Wformat_security)              \
191   OPT("Wformat-y2k",            CL_ALL,   OPT_Wformat_y2k)                   \
192   OPT("Wformat-zero-length",    CL_C,     OPT_Wformat_zero_length)           \
193   OPT("Wformat=",               CL_ALL | CL_JOINED, OPT_Wformat_eq)          \
194   OPT("Wimplicit",              CL_ALL,   OPT_Wimplicit)                     \
195   OPT("Wimplicit-function-declaration", CL_C, OPT_Wimplicit_function_decl)   \
196   OPT("Wimplicit-int",          CL_C,     OPT_Wimplicit_int)                 \
197   OPT("Wimport",                CL_ALL,   OPT_Wimport)                       \
198   OPT("Winvalid-pch",           CL_ALL,   OPT_Winvalid_pch)                  \
199   OPT("Wlong-long",             CL_ALL,   OPT_Wlong_long)                    \
200   OPT("Wmain",                  CL_C,     OPT_Wmain)                         \
201   OPT("Wmissing-braces",        CL_ALL,   OPT_Wmissing_braces)               \
202   OPT("Wmissing-declarations",  CL_C,     OPT_Wmissing_declarations)         \
203   OPT("Wmissing-format-attribute",CL_ALL, OPT_Wmissing_format_attribute)     \
204   OPT("Wmissing-prototypes",    CL_ALL,   OPT_Wmissing_prototypes)           \
205   OPT("Wmultichar",             CL_ALL,   OPT_Wmultichar)                    \
206   OPT("Wnested-externs",        CL_C,     OPT_Wnested_externs)               \
207   OPT("Wnon-template-friend",   CL_CXX,   OPT_Wnon_template_friend)          \
208   OPT("Wnon-virtual-dtor",      CL_CXX,   OPT_Wnon_virtual_dtor)             \
209   OPT("Wnonnull",               CL_C,     OPT_Wnonnull)                      \
210   OPT("Wold-style-cast",        CL_CXX,   OPT_Wold_style_cast)               \
211   OPT("Woverloaded-virtual",    CL_CXX,   OPT_Woverloaded_virtual)           \
212   OPT("Wparentheses",           CL_ALL,   OPT_Wparentheses)                  \
213   OPT("Wpmf-conversions",       CL_CXX,   OPT_Wpmf_conversions)              \
214   OPT("Wpointer-arith",         CL_ALL,   OPT_Wpointer_arith)                \
215   OPT("Wprotocol",              CL_OBJC,  OPT_Wprotocol)                     \
216   OPT("Wredundant-decls",       CL_ALL,   OPT_Wredundant_decls)              \
217   OPT("Wreorder",               CL_CXX,   OPT_Wreorder)                      \
218   OPT("Wreturn-type",           CL_ALL,   OPT_Wreturn_type)                  \
219   OPT("Wselector",              CL_OBJC,  OPT_Wselector)                     \
220   OPT("Wsequence-point",        CL_C,     OPT_Wsequence_point)               \
221   OPT("Wsign-compare",          CL_ALL,   OPT_Wsign_compare)                 \
222   OPT("Wsign-promo",            CL_CXX,   OPT_Wsign_promo)                   \
223   OPT("Wstrict-prototypes",     CL_ALL,   OPT_Wstrict_prototypes)            \
224   OPT("Wsynth",                 CL_CXX,   OPT_Wsynth)                        \
225   OPT("Wsystem-headers",        CL_ALL,   OPT_Wsystem_headers)               \
226   OPT("Wtraditional",           CL_C,     OPT_Wtraditional)                  \
227   OPT("Wtrigraphs",             CL_ALL,   OPT_Wtrigraphs)                    \
228   OPT("Wundeclared-selector",   CL_OBJC,  OPT_Wundeclared_selector)          \
229   OPT("Wundef",                 CL_ALL,   OPT_Wundef)                        \
230   OPT("Wunknown-pragmas",       CL_ALL,   OPT_Wunknown_pragmas)              \
231   OPT("Wunused-macros",         CL_ALL,   OPT_Wunused_macros)                \
232   OPT("Wwrite-strings",         CL_ALL,   OPT_Wwrite_strings)                \
233   OPT("ansi",                   CL_ALL,   OPT_ansi)                          \
234   OPT("d",                      CL_ALL | CL_JOINED, OPT_d)                   \
235   OPT("fabi-version=",          CL_CXX | CL_JOINED, OPT_fabi_version)        \
236   OPT("faccess-control",        CL_CXX,   OPT_faccess_control)               \
237   OPT("fall-virtual",           CL_CXX,   OPT_fall_virtual)                  \
238   OPT("falt-external-templates",CL_CXX,   OPT_falt_external_templates)       \
239   OPT("fasm",                   CL_ALL,   OPT_fasm)                          \
240   OPT("fbuiltin",               CL_ALL,   OPT_fbuiltin)                      \
241   OPT("fbuiltin-",              CL_ALL | CL_JOINED, OPT_fbuiltin_)           \
242   OPT("fcheck-new",             CL_CXX,   OPT_fcheck_new)                    \
243   OPT("fcond-mismatch",         CL_ALL,   OPT_fcond_mismatch)                \
244   OPT("fconserve-space",        CL_CXX,   OPT_fconserve_space)               \
245   OPT("fconst-strings",         CL_CXX,   OPT_fconst_strings)                \
246   OPT("fconstant-string-class=", CL_OBJC | CL_JOINED,                        \
247                                           OPT_fconstant_string_class)        \
248   OPT("fdefault-inline",        CL_CXX,   OPT_fdefault_inline)               \
249   OPT("fdollars-in-identifiers",CL_ALL,   OPT_fdollars_in_identifiers)       \
250   OPT("fdump-",                 CL_ALL | CL_JOINED, OPT_fdump)               \
251   OPT("felide-constructors",    CL_CXX,   OPT_felide_constructors)           \
252   OPT("fenforce-eh-specs",      CL_CXX,   OPT_fenforce_eh_specs)             \
253   OPT("fenum-int-equiv",        CL_CXX,   OPT_fenum_int_equiv)               \
254   OPT("fexternal-templates",    CL_CXX,   OPT_fexternal_templates)           \
255   OPT("ffixed-form",            CL_C,     OPT_ffixed_form)                   \
256   OPT("ffixed-line-length-",    CL_C | CL_JOINED, OPT_ffixed_line_length)    \
257   OPT("ffor-scope",             CL_CXX,   OPT_ffor_scope)                    \
258   OPT("ffreestanding",          CL_C,     OPT_ffreestanding)                 \
259   OPT("fgnu-keywords",          CL_CXX,   OPT_fgnu_keywords)                 \
260   OPT("fgnu-runtime",           CL_OBJC,  OPT_fgnu_runtime)                  \
261   OPT("fguiding-decls",         CL_CXX,   OPT_fguiding_decls)                \
262   OPT("fhandle-exceptions",     CL_CXX,   OPT_fhandle_exceptions)            \
263   OPT("fhonor-std",             CL_CXX,   OPT_fhonor_std)                    \
264   OPT("fhosted",                CL_C,     OPT_fhosted)                       \
265   OPT("fhuge-objects",          CL_CXX,   OPT_fhuge_objects)                 \
266   OPT("fimplement-inlines",     CL_CXX,   OPT_fimplement_inlines)            \
267   OPT("fimplicit-inline-templates", CL_CXX, OPT_fimplicit_inline_templates)  \
268   OPT("fimplicit-templates",    CL_CXX,   OPT_fimplicit_templates)           \
269   OPT("flabels-ok",             CL_CXX,   OPT_flabels_ok)                    \
270   OPT("fms-extensions",         CL_ALL,   OPT_fms_extensions)                \
271   OPT("fname-mangling-version-",CL_CXX | CL_JOINED, OPT_fname_mangling)      \
272   OPT("fnew-abi",               CL_CXX,   OPT_fnew_abi)                      \
273   OPT("fnext-runtime",          CL_OBJC,  OPT_fnext_runtime)                 \
274   OPT("fnonansi-builtins",      CL_CXX,   OPT_fnonansi_builtins)             \
275   OPT("fnonnull-objects",       CL_CXX,   OPT_fnonnull_objects)              \
276   OPT("foperator-names",        CL_CXX,   OPT_foperator_names)               \
277   OPT("foptional-diags",        CL_CXX,   OPT_foptional_diags)               \
278   OPT("fpch-deps",              CL_ALL,   OPT_fpch_deps)                     \
279   OPT("fpermissive",            CL_CXX,   OPT_fpermissive)                   \
280   OPT("fpreprocessed",          CL_ALL,   OPT_fpreprocessed)                 \
281   OPT("frepo",                  CL_CXX,   OPT_frepo)                         \
282   OPT("frtti",                  CL_CXX,   OPT_frtti)                         \
283   OPT("fshort-double",          CL_ALL,   OPT_fshort_double)                 \
284   OPT("fshort-enums",           CL_ALL,   OPT_fshort_enums)                  \
285   OPT("fshort-wchar",           CL_ALL,   OPT_fshort_wchar)                  \
286   OPT("fshow-column",           CL_ALL,   OPT_fshow_column)                  \
287   OPT("fsigned-bitfields",      CL_ALL,   OPT_fsigned_bitfields)             \
288   OPT("fsigned-char",           CL_ALL,   OPT_fsigned_char)                  \
289   OPT("fsquangle",              CL_CXX,   OPT_fsquangle)                     \
290   OPT("fstats",                 CL_CXX,   OPT_fstats)                        \
291   OPT("fstrict-prototype",      CL_CXX,   OPT_fstrict_prototype)             \
292   OPT("ftabstop=",              CL_ALL | CL_JOINED, OPT_ftabstop)            \
293   OPT("ftemplate-depth-",       CL_CXX | CL_JOINED, OPT_ftemplate_depth)     \
294   OPT("fthis-is-variable",      CL_CXX,   OPT_fthis_is_variable)             \
295   OPT("funsigned-bitfields",    CL_ALL,   OPT_funsigned_bitfields)           \
296   OPT("funsigned-char",         CL_ALL,   OPT_funsigned_char)                \
297   OPT("fuse-cxa-atexit",        CL_CXX,   OPT_fuse_cxa_atexit)               \
298   OPT("fvtable-gc",             CL_CXX,   OPT_fvtable_gc)                    \
299   OPT("fvtable-thunks",         CL_CXX,   OPT_fvtable_thunks)                \
300   OPT("fweak",                  CL_CXX,   OPT_fweak)                         \
301   OPT("fxref",                  CL_CXX,   OPT_fxref)                         \
302   OPT("gen-decls",              CL_OBJC,  OPT_gen_decls)                     \
303   OPT("idirafter",              CL_ALL | CL_ARG, OPT_idirafter)              \
304   OPT("imacros",                CL_ALL | CL_ARG, OPT_imacros)                \
305   OPT("include",                CL_ALL | CL_ARG, OPT_include)                \
306   OPT("iprefix",                CL_ALL | CL_ARG, OPT_iprefix)                \
307   OPT("isysroot",               CL_ALL | CL_ARG, OPT_isysroot)               \
308   OPT("isystem",                CL_ALL | CL_ARG, OPT_isystem)                \
309   OPT("iwithprefix",            CL_ALL | CL_ARG, OPT_iwithprefix)            \
310   OPT("iwithprefixbefore",      CL_ALL | CL_ARG, OPT_iwithprefixbefore)      \
311   OPT("lang-asm",               CL_C_ONLY, OPT_lang_asm)                     \
312   OPT("lang-objc",              CL_ALL,   OPT_lang_objc)                     \
313   OPT("nostdinc",               CL_ALL,   OPT_nostdinc)                      \
314   OPT("nostdinc++",             CL_ALL,   OPT_nostdincplusplus)              \
315   OPT("o",                      CL_ALL | CL_ARG, OPT_o)                      \
316   OPT("pedantic",               CL_ALL,   OPT_pedantic)                      \
317   OPT("pedantic-errors",        CL_ALL,   OPT_pedantic_errors)               \
318   OPT("print-objc-runtime-info", CL_OBJC, OPT_print_objc_runtime_info)       \
319   OPT("remap",                  CL_ALL,   OPT_remap)                         \
320   OPT("std=c++98",              CL_CXX,   OPT_std_cplusplus98)               \
321   OPT("std=c89",                CL_C,     OPT_std_c89)                       \
322   OPT("std=c99",                CL_C,     OPT_std_c99)                       \
323   OPT("std=c9x",                CL_C,     OPT_std_c9x)                       \
324   OPT("std=gnu++98",            CL_CXX,   OPT_std_gnuplusplus98)             \
325   OPT("std=gnu89",              CL_C,     OPT_std_gnu89)                     \
326   OPT("std=gnu99",              CL_C,     OPT_std_gnu99)                     \
327   OPT("std=gnu9x",              CL_C,     OPT_std_gnu9x)                     \
328   OPT("std=iso9899:1990",       CL_C,     OPT_std_iso9899_1990)              \
329   OPT("std=iso9899:199409",     CL_C,     OPT_std_iso9899_199409)            \
330   OPT("std=iso9899:1999",       CL_C,     OPT_std_iso9899_1999)              \
331   OPT("std=iso9899:199x",       CL_C,     OPT_std_iso9899_199x)              \
332   OPT("traditional-cpp",        CL_ALL,   OPT_traditional_cpp)               \
333   OPT("trigraphs",              CL_ALL,   OPT_trigraphs)                     \
334   OPT("undef",                  CL_ALL,   OPT_undef)                         \
335   OPT("v",                      CL_ALL,   OPT_v)                             \
336   OPT("w",                      CL_ALL,   OPT_w)
337
338 #define OPT(text, flags, code) code,
339 enum opt_code
340 {
341   COMMAND_LINE_OPTIONS
342   N_OPTS
343 };
344 #undef OPT
345
346 struct cl_option
347 {
348   const char *opt_text;
349   unsigned char opt_len;
350   unsigned char flags;
351   ENUM_BITFIELD (opt_code) opt_code : 2 * CHAR_BIT;
352 };
353
354 #define OPT(text, flags, code) { text, sizeof(text) - 1, flags, code },
355 #ifdef HOST_EBCDIC
356 static struct cl_option cl_options[] =
357 #else
358 static const struct cl_option cl_options[] =
359 #endif
360 {
361   COMMAND_LINE_OPTIONS
362 };
363 #undef OPT
364 #undef COMMAND_LINE_OPTIONS
365
366 /* Holds switches parsed by c_common_decode_option (), but whose
367    handling is deferred to c_common_post_options ().  */
368 static void defer_opt PARAMS ((enum opt_code, const char *));
369 static struct deferred_opt
370 {
371   enum opt_code code;
372   const char *arg;
373 } *deferred_opts;
374
375
376 #ifdef HOST_EBCDIC
377 static int opt_comp PARAMS ((const void *, const void *));
378
379 /* Run-time sorting of options array.  */
380 static int
381 opt_comp (p1, p2)
382      const void *p1, *p2;
383 {
384   return strcmp (((struct cl_option *) p1)->opt_text,
385                  ((struct cl_option *) p2)->opt_text);
386 }
387 #endif
388
389 /* Complain that switch OPT_INDEX expects an argument but none was
390    provided.  */
391 static void
392 missing_arg (opt_index)
393      size_t opt_index;
394 {
395   const char *opt_text = cl_options[opt_index].opt_text;
396
397   switch (cl_options[opt_index].opt_code)
398     {
399     case OPT__output_pch:
400     case OPT_Wformat_eq:
401     case OPT_d:
402     case OPT_fabi_version:
403     case OPT_fbuiltin_:
404     case OPT_fdump:
405     case OPT_fname_mangling:
406     case OPT_ftabstop:
407     case OPT_ftemplate_depth:
408     case OPT_iprefix:
409     case OPT_iwithprefix:
410     case OPT_iwithprefixbefore:
411     default:
412       error ("missing argument to \"-%s\"", opt_text);
413       break;
414
415     case OPT_fconstant_string_class:
416       error ("no class name specified with \"-%s\"", opt_text);
417       break;
418
419     case OPT_A:
420       error ("assertion missing after \"-%s\"", opt_text);
421       break;
422
423     case OPT_D:
424     case OPT_U:
425       error ("macro name missing after \"-%s\"", opt_text);
426       break;
427
428     case OPT_I:
429     case OPT_idirafter:
430     case OPT_isysroot:
431     case OPT_isystem:
432       error ("missing path after \"-%s\"", opt_text);
433       break;
434
435     case OPT_MF:
436     case OPT_MD:
437     case OPT_MMD:
438     case OPT_include:
439     case OPT_imacros:
440     case OPT_o:
441       error ("missing filename after \"-%s\"", opt_text);
442       break;
443
444     case OPT_MQ:
445     case OPT_MT:
446       error ("missing target after \"-%s\"", opt_text);
447       break;
448     }
449 }
450
451 /* Perform a binary search to find which option the command-line INPUT
452    matches.  Returns its index in the option array, and N_OPTS on
453    failure.
454
455    Complications arise since some options can be suffixed with an
456    argument, and multiple complete matches can occur, e.g. -pedantic
457    and -pedantic-errors.  Also, some options are only accepted by some
458    languages.  If a switch matches for a different language and
459    doesn't match any alternatives for the true front end, the index of
460    the matched switch is returned anyway.  The caller should check for
461    this case.  */
462 static size_t
463 find_opt (input, lang_flag)
464      const char *input;
465      int lang_flag;
466 {
467   size_t md, mn, mx;
468   size_t opt_len;
469   size_t result = N_OPTS;
470   int comp;
471
472   mn = 0;
473   mx = N_OPTS;
474
475   while (mx > mn)
476     {
477       md = (mn + mx) / 2;
478
479       opt_len = cl_options[md].opt_len;
480       comp = strncmp (input, cl_options[md].opt_text, opt_len);
481
482       if (comp < 0)
483         mx = md;
484       else if (comp > 0)
485         mn = md + 1;
486       else
487         {
488           /* The switch matches.  It it an exact match?  */
489           if (input[opt_len] == '\0')
490             return md;
491           else
492             {
493               mn = md + 1;
494
495               /* If the switch takes no arguments this is not a proper
496                  match, so we continue the search (e.g. input="stdc++"
497                  match was "stdc").  */
498               if (!(cl_options[md].flags & CL_JOINED))
499                 continue;
500
501               /* Is this switch valid for this front end?  */
502               if (!(cl_options[md].flags & lang_flag))
503                 {
504                   /* If subsequently we don't find a better match,
505                      return this and let the caller report it as a bad
506                      match.  */
507                   result = md;
508                   continue;
509                 }
510
511               /* Two scenarios remain: we have the switch's argument,
512                  or we match a longer option.  This can happen with
513                  -iwithprefix and -withprefixbefore.  The longest
514                  possible option match succeeds.
515
516                  Scan forwards, and return an exact match.  Otherwise
517                  return the longest valid option-accepting match (mx).
518                  This loops at most twice with current options.  */
519               mx = md;
520               for (md = md + 1; md < (size_t) N_OPTS; md++)
521                 {
522                   opt_len = cl_options[md].opt_len;
523                   if (strncmp (input, cl_options[md].opt_text, opt_len))
524                     break;
525                   if (input[opt_len] == '\0')
526                     return md;
527                   if (cl_options[md].flags & lang_flag
528                       && cl_options[md].flags & CL_JOINED)
529                     mx = md;
530                 }
531
532               return mx;
533             }
534         }
535     }
536
537   return result;
538 }
539
540 /* Defer option CODE with argument ARG.  */
541 static void
542 defer_opt (code, arg)
543      enum opt_code code;
544      const char *arg;
545 {
546   /* FIXME: this should be in c_common_init_options, which should take
547      argc and argv.  */
548   if (!deferred_opts)
549     {
550       extern int save_argc;
551       deferred_size = save_argc;
552       deferred_opts = (struct deferred_opt *)
553         xmalloc (deferred_size * sizeof (struct deferred_opt));
554     }
555
556   if (deferred_count == deferred_size)
557     abort ();
558
559   deferred_opts[deferred_count].code = code;
560   deferred_opts[deferred_count].arg = arg;
561   deferred_count++;
562 }
563
564 /* Common initialization before parsing options.  */
565 void
566 c_common_init_options (lang)
567      enum c_language_kind lang;
568 {
569 #ifdef HOST_EBCDIC
570   /* For non-ASCII hosts, the cl_options array needs to be sorted at
571      runtime.  */
572   qsort (cl_options, N_OPTS, sizeof (struct cl_option), opt_comp);
573 #endif
574 #if ENABLE_CHECKING
575  {
576   size_t i;
577
578   for (i = 1; i < N_OPTS; i++)
579     if (strcmp (cl_options[i - 1].opt_text, cl_options[i].opt_text) >= 0)
580       error ("options array incorrectly sorted: %s is before %s",
581              cl_options[i - 1].opt_text, cl_options[i].opt_text);
582  }
583 #endif
584
585   c_language = lang;
586   parse_in = cpp_create_reader (lang == clk_c ? CLK_GNUC89 : CLK_GNUCXX);
587   cpp_opts = cpp_get_options (parse_in);
588   if (flag_objc)
589     cpp_opts->objc = 1;
590
591   flag_const_strings = (lang == clk_cplusplus);
592   warn_pointer_arith = (lang == clk_cplusplus);
593   if (lang == clk_c)
594     warn_sign_compare = -1;
595 }
596
597 /* Handle one command-line option in (argc, argv).
598    Can be called multiple times, to handle multiple sets of options.
599    Returns number of strings consumed.  */
600 int
601 c_common_decode_option (argc, argv)
602      int argc;
603      char **argv;
604 {
605   static const int lang_flags[] = {CL_C_ONLY, CL_C, CL_CXX_ONLY, CL_CXX};
606   size_t opt_index;
607   const char *opt, *arg = 0;
608   char *dup = 0;
609   bool on = true;
610   int result = 0, lang_flag;
611   const struct cl_option *option;
612   enum opt_code code;
613
614   opt = argv[0];
615
616   /* Interpret "-" or a non-switch as a file name.  */
617   if (opt[0] != '-' || opt[1] == '\0')
618     {
619       if (!in_fname)
620         in_fname = opt;
621       else if (!out_fname)
622         out_fname = opt;
623       else
624         {
625           error ("too many filenames given.  Type %s --help for usage",
626                  progname);
627           return argc;
628         }
629
630       return 1;
631     }
632
633   /* Drop the "no-" from negative switches.  */
634   if ((opt[1] == 'W' || opt[1] == 'f')
635       && opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-')
636     {
637       size_t len = strlen (opt) - 3;
638
639       dup = xmalloc (len + 1);
640       dup[0] = '-';
641       dup[1] = opt[1];
642       memcpy (dup + 2, opt + 5, len - 2 + 1);
643       opt = dup;
644       on = false;
645     }
646
647   /* Skip over '-'.  */
648   lang_flag = lang_flags[(c_language << 1) + flag_objc];
649   opt_index = find_opt (opt + 1, lang_flag);
650   if (opt_index == N_OPTS)
651     goto done;
652
653   result = 1;
654   option = &cl_options[opt_index];
655
656   /* Sort out any argument the switch takes.  */
657   if (option->flags & CL_ARG)
658     {
659       if (option->flags & CL_JOINED)
660         {
661           /* Have arg point to the original switch.  This is because
662              some code, such as disable_builtin_function, expects its
663              argument to be persistent until the program exits.  */
664           arg = argv[0] + cl_options[opt_index].opt_len + 1;
665           if (!on)
666             arg += strlen ("no-");
667         }
668
669       /* If we don't have an argument, and CL_SEPARATE, try the next
670          argument in the vector.  */
671       if (!arg || (*arg == '\0' && option->flags & CL_SEPARATE))
672         {
673           arg = argv[1];
674           result = 2;
675         }
676
677       if (!arg || *arg == '\0')
678         {
679           missing_arg (opt_index);
680           result = argc;
681           goto done;
682         }
683     }
684
685   /* Complain about the wrong language after we've swallowed any
686      necessary extra argument.  Eventually make this a hard error
687      after the call to find_opt, and return argc.  */
688   if (!(cl_options[opt_index].flags & lang_flag))
689     {
690       complain_wrong_lang (opt_index);
691       goto done;
692     }
693
694   switch (code = option->opt_code)
695     {
696     case N_OPTS: /* Shut GCC up.  */
697       break;
698
699     case OPT__help:
700       print_help ();
701       break;
702
703     case OPT__output_pch:
704       pch_file = arg;
705       break;
706
707     case OPT_A:
708       defer_opt (code, arg);
709       break;
710
711     case OPT_C:
712       cpp_opts->discard_comments = 0;
713       break;
714
715     case OPT_CC:
716       cpp_opts->discard_comments = 0;
717       cpp_opts->discard_comments_in_macro_exp = 0;
718       break;
719
720     case OPT_D:
721       defer_opt (code, arg);
722       break;
723
724     case OPT_E:
725       flag_preprocess_only = 1;
726       break;
727
728     case OPT_H:
729       cpp_opts->print_include_names = 1;
730       break;
731
732     case OPT_I:
733       if (strcmp (arg, "-"))
734         add_path (xstrdup (arg), BRACKET, 0);
735       else
736         {
737           if (quote_chain_split)
738             error ("-I- specified twice");
739           quote_chain_split = true;
740           split_quote_chain ();
741         }
742       break;
743
744     case OPT_M:
745     case OPT_MM:
746       /* When doing dependencies with -M or -MM, suppress normal
747          preprocessed output, but still do -dM etc. as software
748          depends on this.  Preprocessed output does occur if -MD, -MMD
749          or environment var dependency generation is used.  */
750       cpp_opts->deps.style = (code == OPT_M ? DEPS_SYSTEM: DEPS_USER);
751       flag_no_output = 1;
752       cpp_opts->inhibit_warnings = 1;
753       break;
754
755     case OPT_MD:
756     case OPT_MMD:
757       cpp_opts->deps.style = (code == OPT_MD ? DEPS_SYSTEM: DEPS_USER);
758       deps_file = arg;
759       break;
760
761     case OPT_MF:
762       deps_seen = true;
763       deps_file = arg;
764       break;
765
766     case OPT_MG:
767       deps_seen = true;
768       cpp_opts->deps.missing_files = true;
769       break;
770
771     case OPT_MP:
772       deps_seen = true;
773       cpp_opts->deps.phony_targets = true;
774       break;
775
776     case OPT_MQ:
777     case OPT_MT:
778       deps_seen = true;
779       defer_opt (code, arg);
780       break;
781
782     case OPT_P:
783       flag_no_line_commands = 1;
784       break;
785
786     case OPT_U:
787       defer_opt (code, arg);
788       break;
789
790     case OPT_Wabi:
791       warn_abi = on;
792       break;
793
794     case OPT_Wall:
795       set_Wunused (on);
796       set_Wformat (on);
797       set_Wimplicit (on);
798       warn_char_subscripts = on;
799       warn_missing_braces = on;
800       warn_parentheses = on;
801       warn_return_type = on;
802       warn_sequence_point = on; /* Was C only.  */
803       warn_sign_compare = on;   /* Was C++ only.  */
804       warn_switch = on;
805       warn_strict_aliasing = on;
806       
807       /* Only warn about unknown pragmas that are not in system
808          headers.  */                                        
809       warn_unknown_pragmas = on;
810
811       /* We save the value of warn_uninitialized, since if they put
812          -Wuninitialized on the command line, we need to generate a
813          warning about not using it without also specifying -O.  */
814       if (warn_uninitialized != 1)
815         warn_uninitialized = (on ? 2 : 0);
816
817       if (c_language == clk_c)
818         /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding
819            can turn it off only if it's not explicit.  */
820         warn_main = on * 2;
821       else
822         {
823           /* C++-specific warnings.  */
824           warn_ctor_dtor_privacy = on;
825           warn_nonvdtor = on;
826           warn_reorder = on;
827           warn_nontemplate_friend = on;
828         }
829
830       cpp_opts->warn_trigraphs = on;
831       cpp_opts->warn_comments = on;
832       cpp_opts->warn_num_sign_change = on;
833       cpp_opts->warn_multichar = on;    /* Was C++ only.  */
834       break;
835
836     case OPT_Wbad_function_cast:
837       warn_bad_function_cast = on;
838       break;
839
840     case OPT_Wcast_qual:
841       warn_cast_qual = on;
842       break;
843
844     case OPT_Wchar_subscripts:
845       warn_char_subscripts = on;
846       break;
847
848     case OPT_Wcomment:
849     case OPT_Wcomments:
850       cpp_opts->warn_comments = on;
851       break;
852
853     case OPT_Wconversion:
854       warn_conversion = on;
855       break;
856
857     case OPT_Wctor_dtor_privacy:
858       warn_ctor_dtor_privacy = on;
859       break;
860
861     case OPT_Wdeprecated:
862       warn_deprecated = on;
863       cpp_opts->warn_deprecated = on;
864       break;
865
866     case OPT_Wdiv_by_zero:
867       warn_div_by_zero = on;
868       break;
869
870     case OPT_Weffcxx:
871       warn_ecpp = on;
872       break;
873
874     case OPT_Wendif_labels:
875       cpp_opts->warn_endif_labels = on;
876       break;
877
878     case OPT_Werror:
879       cpp_opts->warnings_are_errors = on;
880       break;
881
882     case OPT_Werror_implicit_function_decl:
883       if (!on)
884         result = 0;
885       else
886         mesg_implicit_function_declaration = 2;
887       break;
888
889     case OPT_Wfloat_equal:
890       warn_float_equal = on;
891       break;
892
893     case OPT_Wformat:
894       set_Wformat (on);
895       break;
896
897     case OPT_Wformat_eq:
898       set_Wformat (atoi (arg));
899       break;
900
901     case OPT_Wformat_extra_args:
902       warn_format_extra_args = on;
903       break;
904
905     case OPT_Wformat_nonliteral:
906       warn_format_nonliteral = on;
907       break;
908
909     case OPT_Wformat_security:
910       warn_format_security = on;
911       break;
912
913     case OPT_Wformat_y2k:
914       warn_format_y2k = on;
915       break;
916
917     case OPT_Wformat_zero_length:
918       warn_format_zero_length = on;
919       break;
920
921     case OPT_Wimplicit:
922       set_Wimplicit (on);
923       break;
924
925     case OPT_Wimplicit_function_decl:
926       mesg_implicit_function_declaration = on;
927       break;
928
929     case OPT_Wimplicit_int:
930       warn_implicit_int = on;
931       break;
932
933     case OPT_Wimport:
934       cpp_opts->warn_import = on;
935       break;
936
937     case OPT_Winvalid_pch:
938       cpp_opts->warn_invalid_pch = on;
939       break;
940
941     case OPT_Wlong_long:
942       warn_long_long = on;
943       break;
944
945     case OPT_Wmain:
946       if (on)
947         warn_main = 1;
948       else
949         warn_main = -1;
950       break;
951
952     case OPT_Wmissing_braces:
953       warn_missing_braces = on;
954       break;
955
956     case OPT_Wmissing_declarations:
957       warn_missing_declarations = on;
958       break;
959
960     case OPT_Wmissing_format_attribute:
961       warn_missing_format_attribute = on;
962       break;
963
964     case OPT_Wmissing_prototypes:
965       warn_missing_prototypes = on;
966       break;
967
968     case OPT_Wmultichar:
969       cpp_opts->warn_multichar = on;
970       break;
971
972     case OPT_Wnested_externs:
973       warn_nested_externs = on;
974       break;
975
976     case OPT_Wnon_template_friend:
977       warn_nontemplate_friend = on;
978       break;
979
980     case OPT_Wnon_virtual_dtor:
981       warn_nonvdtor = on;
982       break;
983
984     case OPT_Wnonnull:
985       warn_nonnull = on;
986       break;
987
988     case OPT_Wold_style_cast:
989       warn_old_style_cast = on;
990       break;
991
992     case OPT_Woverloaded_virtual:
993       warn_overloaded_virtual = on;
994       break;
995
996     case OPT_Wparentheses:
997       warn_parentheses = on;
998       break;
999
1000     case OPT_Wpmf_conversions:
1001       warn_pmf2ptr = on;
1002       break;
1003
1004     case OPT_Wpointer_arith:
1005       warn_pointer_arith = on;
1006       break;
1007
1008     case OPT_Wprotocol:
1009       warn_protocol = on;
1010       break;
1011
1012     case OPT_Wselector:
1013       warn_selector = on;
1014       break;
1015
1016     case OPT_Wredundant_decls:
1017       warn_redundant_decls = on;
1018       break;
1019
1020     case OPT_Wreorder:
1021       warn_reorder = on;
1022       break;
1023
1024     case OPT_Wreturn_type:
1025       warn_return_type = on;
1026       break;
1027
1028     case OPT_Wsequence_point:
1029       warn_sequence_point = on;
1030       break;
1031
1032     case OPT_Wsign_compare:
1033       warn_sign_compare = on;
1034       break;
1035
1036     case OPT_Wsign_promo:
1037       warn_sign_promo = on;
1038       break;
1039
1040     case OPT_Wstrict_prototypes:
1041       if (!on && c_language == clk_cplusplus)
1042         warning ("-Wno-strict-prototypes is not supported in C++");
1043       else
1044         warn_strict_prototypes = on;
1045       break;
1046
1047     case OPT_Wsynth:
1048       warn_synth = on;
1049       break;
1050
1051     case OPT_Wsystem_headers:
1052       cpp_opts->warn_system_headers = on;
1053       break;
1054
1055     case OPT_Wtraditional:
1056       warn_traditional = on;
1057       cpp_opts->warn_traditional = on;
1058       break;
1059
1060     case OPT_Wtrigraphs:
1061       cpp_opts->warn_trigraphs = on;
1062       break;
1063
1064     case OPT_Wundeclared_selector:
1065       warn_undeclared_selector = on;
1066       break;
1067
1068     case OPT_Wundef:
1069       cpp_opts->warn_undef = on;
1070       break;
1071
1072     case OPT_Wunknown_pragmas:
1073       /* Set to greater than 1, so that even unknown pragmas in
1074          system headers will be warned about.  */  
1075       warn_unknown_pragmas = on * 2;
1076       break;
1077
1078     case OPT_Wunused_macros:
1079       warn_unused_macros = on;
1080       break;
1081
1082     case OPT_Wwrite_strings:
1083       if (c_language == clk_c)
1084         flag_const_strings = on;
1085       else
1086         warn_write_strings = on;
1087       break;
1088       
1089     case OPT_ansi:
1090       if (c_language == clk_c)
1091         set_std_c89 (false, true);
1092       else
1093         set_std_cxx98 (true);
1094       break;
1095
1096     case OPT_d:
1097       handle_OPT_d (arg);
1098       break;
1099
1100     case OPT_fcond_mismatch:
1101       if (c_language == clk_c)
1102         {
1103           flag_cond_mismatch = on;
1104           break;
1105         }
1106       /* Fall through.  */
1107
1108     case OPT_fall_virtual:
1109     case OPT_fenum_int_equiv:
1110     case OPT_fguiding_decls:
1111     case OPT_fhonor_std:
1112     case OPT_fhuge_objects:
1113     case OPT_flabels_ok:
1114     case OPT_fname_mangling:
1115     case OPT_fnew_abi:
1116     case OPT_fnonnull_objects:
1117     case OPT_fsquangle:
1118     case OPT_fstrict_prototype:
1119     case OPT_fthis_is_variable:
1120     case OPT_fvtable_thunks:
1121     case OPT_fxref:
1122       warning ("switch \"%s\" is no longer supported", argv[0]);
1123       break;
1124
1125     case OPT_fabi_version:
1126       flag_abi_version = read_integral_parameter (arg, argv[0], 1);
1127       break;
1128
1129     case OPT_faccess_control:
1130       flag_access_control = on;
1131       break;
1132
1133     case OPT_falt_external_templates:
1134       flag_alt_external_templates = on;
1135       if (on)
1136         flag_external_templates = true;
1137     cp_deprecated:
1138       warning ("switch \"%s\" is deprecated, please see documentation for details", argv[0]);
1139       break;
1140
1141     case OPT_fasm:
1142       flag_no_asm = !on;
1143       break;
1144
1145     case OPT_fbuiltin:
1146       flag_no_builtin = !on;
1147       break;
1148
1149     case OPT_fbuiltin_:
1150       if (on)
1151         result = 0;
1152       else
1153         disable_builtin_function (arg);
1154       break;
1155
1156     case OPT_fdollars_in_identifiers:
1157       dollars_in_ident = on;
1158       break;
1159
1160     case OPT_fdump:
1161       if (!on || !dump_switch_p (argv[0] + strlen ("-f")))
1162         result = 0;
1163       break;
1164
1165     case OPT_ffreestanding:
1166       on = !on;
1167       /* Fall through...  */
1168     case OPT_fhosted:
1169       flag_hosted = on;
1170       flag_no_builtin = !on;
1171       /* warn_main will be 2 if set by -Wall, 1 if set by -Wmain */
1172       if (!on && warn_main == 2)
1173         warn_main = 0;
1174       break;
1175
1176     case OPT_fshort_double:
1177       flag_short_double = on;
1178       break;
1179
1180     case OPT_fshort_enums:
1181       flag_short_enums = on;
1182       break;
1183
1184     case OPT_fshort_wchar:
1185       flag_short_wchar = on;
1186       break;
1187
1188     case OPT_fsigned_bitfields:
1189       flag_signed_bitfields = on;
1190       explicit_flag_signed_bitfields = 1;
1191       break;
1192
1193     case OPT_fsigned_char:
1194       flag_signed_char = on;
1195       break;
1196
1197     case OPT_funsigned_bitfields:
1198       flag_signed_bitfields = !on;
1199       explicit_flag_signed_bitfields = 1;
1200       break;
1201
1202     case OPT_funsigned_char:
1203       flag_signed_char = !on;
1204       break;
1205
1206     case OPT_fcheck_new:
1207       flag_check_new = on;
1208       break;
1209
1210     case OPT_fconserve_space:
1211       flag_conserve_space = on;
1212       break;
1213
1214     case OPT_fconst_strings:
1215       flag_const_strings = on;
1216       break;
1217
1218     case OPT_fconstant_string_class:
1219       constant_string_class_name = arg;
1220       break;
1221
1222     case OPT_fdefault_inline:
1223       flag_default_inline = on;
1224       break;
1225
1226     case OPT_felide_constructors:
1227       flag_elide_constructors = on;
1228       break;
1229
1230     case OPT_fenforce_eh_specs:
1231       flag_enforce_eh_specs = on;
1232       break;
1233
1234     case OPT_fexternal_templates:
1235       flag_external_templates = on;
1236       goto cp_deprecated;
1237
1238     case OPT_ffixed_form:
1239     case OPT_ffixed_line_length:
1240       /* Fortran front end options ignored when preprocessing only.  */
1241       if (flag_preprocess_only)
1242         result = -1;
1243       break;
1244
1245     case OPT_ffor_scope:
1246       flag_new_for_scope = on;
1247       break;
1248
1249     case OPT_fgnu_keywords:
1250       flag_no_gnu_keywords = !on;
1251       break;
1252
1253     case OPT_fgnu_runtime:
1254       flag_next_runtime = !on;
1255       break;
1256
1257     case OPT_fhandle_exceptions:
1258       warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)");
1259       flag_exceptions = on;
1260       break;
1261
1262     case OPT_fimplement_inlines:
1263       flag_implement_inlines = on;
1264       break;
1265
1266     case OPT_fimplicit_inline_templates:
1267       flag_implicit_inline_templates = on;
1268       break;
1269
1270     case OPT_fimplicit_templates:
1271       flag_implicit_templates = on;
1272       break;
1273
1274     case OPT_fms_extensions:
1275       flag_ms_extensions = on;
1276       break;
1277
1278     case OPT_fnext_runtime:
1279       flag_next_runtime = on;
1280       break;
1281
1282     case OPT_fnonansi_builtins:
1283       flag_no_nonansi_builtin = !on;
1284       break;
1285
1286     case OPT_foperator_names:
1287       cpp_opts->operator_names = on;
1288       break;
1289
1290     case OPT_foptional_diags:
1291       flag_optional_diags = on;
1292       break;
1293
1294     case OPT_fpch_deps:
1295       cpp_opts->restore_pch_deps = on;
1296       break;
1297
1298     case OPT_fpermissive:
1299       flag_permissive = on;
1300       break;
1301
1302     case OPT_fpreprocessed:
1303       cpp_opts->preprocessed = on;
1304       break;
1305
1306     case OPT_frepo:
1307       flag_use_repository = on;
1308       if (on)
1309         flag_implicit_templates = 0;
1310       break;
1311
1312     case OPT_frtti:
1313       flag_rtti = on;
1314       break;
1315
1316     case OPT_fshow_column:
1317       cpp_opts->show_column = on;
1318       break;
1319
1320     case OPT_fstats:
1321       flag_detailed_statistics = on;
1322       break;
1323
1324     case OPT_ftabstop:
1325       /* Don't recognize -fno-tabstop=.  */
1326       if (!on)
1327         return 0;
1328
1329       /* It is documented that we silently ignore silly values.  */
1330         {
1331           char *endptr;
1332           long tabstop = strtol (arg, &endptr, 10);
1333           if (*endptr == '\0' && tabstop >= 1 && tabstop <= 100)
1334             cpp_opts->tabstop = tabstop;
1335         }
1336       break;
1337
1338     case OPT_ftemplate_depth:
1339       max_tinst_depth = read_integral_parameter (arg, argv[0], 0);
1340       break;
1341
1342     case OPT_fvtable_gc:
1343       flag_vtable_gc = on;
1344       break;
1345
1346     case OPT_fuse_cxa_atexit:
1347       flag_use_cxa_atexit = on;
1348       break;
1349
1350     case OPT_fweak:
1351       flag_weak = on;
1352       break;
1353
1354     case OPT_gen_decls:
1355       flag_gen_declaration = 1;
1356       break;
1357
1358     case OPT_idirafter:
1359       add_path (xstrdup (arg), AFTER, 0);
1360       break;
1361
1362     case OPT_imacros:
1363     case OPT_include:
1364       defer_opt (code, arg);
1365       break;
1366
1367     case OPT_iprefix:
1368       iprefix = arg;
1369       break;
1370
1371     case OPT_isysroot:
1372       sysroot = arg;
1373       break;
1374
1375     case OPT_isystem:
1376       add_path (xstrdup (arg), SYSTEM, 0);
1377       break;
1378
1379     case OPT_iwithprefix:
1380       add_prefixed_path (arg, SYSTEM);
1381       break;
1382
1383     case OPT_iwithprefixbefore:
1384       add_prefixed_path (arg, BRACKET);
1385       break;
1386
1387     case OPT_lang_asm:
1388       cpp_set_lang (parse_in, CLK_ASM);
1389       break;
1390
1391     case OPT_lang_objc:
1392       cpp_opts->objc = 1;
1393       break;
1394
1395     case OPT_nostdinc:
1396       std_inc = false;
1397       break;
1398
1399     case OPT_nostdincplusplus:
1400       std_cxx_inc = false;
1401       break;
1402
1403     case OPT_o:
1404       if (!out_fname)
1405         out_fname = arg;
1406       else
1407         {
1408           error ("output filename specified twice");
1409           result = argc;
1410         }
1411       break;
1412
1413       /* We need to handle the -pedantic switches here, rather than in
1414          c_common_post_options, so that a subsequent -Wno-endif-labels
1415          is not overridden.  */
1416     case OPT_pedantic_errors:
1417       cpp_opts->pedantic_errors = 1;
1418       /* fall through */
1419     case OPT_pedantic:
1420       cpp_opts->pedantic = 1;
1421       cpp_opts->warn_endif_labels = 1;
1422       break;
1423
1424     case OPT_print_objc_runtime_info:
1425       print_struct_values = 1;
1426       break;
1427
1428     case OPT_remap:
1429       cpp_opts->remap = 1;
1430       break;
1431
1432     case OPT_std_cplusplus98:
1433     case OPT_std_gnuplusplus98:
1434       set_std_cxx98 (code == OPT_std_cplusplus98 /* ISO */);
1435       break;
1436
1437     case OPT_std_c89:
1438     case OPT_std_iso9899_1990:
1439     case OPT_std_iso9899_199409:
1440       set_std_c89 (code == OPT_std_iso9899_199409 /* c94 */, true /* ISO */);
1441       break;
1442
1443     case OPT_std_gnu89:
1444       set_std_c89 (false /* c94 */, false /* ISO */);
1445       break;
1446
1447     case OPT_std_c99:
1448     case OPT_std_c9x:
1449     case OPT_std_iso9899_1999:
1450     case OPT_std_iso9899_199x:
1451       set_std_c99 (true /* ISO */);
1452       break;
1453
1454     case OPT_std_gnu99:
1455     case OPT_std_gnu9x:
1456       set_std_c99 (false /* ISO */);
1457       break;
1458
1459     case OPT_trigraphs:
1460       cpp_opts->trigraphs = 1;
1461       break;
1462
1463     case OPT_traditional_cpp:
1464       cpp_opts->traditional = 1;
1465       break;
1466
1467     case OPT_undef:
1468       flag_undef = 1;
1469       break;
1470
1471     case OPT_w:
1472       cpp_opts->inhibit_warnings = 1;
1473       break;
1474
1475     case OPT_v:
1476       verbose = true;
1477       break;
1478     }
1479
1480  done:
1481   if (dup)
1482     free (dup);
1483   return result;
1484 }
1485
1486 /* Post-switch processing.  */
1487 bool
1488 c_common_post_options (pfilename)
1489      const char **pfilename;
1490 {
1491   /* Canonicalize the input and output filenames.  */
1492   if (in_fname == NULL || !strcmp (in_fname, "-"))
1493     in_fname = "";
1494
1495   if (out_fname == NULL || !strcmp (out_fname, "-"))
1496     out_fname = "";
1497
1498   if (cpp_opts->deps.style == DEPS_NONE)
1499     check_deps_environment_vars ();
1500
1501   handle_deferred_opts ();
1502
1503   sanitize_cpp_opts ();
1504
1505   register_include_chains (parse_in, sysroot, iprefix,
1506                            std_inc, std_cxx_inc && c_language == clk_cplusplus,
1507                            verbose);
1508
1509   flag_inline_trees = 1;
1510
1511   /* Use tree inlining if possible.  Function instrumentation is only
1512      done in the RTL level, so we disable tree inlining.  */
1513   if (! flag_instrument_function_entry_exit)
1514     {
1515       if (!flag_no_inline)
1516         flag_no_inline = 1;
1517       if (flag_inline_functions)
1518         {
1519           flag_inline_trees = 2;
1520           flag_inline_functions = 0;
1521         }
1522     }
1523
1524   /* Special format checking options don't work without -Wformat; warn if
1525      they are used.  */
1526   if (warn_format_y2k && !warn_format)
1527     warning ("-Wformat-y2k ignored without -Wformat");
1528   if (warn_format_extra_args && !warn_format)
1529     warning ("-Wformat-extra-args ignored without -Wformat");
1530   if (warn_format_zero_length && !warn_format)
1531     warning ("-Wformat-zero-length ignored without -Wformat");
1532   if (warn_format_nonliteral && !warn_format)
1533     warning ("-Wformat-nonliteral ignored without -Wformat");
1534   if (warn_format_security && !warn_format)
1535     warning ("-Wformat-security ignored without -Wformat");
1536   if (warn_missing_format_attribute && !warn_format)
1537     warning ("-Wmissing-format-attribute ignored without -Wformat");
1538
1539   if (flag_preprocess_only)
1540     {
1541       /* Open the output now.  We must do so even if flag_no_output is
1542          on, because there may be other output than from the actual
1543          preprocessing (e.g. from -dM).  */
1544       if (out_fname[0] == '\0')
1545         out_stream = stdout;
1546       else
1547         out_stream = fopen (out_fname, "w");
1548
1549       if (out_stream == NULL)
1550         {
1551           fatal_io_error ("opening output file %s", out_fname);
1552           return false;
1553         }
1554
1555       init_pp_output (out_stream);
1556     }
1557   else
1558     {
1559       init_c_lex ();
1560
1561       /* Yuk.  WTF is this?  I do know ObjC relies on it somewhere.  */
1562       lineno = 0;
1563     }
1564
1565   cpp_get_callbacks (parse_in)->file_change = cb_file_change;
1566
1567   /* NOTE: we use in_fname here, not the one supplied.  */
1568   *pfilename = cpp_read_main_file (parse_in, in_fname, ident_hash);
1569
1570   saved_lineno = lineno;
1571   lineno = 0;
1572
1573   /* If an error has occurred in cpplib, note it so we fail
1574      immediately.  */
1575   errorcount += cpp_errors (parse_in);
1576
1577   return flag_preprocess_only;
1578 }
1579
1580 /* Front end initialization common to C, ObjC and C++.  */
1581 bool
1582 c_common_init ()
1583 {
1584   lineno = saved_lineno;
1585
1586   /* Set up preprocessor arithmetic.  Must be done after call to
1587      c_common_nodes_and_builtins for type nodes to be good.  */
1588   cpp_opts->precision = TYPE_PRECISION (intmax_type_node);
1589   cpp_opts->char_precision = TYPE_PRECISION (char_type_node);
1590   cpp_opts->int_precision = TYPE_PRECISION (integer_type_node);
1591   cpp_opts->wchar_precision = TYPE_PRECISION (wchar_type_node);
1592   cpp_opts->unsigned_wchar = TREE_UNSIGNED (wchar_type_node);
1593
1594   if (flag_preprocess_only)
1595     {
1596       finish_options ();
1597       preprocess_file (parse_in);
1598       return false;
1599     }
1600
1601   /* Has to wait until now so that cpplib has its hash table.  */
1602   init_pragma ();
1603
1604   return true;
1605 }
1606
1607 /* A thin wrapper around the real parser that initializes the 
1608    integrated preprocessor after debug output has been initialized.
1609    Also, make sure the start_source_file debug hook gets called for
1610    the primary source file.  */
1611 void
1612 c_common_parse_file (set_yydebug)
1613      int set_yydebug ATTRIBUTE_UNUSED;
1614 {
1615 #if YYDEBUG != 0
1616   yydebug = set_yydebug;
1617 #else
1618   warning ("YYDEBUG not defined");
1619 #endif
1620
1621   (*debug_hooks->start_source_file) (lineno, input_filename);
1622   finish_options();
1623   pch_init();
1624   yyparse ();
1625   free_parser_stacks ();
1626 }
1627
1628 /* Common finish hook for the C, ObjC and C++ front ends.  */
1629 void
1630 c_common_finish ()
1631 {
1632   FILE *deps_stream = NULL;
1633
1634   if (cpp_opts->deps.style != DEPS_NONE)
1635     {
1636       /* If -M or -MM was seen without -MF, default output to the
1637          output stream.  */
1638       if (!deps_file)
1639         deps_stream = out_stream;
1640       else
1641         {
1642           deps_stream = fopen (deps_file, deps_append ? "a": "w");
1643           if (!deps_stream)
1644             fatal_io_error ("opening dependency file %s", deps_file);
1645         }
1646     }
1647
1648   /* For performance, avoid tearing down cpplib's internal structures
1649      with cpp_destroy ().  */
1650   errorcount += cpp_finish (parse_in, deps_stream);
1651
1652   if (deps_stream && deps_stream != out_stream
1653       && (ferror (deps_stream) || fclose (deps_stream)))
1654     fatal_io_error ("closing dependency file %s", deps_file);
1655
1656   if (out_stream && (ferror (out_stream) || fclose (out_stream)))
1657     fatal_io_error ("when writing output to %s", out_fname);
1658 }
1659
1660 /* Either of two environment variables can specify output of
1661    dependencies.  Their value is either "OUTPUT_FILE" or "OUTPUT_FILE
1662    DEPS_TARGET", where OUTPUT_FILE is the file to write deps info to
1663    and DEPS_TARGET is the target to mention in the deps.  They also
1664    result in dependency information being appended to the output file
1665    rather than overwriting it, and like Sun's compiler
1666    SUNPRO_DEPENDENCIES suppresses the dependency on the main file.  */
1667 static void
1668 check_deps_environment_vars ()
1669 {
1670   char *spec;
1671
1672   GET_ENVIRONMENT (spec, "DEPENDENCIES_OUTPUT");
1673   if (spec)
1674     cpp_opts->deps.style = DEPS_USER;
1675   else
1676     {
1677       GET_ENVIRONMENT (spec, "SUNPRO_DEPENDENCIES");
1678       if (spec)
1679         {
1680           cpp_opts->deps.style = DEPS_SYSTEM;
1681           cpp_opts->deps.ignore_main_file = true;
1682         }
1683     }
1684
1685   if (spec)
1686     {
1687       /* Find the space before the DEPS_TARGET, if there is one.  */
1688       char *s = strchr (spec, ' ');
1689       if (s)
1690         {
1691           /* Let the caller perform MAKE quoting.  */
1692           defer_opt (OPT_MT, s + 1);
1693           *s = '\0';
1694         }
1695
1696       /* Command line -MF overrides environment variables and default.  */
1697       if (!deps_file)
1698         deps_file = spec;
1699
1700       deps_append = 1;
1701     }
1702 }
1703
1704 /* Handle deferred command line switches.  */
1705 static void
1706 handle_deferred_opts ()
1707 {
1708   size_t i;
1709
1710   for (i = 0; i < deferred_count; i++)
1711     {
1712       struct deferred_opt *opt = &deferred_opts[i];
1713
1714       if (opt->code == OPT_MT || opt->code == OPT_MQ)
1715         cpp_add_dependency_target (parse_in, opt->arg, opt->code == OPT_MQ);
1716     }
1717 }
1718
1719 /* These settings are appropriate for GCC, but not necessarily so for
1720    cpplib as a library.  */
1721 static void
1722 sanitize_cpp_opts ()
1723 {
1724   /* If we don't know what style of dependencies to output, complain
1725      if any other dependency switches have been given.  */
1726   if (deps_seen && cpp_opts->deps.style == DEPS_NONE)
1727     error ("to generate dependencies you must specify either -M or -MM");
1728
1729   /* -dM and dependencies suppress normal output; do it here so that
1730      the last -d[MDN] switch overrides earlier ones.  */
1731   if (flag_dump_macros == 'M')
1732     flag_no_output = 1;
1733
1734   /* Disable -dD, -dN and -dI if normal output is suppressed.  Allow
1735      -dM since at least glibc relies on -M -dM to work.  */
1736   if (flag_no_output)
1737     {
1738       if (flag_dump_macros != 'M')
1739         flag_dump_macros = 0;
1740       flag_dump_includes = 0;
1741     }
1742
1743   cpp_opts->unsigned_char = !flag_signed_char;
1744   cpp_opts->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS;
1745
1746   /* We want -Wno-long-long to override -pedantic -std=non-c99
1747      and/or -Wtraditional, whatever the ordering.  */
1748   cpp_opts->warn_long_long
1749     = warn_long_long && ((!flag_isoc99 && pedantic) || warn_traditional);
1750 }
1751
1752 /* Add include path with a prefix at the front of its name.  */
1753 static void
1754 add_prefixed_path (suffix, chain)
1755      const char *suffix;
1756      size_t chain;
1757 {
1758   char *path;
1759   const char *prefix;
1760   size_t prefix_len, suffix_len;
1761
1762   suffix_len = strlen (suffix);
1763   prefix     = iprefix ? iprefix : cpp_GCC_INCLUDE_DIR;
1764   prefix_len = iprefix ? strlen (iprefix) : cpp_GCC_INCLUDE_DIR_len;
1765
1766   path = xmalloc (prefix_len + suffix_len + 1);
1767   memcpy (path, prefix, prefix_len);
1768   memcpy (path + prefix_len, suffix, suffix_len);
1769   path[prefix_len + suffix_len] = '\0';
1770
1771   add_path (path, chain, 0);
1772 }
1773
1774 /* Handle -D, -U, -A, -imacros, and the first -include.  */
1775 static void
1776 finish_options ()
1777 {
1778   if (!cpp_opts->preprocessed)
1779     {
1780       size_t i;
1781
1782       cpp_rename_file (parse_in, _("<built-in>"));
1783       cpp_init_builtins (parse_in);
1784       c_cpp_builtins (parse_in);
1785       cpp_rename_file (parse_in, _("<command line>"));
1786       for (i = 0; i < deferred_count; i++)
1787         {
1788           struct deferred_opt *opt = &deferred_opts[i];
1789
1790           if (opt->code == OPT_D)
1791             cpp_define (parse_in, opt->arg);
1792           else if (opt->code == OPT_U)
1793             cpp_undef (parse_in, opt->arg);
1794           else if (opt->code == OPT_A)
1795             {
1796               if (opt->arg[0] == '-')
1797                 cpp_unassert (parse_in, opt->arg + 1);
1798               else
1799                 cpp_assert (parse_in, opt->arg);
1800             }
1801         }
1802
1803       /* Handle -imacros after -D and -U.  */
1804       for (i = 0; i < deferred_count; i++)
1805         {
1806           struct deferred_opt *opt = &deferred_opts[i];
1807
1808           if (opt->code == OPT_imacros
1809               && cpp_push_include (parse_in, opt->arg))
1810             cpp_scan_nooutput (parse_in);
1811         }
1812     }
1813
1814   push_command_line_include ();
1815 }
1816
1817 /* Give CPP the next file given by -include, if any.  */
1818 static void
1819 push_command_line_include ()
1820 {
1821   if (cpp_opts->preprocessed)
1822     return;
1823     
1824   while (include_cursor < deferred_count)
1825     {
1826       struct deferred_opt *opt = &deferred_opts[include_cursor++];
1827       
1828       if (opt->code == OPT_include && cpp_push_include (parse_in, opt->arg))
1829         return;
1830     }
1831
1832   if (include_cursor == deferred_count)
1833     {
1834       /* Restore the line map from <command line>.  */
1835       cpp_rename_file (parse_in, main_input_filename);
1836       /* -Wunused-macros should only warn about macros defined hereafter.  */
1837       cpp_opts->warn_unused_macros = warn_unused_macros;
1838       include_cursor++;
1839     }
1840 }
1841
1842 /* File change callback.  Has to handle -include files.  */
1843 static void
1844 cb_file_change (pfile, new_map)
1845      cpp_reader *pfile ATTRIBUTE_UNUSED;
1846      const struct line_map *new_map;
1847 {
1848   if (flag_preprocess_only)
1849     pp_file_change (new_map);
1850   else
1851     fe_file_change (new_map);
1852
1853   if (new_map->reason == LC_LEAVE && MAIN_FILE_P (new_map))
1854     push_command_line_include ();
1855 }
1856
1857 /* Set the C 89 standard (with 1994 amendments if C94, without GNU
1858    extensions if ISO).  There is no concept of gnu94.  */
1859 static void
1860 set_std_c89 (c94, iso)
1861      int c94, iso;
1862 {
1863   cpp_set_lang (parse_in, c94 ? CLK_STDC94: iso ? CLK_STDC89: CLK_GNUC89);
1864   flag_iso = iso;
1865   flag_no_asm = iso;
1866   flag_no_gnu_keywords = iso;
1867   flag_no_nonansi_builtin = iso;
1868   flag_noniso_default_format_attributes = !iso;
1869   flag_isoc94 = c94;
1870   flag_isoc99 = 0;
1871   flag_writable_strings = 0;
1872 }
1873
1874 /* Set the C 99 standard (without GNU extensions if ISO).  */
1875 static void
1876 set_std_c99 (iso)
1877      int iso;
1878 {
1879   cpp_set_lang (parse_in, iso ? CLK_STDC99: CLK_GNUC99);
1880   flag_no_asm = iso;
1881   flag_no_nonansi_builtin = iso;
1882   flag_noniso_default_format_attributes = !iso;
1883   flag_iso = iso;
1884   flag_isoc99 = 1;
1885   flag_isoc94 = 1;
1886   flag_writable_strings = 0;
1887 }
1888
1889 /* Set the C++ 98 standard (without GNU extensions if ISO).  */
1890 static void
1891 set_std_cxx98 (iso)
1892      int iso;
1893 {
1894   cpp_set_lang (parse_in, iso ? CLK_CXX98: CLK_GNUCXX);
1895   flag_no_gnu_keywords = iso;
1896   flag_no_nonansi_builtin = iso;
1897   flag_noniso_default_format_attributes = !iso;
1898   flag_iso = iso;
1899 }
1900
1901 /* Handle setting implicit to ON.  */
1902 static void
1903 set_Wimplicit (on)
1904      int on;
1905 {
1906   warn_implicit = on;
1907   warn_implicit_int = on;
1908   if (on)
1909     {
1910       if (mesg_implicit_function_declaration != 2)
1911         mesg_implicit_function_declaration = 1;
1912     }
1913   else
1914     mesg_implicit_function_declaration = 0;
1915 }
1916
1917 /* Args to -d specify what to dump.  Silently ignore
1918    unrecognized options; they may be aimed at toplev.c.  */
1919 static void
1920 handle_OPT_d (arg)
1921      const char *arg;
1922 {
1923   char c;
1924
1925   while ((c = *arg++) != '\0')
1926     switch (c)
1927       {
1928       case 'M':                 /* Dump macros only.  */
1929       case 'N':                 /* Dump names.  */
1930       case 'D':                 /* Dump definitions.  */
1931         flag_dump_macros = c;
1932         break;
1933
1934       case 'I':
1935         flag_dump_includes = 1;
1936         break;
1937       }
1938 }
1939
1940 /* Write a slash-separated list of languages in FLAGS to BUF.  */
1941 static void
1942 write_langs (buf, flags)
1943      char *buf;
1944      int flags;
1945 {
1946   *buf = '\0';
1947   if (flags & CL_C_ONLY)
1948     strcat (buf, "C");
1949   if (flags & CL_OBJC_ONLY)
1950     {
1951       if (*buf)
1952         strcat (buf, "/");
1953       strcat (buf, "ObjC");
1954     }
1955   if (flags & CL_CXX_ONLY)
1956     {
1957       if (*buf)
1958         strcat (buf, "/");
1959       strcat (buf, "C++");
1960     }
1961 }
1962
1963 /* Complain that switch OPT_INDEX does not apply to this front end.  */
1964 static void
1965 complain_wrong_lang (opt_index)
1966      size_t opt_index;
1967 {
1968   char ok_langs[60], bad_langs[60];
1969   int ok_flags = cl_options[opt_index].flags;
1970
1971   write_langs (ok_langs, ok_flags);
1972   write_langs (bad_langs, ~ok_flags);
1973   warning ("\"-%s\" is valid for %s but not for %s",
1974            cl_options[opt_index].opt_text, ok_langs, bad_langs);
1975 }
1976
1977 /* Handle --help output.  */
1978 static void
1979 print_help ()
1980 {
1981   /* To keep the lines from getting too long for some compilers, limit
1982      to about 500 characters (6 lines) per chunk.  */
1983   fputs (_("\
1984 Switches:\n\
1985   -include <file>           Include the contents of <file> before other files\n\
1986   -imacros <file>           Accept definition of macros in <file>\n\
1987   -iprefix <path>           Specify <path> as a prefix for next two options\n\
1988   -iwithprefix <dir>        Add <dir> to the end of the system include path\n\
1989   -iwithprefixbefore <dir>  Add <dir> to the end of the main include path\n\
1990   -isystem <dir>            Add <dir> to the start of the system include path\n\
1991 "), stdout);
1992   fputs (_("\
1993   -idirafter <dir>          Add <dir> to the end of the system include path\n\
1994   -I <dir>                  Add <dir> to the end of the main include path\n\
1995   -I-                       Fine-grained include path control; see info docs\n\
1996   -nostdinc                 Do not search system include directories\n\
1997                              (dirs specified with -isystem will still be used)\n\
1998   -nostdinc++               Do not search system include directories for C++\n\
1999   -o <file>                 Put output into <file>\n\
2000 "), stdout);
2001   fputs (_("\
2002   -trigraphs                Support ISO C trigraphs\n\
2003   -std=<std name>           Specify the conformance standard; one of:\n\
2004                             gnu89, gnu99, c89, c99, iso9899:1990,\n\
2005                             iso9899:199409, iso9899:1999, c++98\n\
2006   -w                        Inhibit warning messages\n\
2007   -W[no-]trigraphs          Warn if trigraphs are encountered\n\
2008   -W[no-]comment{s}         Warn if one comment starts inside another\n\
2009 "), stdout);
2010   fputs (_("\
2011   -W[no-]traditional        Warn about features not present in traditional C\n\
2012   -W[no-]undef              Warn if an undefined macro is used by #if\n\
2013   -W[no-]import             Warn about the use of the #import directive\n\
2014 "), stdout);
2015   fputs (_("\
2016   -W[no-]error              Treat all warnings as errors\n\
2017   -W[no-]system-headers     Do not suppress warnings from system headers\n\
2018   -W[no-]all                Enable most preprocessor warnings\n\
2019 "), stdout);
2020   fputs (_("\
2021   -M                        Generate make dependencies\n\
2022   -MM                       As -M, but ignore system header files\n\
2023   -MD                       Generate make dependencies and compile\n\
2024   -MMD                      As -MD, but ignore system header files\n\
2025   -MF <file>                Write dependency output to the given file\n\
2026   -MG                       Treat missing header file as generated files\n\
2027 "), stdout);
2028   fputs (_("\
2029   -MP                       Generate phony targets for all headers\n\
2030   -MQ <target>              Add a MAKE-quoted target\n\
2031   -MT <target>              Add an unquoted target\n\
2032 "), stdout);
2033   fputs (_("\
2034   -D<macro>                 Define a <macro> with string '1' as its value\n\
2035   -D<macro>=<val>           Define a <macro> with <val> as its value\n\
2036   -A<question>=<answer>     Assert the <answer> to <question>\n\
2037   -A-<question>=<answer>    Disable the <answer> to <question>\n\
2038   -U<macro>                 Undefine <macro> \n\
2039   -v                        Display the version number\n\
2040 "), stdout);
2041   fputs (_("\
2042   -H                        Print the name of header files as they are used\n\
2043   -C                        Do not discard comments\n\
2044   -dM                       Display a list of macro definitions active at end\n\
2045   -dD                       Preserve macro definitions in output\n\
2046   -dN                       As -dD except that only the names are preserved\n\
2047   -dI                       Include #include directives in the output\n\
2048 "), stdout);
2049   fputs (_("\
2050   -f[no-]preprocessed       Treat the input file as already preprocessed\n\
2051   -ftabstop=<number>        Distance between tab stops for column reporting\n\
2052   -isysroot <dir>           Set <dir> to be the system root directory\n\
2053   -P                        Do not generate #line directives\n\
2054   -remap                    Remap file names when including files\n\
2055   --help                    Display this information\n\
2056 "), stdout);
2057 }