OSDN Git Service

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