1 /* C/ObjC/C++ command line option handling.
2 Copyright (C) 2002 Free Software Foundation, Inc.
3 Contributed by Neil Booth.
5 This file is part of GCC.
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
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
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
29 #include "langhooks.h"
30 #include "tree-inline.h"
31 #include "diagnostic.h"
35 static cpp_options
*cpp_opts
;
38 static const char *in_fname
;
40 /* Filename and stream for preprocessed output. */
41 static const char *out_fname
;
42 static FILE *out_stream
;
44 /* Append dependencies to deps_file. */
45 static bool deps_append
;
47 /* If dependency switches (-MF etc.) have been given. */
48 static bool deps_seen
;
50 /* Dependency output file. */
51 static const char *deps_file
;
53 /* Number of deferred options, deferred options array size. */
54 static size_t deferred_count
, deferred_size
;
56 static void missing_arg
PARAMS ((size_t));
57 static size_t find_opt
PARAMS ((const char *, int));
58 static void set_Wimplicit
PARAMS ((int));
59 static void complain_wrong_lang
PARAMS ((size_t));
60 static void write_langs
PARAMS ((char *, int));
61 static void print_help
PARAMS ((void));
62 static void handle_OPT_d
PARAMS ((const char *));
63 static void set_std_cxx98
PARAMS ((int));
64 static void set_std_c89
PARAMS ((int, int));
65 static void set_std_c99
PARAMS ((int));
66 static void check_deps_environment_vars
PARAMS ((void));
67 static void preprocess_file
PARAMS ((void));
68 static void handle_deferred_opts
PARAMS ((void));
69 static void sanitize_cpp_opts
PARAMS ((void));
71 #ifndef STDC_0_IN_SYSTEM_HEADERS
72 #define STDC_0_IN_SYSTEM_HEADERS 0
75 #define CL_C_ONLY (1 << 0) /* Only C. */
76 #define CL_OBJC_ONLY (1 << 1) /* Only ObjC. */
77 #define CL_CXX_ONLY (1 << 2) /* Only C++. */
78 #define CL_OBJCXX_ONLY (1 << 3) /* Only ObjC++. */
79 #define CL_JOINED (1 << 4) /* If takes joined argument. */
80 #define CL_SEPARATE (1 << 5) /* If takes a separate argument. */
82 #define CL_ARG (CL_JOINED | CL_SEPARATE)
83 #define CL_C (CL_C_ONLY | CL_OBJC_ONLY)
84 #define CL_OBJC (CL_OBJC_ONLY | CL_OBJCXX_ONLY)
85 #define CL_CXX (CL_CXX_ONLY | CL_OBJCXX_ONLY)
86 #define CL_ALL (CL_C | CL_CXX)
88 /* This is the list of all command line options, with the leading "-"
89 removed. It must be sorted in ASCII collating order. All options
90 beginning with "f" or "W" are implicitly assumed to take a "no-"
91 form; this form should not be listed. The variable "on" is true if
92 the positive form is given, otherwise it is false. If you don't
93 want to allow a "no-" form, your handler should reject "on" being
94 false by returning zero. See, for example, the handling of
97 If the user gives an option to a front end that doesn't support it,
98 an error is output, mentioning which front ends the option is valid
99 for. If you don't want this, you must accept it for all front
100 ends, and test for the front end in the option handler. See, for
101 example, the handling of -Wno-strict-prototypes for C++.
103 If you request an argument with CL_JOINED, CL_SEPARATE or their
104 combination CL_ARG, it is stored in the variable "arg", which is
105 guaranteed to be non-NULL and to not be an empty string. It points
106 to the argument either within the argv[] vector or within one of
107 that vector's strings, and so the text is permanent and copies need
108 not be made. Be sure to add an error message in missing_arg() if
109 the default is not appropriate. */
111 #define COMMAND_LINE_OPTIONS \
112 OPT("-help", CL_ALL, OPT__help) \
113 OPT("C", CL_ALL, OPT_C) \
114 OPT("CC", CL_ALL, OPT_CC) \
115 OPT("E", CL_ALL, OPT_E) \
116 OPT("H", CL_ALL, OPT_H) \
117 OPT("M", CL_ALL, OPT_M) \
118 OPT("MD", CL_ALL | CL_SEPARATE, OPT_MD) \
119 OPT("MF", CL_ALL | CL_ARG, OPT_MF) \
120 OPT("MG", CL_ALL, OPT_MG) \
121 OPT("MM", CL_ALL, OPT_MM) \
122 OPT("MMD", CL_ALL | CL_SEPARATE, OPT_MMD) \
123 OPT("MP", CL_ALL, OPT_MP) \
124 OPT("MQ", CL_ALL | CL_ARG, OPT_MQ) \
125 OPT("MT", CL_ALL | CL_ARG, OPT_MT) \
126 OPT("P", CL_ALL, OPT_P) \
127 OPT("Wabi", CL_CXX, OPT_Wabi) \
128 OPT("Wall", CL_ALL, OPT_Wall) \
129 OPT("Wbad-function-cast", CL_C, OPT_Wbad_function_cast) \
130 OPT("Wcast-qual", CL_ALL, OPT_Wcast_qual) \
131 OPT("Wchar-subscripts", CL_ALL, OPT_Wchar_subscripts) \
132 OPT("Wcomment", CL_ALL, OPT_Wcomment) \
133 OPT("Wcomments", CL_ALL, OPT_Wcomments) \
134 OPT("Wconversion", CL_ALL, OPT_Wconversion) \
135 OPT("Wctor-dtor-privacy", CL_CXX, OPT_Wctor_dtor_privacy) \
136 OPT("Wdeprecated", CL_CXX, OPT_Wdeprecated) \
137 OPT("Wdiv-by-zero", CL_C, OPT_Wdiv_by_zero) \
138 OPT("Weffc++", CL_CXX, OPT_Weffcxx) \
139 OPT("Wendif-labels", CL_ALL, OPT_Wendif_labels) \
140 OPT("Werror", CL_ALL, OPT_Werror) \
141 OPT("Werror-implicit-function-declaration", \
142 CL_C, OPT_Werror_implicit_function_decl) \
143 OPT("Wfloat-equal", CL_ALL, OPT_Wfloat_equal) \
144 OPT("Wformat", CL_ALL, OPT_Wformat) \
145 OPT("Wformat-extra-args", CL_ALL, OPT_Wformat_extra_args) \
146 OPT("Wformat-nonliteral", CL_ALL, OPT_Wformat_nonliteral) \
147 OPT("Wformat-security", CL_ALL, OPT_Wformat_security) \
148 OPT("Wformat-y2k", CL_ALL, OPT_Wformat_y2k) \
149 OPT("Wformat-zero-length", CL_C, OPT_Wformat_zero_length) \
150 OPT("Wformat=", CL_ALL | CL_JOINED, OPT_Wformat_eq) \
151 OPT("Wimplicit", CL_CXX, OPT_Wimplicit) \
152 OPT("Wimplicit-function-declaration", CL_C, OPT_Wimplicit_function_decl) \
153 OPT("Wimplicit-int", CL_C, OPT_Wimplicit_int) \
154 OPT("Wimport", CL_ALL, OPT_Wimport) \
155 OPT("Wlong-long", CL_ALL, OPT_Wlong_long) \
156 OPT("Wmain", CL_C, OPT_Wmain) \
157 OPT("Wmissing-braces", CL_ALL, OPT_Wmissing_braces) \
158 OPT("Wmissing-declarations", CL_C, OPT_Wmissing_declarations) \
159 OPT("Wmissing-format-attribute",CL_ALL, OPT_Wmissing_format_attribute) \
160 OPT("Wmissing-prototypes", CL_ALL, OPT_Wmissing_prototypes) \
161 OPT("Wmultichar", CL_ALL, OPT_Wmultichar) \
162 OPT("Wnested-externs", CL_C, OPT_Wnested_externs) \
163 OPT("Wnon-template-friend", CL_CXX, OPT_Wnon_template_friend) \
164 OPT("Wnon-virtual-dtor", CL_CXX, OPT_Wnon_virtual_dtor) \
165 OPT("Wnonnull", CL_C, OPT_Wnonnull) \
166 OPT("Wold-style-cast", CL_CXX, OPT_Wold_style_cast) \
167 OPT("Woverloaded-virtual", CL_CXX, OPT_Woverloaded_virtual) \
168 OPT("Wparentheses", CL_ALL, OPT_Wparentheses) \
169 OPT("Wpmf-conversions", CL_CXX, OPT_Wpmf_conversions) \
170 OPT("Wpointer-arith", CL_ALL, OPT_Wpointer_arith) \
171 OPT("Wprotocol", CL_OBJC, OPT_Wprotocol) \
172 OPT("Wredundant-decls", CL_ALL, OPT_Wredundant_decls) \
173 OPT("Wreorder", CL_CXX, OPT_Wreorder) \
174 OPT("Wreturn-type", CL_ALL, OPT_Wreturn_type) \
175 OPT("Wselector", CL_OBJC, OPT_Wselector) \
176 OPT("Wsequence-point", CL_C, OPT_Wsequence_point) \
177 OPT("Wsign-compare", CL_ALL, OPT_Wsign_compare) \
178 OPT("Wsign-promo", CL_CXX, OPT_Wsign_promo) \
179 OPT("Wstrict-prototypes", CL_ALL, OPT_Wstrict_prototypes) \
180 OPT("Wsynth", CL_CXX, OPT_Wsynth) \
181 OPT("Wsystem-headers", CL_ALL, OPT_Wsystem_headers) \
182 OPT("Wtraditional", CL_C, OPT_Wtraditional) \
183 OPT("Wtrigraphs", CL_ALL, OPT_Wtrigraphs) \
184 OPT("Wundeclared-selector", CL_OBJC, OPT_Wundeclared_selector) \
185 OPT("Wundef", CL_ALL, OPT_Wundef) \
186 OPT("Wunknown-pragmas", CL_ALL, OPT_Wunknown_pragmas) \
187 OPT("Wunused-macros", CL_ALL, OPT_Wunused_macros) \
188 OPT("Wwrite-strings", CL_ALL, OPT_Wwrite_strings) \
189 OPT("ansi", CL_ALL, OPT_ansi) \
190 OPT("d", CL_ALL | CL_JOINED, OPT_d) \
191 OPT("fabi-version=", CL_CXX | CL_JOINED, OPT_fabi_version) \
192 OPT("faccess-control", CL_CXX, OPT_faccess_control) \
193 OPT("fall-virtual", CL_CXX, OPT_fall_virtual) \
194 OPT("falt-external-templates",CL_CXX, OPT_falt_external_templates) \
195 OPT("fasm", CL_ALL, OPT_fasm) \
196 OPT("fbuiltin", CL_ALL, OPT_fbuiltin) \
197 OPT("fbuiltin-", CL_ALL | CL_JOINED, OPT_fbuiltin_) \
198 OPT("fcheck-new", CL_CXX, OPT_fcheck_new) \
199 OPT("fcond-mismatch", CL_ALL, OPT_fcond_mismatch) \
200 OPT("fconserve-space", CL_CXX, OPT_fconserve_space) \
201 OPT("fconst-strings", CL_CXX, OPT_fconst_strings) \
202 OPT("fconstant-string-class=", CL_OBJC | CL_JOINED, \
203 OPT_fconstant_string_class) \
204 OPT("fdefault-inline", CL_CXX, OPT_fdefault_inline) \
205 OPT("fdollars-in-identifiers",CL_ALL, OPT_fdollars_in_identifiers) \
206 OPT("fdump-", CL_ALL | CL_JOINED, OPT_fdump) \
207 OPT("felide-constructors", CL_CXX, OPT_felide_constructors) \
208 OPT("fenforce-eh-specs", CL_CXX, OPT_fenforce_eh_specs) \
209 OPT("fenum-int-equiv", CL_CXX, OPT_fenum_int_equiv) \
210 OPT("fexternal-templates", CL_CXX, OPT_fexternal_templates) \
211 OPT("ffor-scope", CL_CXX, OPT_ffor_scope) \
212 OPT("ffreestanding", CL_C, OPT_ffreestanding) \
213 OPT("fgnu-keywords", CL_CXX, OPT_fgnu_keywords) \
214 OPT("fgnu-runtime", CL_OBJC, OPT_fgnu_runtime) \
215 OPT("fguiding-decls", CL_CXX, OPT_fguiding_decls) \
216 OPT("fhandle-exceptions", CL_CXX, OPT_fhandle_exceptions) \
217 OPT("fhonor-std", CL_CXX, OPT_fhonor_std) \
218 OPT("fhosted", CL_C, OPT_fhosted) \
219 OPT("fhuge-objects", CL_CXX, OPT_fhuge_objects) \
220 OPT("fimplement-inlines", CL_CXX, OPT_fimplement_inlines) \
221 OPT("fimplicit-inline-templates", CL_CXX, OPT_fimplicit_inline_templates) \
222 OPT("fimplicit-templates", CL_CXX, OPT_fimplicit_templates) \
223 OPT("flabels-ok", CL_CXX, OPT_flabels_ok) \
224 OPT("fms-extensions", CL_ALL, OPT_fms_extensions) \
225 OPT("fname-mangling-version-",CL_CXX | CL_JOINED, OPT_fname_mangling) \
226 OPT("fnew-abi", CL_CXX, OPT_fnew_abi) \
227 OPT("fnext-runtime", CL_OBJC, OPT_fnext_runtime) \
228 OPT("fnonansi-builtins", CL_CXX, OPT_fnonansi_builtins) \
229 OPT("fnonnull-objects", CL_CXX, OPT_fnonnull_objects) \
230 OPT("foperator-names", CL_CXX, OPT_foperator_names) \
231 OPT("foptional-diags", CL_CXX, OPT_foptional_diags) \
232 OPT("fpermissive", CL_CXX, OPT_fpermissive) \
233 OPT("fpreprocessed", CL_ALL, OPT_fpreprocessed) \
234 OPT("frepo", CL_CXX, OPT_frepo) \
235 OPT("frtti", CL_CXX, OPT_frtti) \
236 OPT("fshort-double", CL_ALL, OPT_fshort_double) \
237 OPT("fshort-enums", CL_ALL, OPT_fshort_enums) \
238 OPT("fshort-wchar", CL_ALL, OPT_fshort_wchar) \
239 OPT("fshow-column", CL_ALL, OPT_fshow_column) \
240 OPT("fsigned-bitfields", CL_ALL, OPT_fsigned_bitfields) \
241 OPT("fsigned-char", CL_ALL, OPT_fsigned_char) \
242 OPT("fsquangle", CL_CXX, OPT_fsquangle) \
243 OPT("fstats", CL_CXX, OPT_fstats) \
244 OPT("fstrict-prototype", CL_CXX, OPT_fstrict_prototype) \
245 OPT("ftabstop=", CL_ALL | CL_JOINED, OPT_ftabstop) \
246 OPT("ftemplate-depth-", CL_CXX | CL_JOINED, OPT_ftemplate_depth) \
247 OPT("fthis-is-variable", CL_CXX, OPT_fthis_is_variable) \
248 OPT("funsigned-bitfields", CL_ALL, OPT_funsigned_bitfields) \
249 OPT("funsigned-char", CL_ALL, OPT_funsigned_char) \
250 OPT("fuse-cxa-atexit", CL_CXX, OPT_fuse_cxa_atexit) \
251 OPT("fvtable-gc", CL_CXX, OPT_fvtable_gc) \
252 OPT("fvtable-thunks", CL_CXX, OPT_fvtable_thunks) \
253 OPT("fweak", CL_CXX, OPT_fweak) \
254 OPT("fxref", CL_CXX, OPT_fxref) \
255 OPT("gen-decls", CL_OBJC, OPT_gen_decls) \
256 OPT("lang-asm", CL_C_ONLY, OPT_lang_asm) \
257 OPT("lang-objc", CL_ALL, OPT_lang_objc) \
258 OPT("nostdinc", CL_ALL, OPT_nostdinc) \
259 OPT("nostdinc++", CL_ALL, OPT_nostdincplusplus) \
260 OPT("o", CL_ALL | CL_ARG, OPT_o) \
261 OPT("pedantic", CL_ALL, OPT_pedantic) \
262 OPT("pedantic-errors", CL_ALL, OPT_pedantic_errors) \
263 OPT("print-objc-runtime-info", CL_OBJC, OPT_print_objc_runtime_info) \
264 OPT("remap", CL_ALL, OPT_remap) \
265 OPT("std=c++98", CL_CXX, OPT_std_cplusplus98) \
266 OPT("std=c89", CL_C, OPT_std_c89) \
267 OPT("std=c99", CL_C, OPT_std_c99) \
268 OPT("std=c9x", CL_C, OPT_std_c9x) \
269 OPT("std=gnu++98", CL_CXX, OPT_std_gnuplusplus98) \
270 OPT("std=gnu89", CL_C, OPT_std_gnu89) \
271 OPT("std=gnu99", CL_C, OPT_std_gnu99) \
272 OPT("std=gnu9x", CL_C, OPT_std_gnu9x) \
273 OPT("std=iso9899:1990", CL_C, OPT_std_iso9899_1990) \
274 OPT("std=iso9899:199409", CL_C, OPT_std_iso9899_199409) \
275 OPT("std=iso9899:1999", CL_C, OPT_std_iso9899_1999) \
276 OPT("std=iso9899:199x", CL_C, OPT_std_iso9899_199x) \
277 OPT("traditional-cpp", CL_ALL, OPT_traditional_cpp) \
278 OPT("trigraphs", CL_ALL, OPT_trigraphs) \
279 OPT("undef", CL_ALL, OPT_undef) \
280 OPT("v", CL_ALL, OPT_v) \
281 OPT("w", CL_ALL, OPT_w)
283 #define OPT(text, flags, code) code,
293 const char *opt_text
;
294 unsigned char opt_len
;
296 ENUM_BITFIELD (opt_code
) opt_code
: 2 * CHAR_BIT
;
299 #define OPT(text, flags, code) { text, sizeof(text) - 1, flags, code },
301 static struct cl_option cl_options
[] =
303 static const struct cl_option cl_options
[] =
309 #undef COMMAND_LINE_OPTIONS
311 /* Holds switches parsed by c_common_decode_option (), but whose
312 handling is deffered to c_common_post_options (). */
313 static void defer_opt
PARAMS ((enum opt_code
, const char *));
314 static struct deferred_opt
322 static int opt_comp
PARAMS ((const void *, const void *));
324 /* Run-time sorting of options array. */
329 return strcmp (((struct cl_option
*) p1
)->opt_text
,
330 ((struct cl_option
*) p2
)->opt_text
);
334 /* Complain that switch OPT_INDEX expects an argument but none was
337 missing_arg (opt_index
)
340 const char *opt_text
= cl_options
[opt_index
].opt_text
;
346 case OPT_fabi_version
:
349 case OPT_fname_mangling
:
351 case OPT_ftemplate_depth
:
353 error ("missing argument to \"-%s\"", opt_text
);
356 case OPT_fconstant_string_class
:
357 error ("no class name specified with \"-%s\"", opt_text
);
364 error ("missing filename after \"-%s\"", opt_text
);
369 error ("missing target after \"-%s\"", opt_text
);
374 /* Perform a binary search to find which option the command-line INPUT
375 matches. Returns its index in the option array, and N_OPTS on
378 Complications arise since some options can be suffixed with an
379 argument, and multiple complete matches can occur, e.g. -pedantic
380 and -pedantic-errors. Also, some options are only accepted by some
381 languages. If a switch matches for a different language and
382 doesn't match any alternatives for the true front end, the index of
383 the matched switch is returned anyway. The caller should check for
386 find_opt (input
, lang_flag
)
392 size_t result
= N_OPTS
;
402 opt_len
= cl_options
[md
].opt_len
;
403 comp
= memcmp (input
, cl_options
[md
].opt_text
, opt_len
);
411 /* The switch matches. It it an exact match? */
412 if (input
[opt_len
] == '\0')
418 /* If the switch takes no arguments this is not a proper
419 match, so we continue the search (e.g. input="stdc++"
420 match was "stdc"). */
421 if (!(cl_options
[md
].flags
& CL_JOINED
))
424 /* Is this switch valid for this front end? */
425 if (!(cl_options
[md
].flags
& lang_flag
))
427 /* If subsequently we don't find a better match,
428 return this and let the caller report it as a bad
434 /* Two scenarios remain: we have the switch's argument,
435 or we match a longer option. This can happen with
436 -iwithprefix and -withprefixbefore. The longest
437 possible option match succeeds.
439 Scan forwards, and return an exact match. Otherwise
440 return the longest valid option-accepting match (mx).
441 This loops at most twice with current options. */
443 for (md
= md
+ 1; md
< (size_t) N_OPTS
; md
++)
445 opt_len
= cl_options
[md
].opt_len
;
446 if (memcmp (input
, cl_options
[md
].opt_text
, opt_len
))
448 if (input
[opt_len
] == '\0')
450 if (cl_options
[md
].flags
& lang_flag
451 && cl_options
[md
].flags
& CL_JOINED
)
463 /* Defer option CODE with argument ARG. */
465 defer_opt (code
, arg
)
469 /* FIXME: this should be in c_common_init_options, which should take
473 extern int save_argc
;
474 deferred_size
= save_argc
;
475 deferred_opts
= (struct deferred_opt
*)
476 xmalloc (deferred_size
* sizeof (struct deferred_opt
));
479 if (deferred_count
== deferred_size
)
482 deferred_opts
[deferred_count
].code
= code
;
483 deferred_opts
[deferred_count
].arg
= arg
;
487 /* Common initialization before parsing options. */
489 c_common_init_options (lang
)
490 enum c_language_kind lang
;
493 /* For non-ASCII hosts, the cl_options array needs to be sorted at
495 qsort (cl_options
, N_OPTS
, sizeof (struct cl_option
), opt_comp
);
501 for (i
= 1; i
< N_OPTS
; i
++)
502 if (strcmp (cl_options
[i
- 1].opt_text
, cl_options
[i
].opt_text
) >= 0)
503 error ("options array incorrectly sorted: %s is before %s",
504 cl_options
[i
- 1].opt_text
, cl_options
[i
].opt_text
);
509 parse_in
= cpp_create_reader (lang
== clk_c
? CLK_GNUC89
: CLK_GNUCXX
);
510 cpp_opts
= cpp_get_options (parse_in
);
514 flag_const_strings
= (lang
== clk_cplusplus
);
515 warn_pointer_arith
= (lang
== clk_cplusplus
);
517 warn_sign_compare
= -1;
519 /* Mark as "unspecified" (see c_common_post_options). */
520 flag_bounds_check
= -1;
523 /* Handle one command-line option in (argc, argv).
524 Can be called multiple times, to handle multiple sets of options.
525 Returns number of strings consumed. */
527 c_common_decode_option (argc
, argv
)
531 static const int lang_flags
[] = {CL_C_ONLY
, CL_C
, CL_CXX_ONLY
, CL_CXX
};
533 const char *opt
, *arg
= 0;
536 int result
, lang_flag
;
537 const struct cl_option
*option
;
542 /* Interpret "-" or a non-switch as a file name. */
543 if (opt
[0] != '-' || opt
[1] == '\0')
551 error ("too many filenames given. Type %s --help for usage",
559 /* Drop the "no-" from negative switches. */
560 if ((opt
[1] == 'W' || opt
[1] == 'f')
561 && opt
[2] == 'n' && opt
[3] == 'o' && opt
[4] == '-')
563 size_t len
= strlen (opt
) - 3;
565 dup
= xmalloc (len
+ 1);
568 memcpy (dup
+ 2, opt
+ 5, len
- 2 + 1);
573 result
= cpp_handle_option (parse_in
, argc
, argv
);
576 lang_flag
= lang_flags
[(c_language
<< 1) + flag_objc
];
577 opt_index
= find_opt (opt
+ 1, lang_flag
);
578 if (opt_index
== N_OPTS
)
582 option
= &cl_options
[opt_index
];
584 /* Sort out any argument the switch takes. */
585 if (option
->flags
& CL_ARG
)
587 if (option
->flags
& CL_JOINED
)
589 /* Have arg point to the original switch. This is because
590 some code, such as disable_builtin_function, expects its
591 argument to be persistent until the program exits. */
592 arg
= argv
[0] + cl_options
[opt_index
].opt_len
+ 1;
594 arg
+= strlen ("no-");
597 /* If we don't have an argument, and CL_SEPARATE, try the next
598 argument in the vector. */
599 if (!arg
|| (*arg
== '\0' && option
->flags
& CL_SEPARATE
))
605 if (!arg
|| *arg
== '\0')
607 missing_arg (opt_index
);
613 /* Complain about the wrong language after we've swallowed any
614 necessary extra argument. Eventually make this a hard error
615 after the call to find_opt, and return argc. */
616 if (!(cl_options
[opt_index
].flags
& lang_flag
))
618 complain_wrong_lang (opt_index
);
622 switch (code
= option
->opt_code
)
624 case N_OPTS
: /* Shut GCC up. */
632 cpp_opts
->discard_comments
= 0;
636 cpp_opts
->discard_comments
= 0;
637 cpp_opts
->discard_comments_in_macro_exp
= 0;
641 flag_preprocess_only
= 1;
645 cpp_opts
->print_include_names
= 1;
650 /* When doing dependencies with -M or -MM, suppress normal
651 preprocessed output, but still do -dM etc. as software
652 depends on this. Preprocessed output does occur if -MD, -MMD
653 or environment var dependency generation is used. */
654 cpp_opts
->deps
.style
= (code
== OPT_M
? DEPS_SYSTEM
: DEPS_USER
);
655 cpp_opts
->no_output
= 1;
656 cpp_opts
->inhibit_warnings
= 1;
661 cpp_opts
->deps
.style
= (code
== OPT_MD
? DEPS_SYSTEM
: DEPS_USER
);
672 cpp_opts
->deps
.missing_files
= true;
677 cpp_opts
->deps
.phony_targets
= true;
683 defer_opt (code
, arg
);
687 cpp_opts
->no_line_commands
= 1;
698 warn_char_subscripts
= on
;
699 warn_missing_braces
= on
;
700 warn_parentheses
= on
;
701 warn_return_type
= on
;
702 warn_sequence_point
= on
; /* Was C only. */
703 warn_sign_compare
= on
; /* Was C++ only. */
706 /* Only warn about unknown pragmas that are not in system
708 warn_unknown_pragmas
= on
;
710 /* We save the value of warn_uninitialized, since if they put
711 -Wuninitialized on the command line, we need to generate a
712 warning about not using it without also specifying -O. */
713 if (warn_uninitialized
!= 1)
714 warn_uninitialized
= (on
? 2 : 0);
716 if (c_language
== clk_c
)
717 /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding
718 can turn it off only if it's not explicit. */
722 /* C++-specific warnings. */
723 warn_ctor_dtor_privacy
= on
;
726 warn_nontemplate_friend
= on
;
729 cpp_opts
->warn_trigraphs
= on
;
730 cpp_opts
->warn_comments
= on
;
731 cpp_opts
->warn_num_sign_change
= on
;
732 cpp_opts
->warn_multichar
= on
; /* Was C++ only. */
735 case OPT_Wbad_function_cast
:
736 warn_bad_function_cast
= on
;
743 case OPT_Wchar_subscripts
:
744 warn_char_subscripts
= on
;
749 cpp_opts
->warn_comments
= on
;
752 case OPT_Wconversion
:
753 warn_conversion
= on
;
756 case OPT_Wctor_dtor_privacy
:
757 warn_ctor_dtor_privacy
= on
;
760 case OPT_Wdeprecated
:
761 warn_deprecated
= on
;
764 case OPT_Wdiv_by_zero
:
765 warn_div_by_zero
= on
;
772 case OPT_Wendif_labels
:
773 cpp_opts
->warn_endif_labels
= on
;
777 cpp_opts
->warnings_are_errors
= on
;
780 case OPT_Werror_implicit_function_decl
:
784 mesg_implicit_function_declaration
= 2;
787 case OPT_Wfloat_equal
:
788 warn_float_equal
= on
;
796 set_Wformat (atoi (arg
));
799 case OPT_Wformat_extra_args
:
800 warn_format_extra_args
= on
;
803 case OPT_Wformat_nonliteral
:
804 warn_format_nonliteral
= on
;
807 case OPT_Wformat_security
:
808 warn_format_security
= on
;
811 case OPT_Wformat_y2k
:
812 warn_format_y2k
= on
;
815 case OPT_Wformat_zero_length
:
816 warn_format_zero_length
= on
;
823 case OPT_Wimplicit_function_decl
:
824 mesg_implicit_function_declaration
= on
;
827 case OPT_Wimplicit_int
:
828 warn_implicit_int
= on
;
832 cpp_opts
->warn_import
= on
;
846 case OPT_Wmissing_braces
:
847 warn_missing_braces
= on
;
850 case OPT_Wmissing_declarations
:
851 warn_missing_declarations
= on
;
854 case OPT_Wmissing_format_attribute
:
855 warn_missing_format_attribute
= on
;
858 case OPT_Wmissing_prototypes
:
859 warn_missing_prototypes
= on
;
863 cpp_opts
->warn_multichar
= on
;
866 case OPT_Wnested_externs
:
867 warn_nested_externs
= on
;
870 case OPT_Wnon_template_friend
:
871 warn_nontemplate_friend
= on
;
874 case OPT_Wnon_virtual_dtor
:
882 case OPT_Wold_style_cast
:
883 warn_old_style_cast
= on
;
886 case OPT_Woverloaded_virtual
:
887 warn_overloaded_virtual
= on
;
890 case OPT_Wparentheses
:
891 warn_parentheses
= on
;
894 case OPT_Wpmf_conversions
:
898 case OPT_Wpointer_arith
:
899 warn_pointer_arith
= on
;
910 case OPT_Wredundant_decls
:
911 warn_redundant_decls
= on
;
918 case OPT_Wreturn_type
:
919 warn_return_type
= on
;
922 case OPT_Wsequence_point
:
923 warn_sequence_point
= on
;
926 case OPT_Wsign_compare
:
927 warn_sign_compare
= on
;
930 case OPT_Wsign_promo
:
931 warn_sign_promo
= on
;
934 case OPT_Wstrict_prototypes
:
935 if (!on
&& c_language
== clk_cplusplus
)
936 warning ("-Wno-strict-prototypes is not supported in C++");
938 warn_strict_prototypes
= on
;
945 case OPT_Wsystem_headers
:
946 cpp_opts
->warn_system_headers
= on
;
949 case OPT_Wtraditional
:
950 warn_traditional
= on
;
951 cpp_opts
->warn_traditional
= on
;
955 cpp_opts
->warn_trigraphs
= on
;
958 case OPT_Wundeclared_selector
:
959 warn_undeclared_selector
= on
;
963 cpp_opts
->warn_undef
= on
;
966 case OPT_Wunknown_pragmas
:
967 /* Set to greater than 1, so that even unknown pragmas in
968 system headers will be warned about. */
969 warn_unknown_pragmas
= on
* 2;
972 case OPT_Wunused_macros
:
973 cpp_opts
->warn_unused_macros
= on
;
976 case OPT_Wwrite_strings
:
977 if (c_language
== clk_c
)
978 flag_const_strings
= on
;
980 warn_write_strings
= on
;
984 if (c_language
== clk_c
)
985 set_std_c89 (false, true);
987 set_std_cxx98 (true);
994 case OPT_fcond_mismatch
:
995 if (c_language
== clk_c
)
997 flag_cond_mismatch
= on
;
1002 case OPT_fall_virtual
:
1003 case OPT_fenum_int_equiv
:
1004 case OPT_fguiding_decls
:
1005 case OPT_fhonor_std
:
1006 case OPT_fhuge_objects
:
1007 case OPT_flabels_ok
:
1008 case OPT_fname_mangling
:
1010 case OPT_fnonnull_objects
:
1012 case OPT_fstrict_prototype
:
1013 case OPT_fthis_is_variable
:
1014 case OPT_fvtable_thunks
:
1016 warning ("switch \"%s\" is no longer supported", argv
[0]);
1019 case OPT_fabi_version
:
1020 flag_abi_version
= read_integral_parameter (arg
, argv
[0], 1);
1023 case OPT_faccess_control
:
1024 flag_access_control
= on
;
1027 case OPT_falt_external_templates
:
1028 flag_alt_external_templates
= on
;
1030 flag_external_templates
= true;
1032 warning ("switch \"%s\" is deprecated, please see documentation for details", argv
[0]);
1040 flag_no_builtin
= !on
;
1047 disable_builtin_function (arg
);
1050 case OPT_fdollars_in_identifiers
:
1051 dollars_in_ident
= on
;
1055 if (!on
|| !dump_switch_p (argv
[0] + strlen ("-f")))
1059 case OPT_ffreestanding
:
1061 /* Fall through... */
1064 flag_no_builtin
= !on
;
1065 /* warn_main will be 2 if set by -Wall, 1 if set by -Wmain */
1066 if (!on
&& warn_main
== 2)
1070 case OPT_fshort_double
:
1071 flag_short_double
= on
;
1074 case OPT_fshort_enums
:
1075 flag_short_enums
= on
;
1078 case OPT_fshort_wchar
:
1079 flag_short_wchar
= on
;
1082 case OPT_fsigned_bitfields
:
1083 flag_signed_bitfields
= on
;
1084 explicit_flag_signed_bitfields
= 1;
1087 case OPT_fsigned_char
:
1088 flag_signed_char
= on
;
1091 case OPT_funsigned_bitfields
:
1092 flag_signed_bitfields
= !on
;
1093 explicit_flag_signed_bitfields
= 1;
1096 case OPT_funsigned_char
:
1097 flag_signed_char
= !on
;
1100 case OPT_fcheck_new
:
1101 flag_check_new
= on
;
1104 case OPT_fconserve_space
:
1105 flag_conserve_space
= on
;
1108 case OPT_fconst_strings
:
1109 flag_const_strings
= on
;
1112 case OPT_fconstant_string_class
:
1113 constant_string_class_name
= arg
;
1116 case OPT_fdefault_inline
:
1117 flag_default_inline
= on
;
1120 case OPT_felide_constructors
:
1121 flag_elide_constructors
= on
;
1124 case OPT_fenforce_eh_specs
:
1125 flag_enforce_eh_specs
= on
;
1128 case OPT_fexternal_templates
:
1129 flag_external_templates
= on
;
1132 case OPT_ffor_scope
:
1133 flag_new_for_scope
= on
;
1136 case OPT_fgnu_keywords
:
1137 flag_no_gnu_keywords
= !on
;
1140 case OPT_fgnu_runtime
:
1141 flag_next_runtime
= !on
;
1144 case OPT_fhandle_exceptions
:
1145 warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)");
1146 flag_exceptions
= on
;
1149 case OPT_fimplement_inlines
:
1150 flag_implement_inlines
= on
;
1153 case OPT_fimplicit_inline_templates
:
1154 flag_implicit_inline_templates
= on
;
1157 case OPT_fimplicit_templates
:
1158 flag_implicit_templates
= on
;
1161 case OPT_fms_extensions
:
1162 flag_ms_extensions
= on
;
1165 case OPT_fnext_runtime
:
1166 flag_next_runtime
= on
;
1169 case OPT_fnonansi_builtins
:
1170 flag_no_nonansi_builtin
= !on
;
1173 case OPT_foperator_names
:
1174 cpp_opts
->operator_names
= on
;
1177 case OPT_foptional_diags
:
1178 flag_optional_diags
= on
;
1181 case OPT_fpermissive
:
1182 flag_permissive
= on
;
1185 case OPT_fpreprocessed
:
1186 cpp_opts
->preprocessed
= on
;
1190 flag_use_repository
= on
;
1192 flag_implicit_templates
= 0;
1199 case OPT_fshow_column
:
1200 cpp_opts
->show_column
= on
;
1204 flag_detailed_statistics
= on
;
1208 /* Don't recognize -fno-tabstop=. */
1212 /* It is documented that we silently ignore silly values. */
1215 long tabstop
= strtol (arg
, &endptr
, 10);
1216 if (*endptr
== '\0' && tabstop
>= 1 && tabstop
<= 100)
1217 cpp_opts
->tabstop
= tabstop
;
1221 case OPT_ftemplate_depth
:
1222 max_tinst_depth
= read_integral_parameter (arg
, argv
[0], 0);
1225 case OPT_fvtable_gc
:
1226 flag_vtable_gc
= on
;
1229 case OPT_fuse_cxa_atexit
:
1230 flag_use_cxa_atexit
= on
;
1238 flag_gen_declaration
= 1;
1242 cpp_set_lang (parse_in
, CLK_ASM
);
1250 /* No default include directories. You must specify all
1251 include-file directories with -I. */
1252 cpp_opts
->no_standard_includes
= 1;
1255 case OPT_nostdincplusplus
:
1256 /* No default C++-specific include directories. */
1257 cpp_opts
->no_standard_cplusplus_includes
= 1;
1265 error ("output filename specified twice");
1270 /* We need to handle the -pedantic switches here, rather than in
1271 c_common_post_options, so that a subsequent -Wno-endif-labels
1272 is not overridden. */
1273 case OPT_pedantic_errors
:
1274 cpp_opts
->pedantic_errors
= 1;
1277 cpp_opts
->pedantic
= 1;
1278 cpp_opts
->warn_endif_labels
= 1;
1281 case OPT_print_objc_runtime_info
:
1282 print_struct_values
= 1;
1286 cpp_opts
->remap
= 1;
1289 case OPT_std_cplusplus98
:
1290 case OPT_std_gnuplusplus98
:
1291 set_std_cxx98 (code
== OPT_std_cplusplus98
/* ISO */);
1295 case OPT_std_iso9899_1990
:
1296 case OPT_std_iso9899_199409
:
1297 set_std_c89 (code
== OPT_std_iso9899_199409
/* c94 */, true /* ISO */);
1301 set_std_c89 (false /* c94 */, false /* ISO */);
1306 case OPT_std_iso9899_1999
:
1307 case OPT_std_iso9899_199x
:
1308 set_std_c99 (true /* ISO */);
1313 set_std_c99 (false /* ISO */);
1317 cpp_opts
->trigraphs
= 1;
1320 case OPT_traditional_cpp
:
1321 cpp_opts
->traditional
= 1;
1329 cpp_opts
->inhibit_warnings
= 1;
1333 cpp_opts
->verbose
= 1;
1343 /* Post-switch processing. */
1345 c_common_post_options ()
1347 /* Canonicalize the input and output filenames. */
1348 if (in_fname
== NULL
|| !strcmp (in_fname
, "-"))
1351 if (out_fname
== NULL
|| !strcmp (out_fname
, "-"))
1354 if (cpp_opts
->deps
.style
== DEPS_NONE
)
1355 check_deps_environment_vars ();
1357 handle_deferred_opts ();
1359 sanitize_cpp_opts ();
1361 flag_inline_trees
= 1;
1363 /* Use tree inlining if possible. Function instrumentation is only
1364 done in the RTL level, so we disable tree inlining. */
1365 if (! flag_instrument_function_entry_exit
)
1367 if (!flag_no_inline
)
1369 if (flag_inline_functions
)
1371 flag_inline_trees
= 2;
1372 flag_inline_functions
= 0;
1376 /* If still "unspecified", make it match -fbounded-pointers. */
1377 if (flag_bounds_check
== -1)
1378 flag_bounds_check
= flag_bounded_pointers
;
1380 /* Special format checking options don't work without -Wformat; warn if
1382 if (warn_format_y2k
&& !warn_format
)
1383 warning ("-Wformat-y2k ignored without -Wformat");
1384 if (warn_format_extra_args
&& !warn_format
)
1385 warning ("-Wformat-extra-args ignored without -Wformat");
1386 if (warn_format_zero_length
&& !warn_format
)
1387 warning ("-Wformat-zero-length ignored without -Wformat");
1388 if (warn_format_nonliteral
&& !warn_format
)
1389 warning ("-Wformat-nonliteral ignored without -Wformat");
1390 if (warn_format_security
&& !warn_format
)
1391 warning ("-Wformat-security ignored without -Wformat");
1392 if (warn_missing_format_attribute
&& !warn_format
)
1393 warning ("-Wmissing-format-attribute ignored without -Wformat");
1395 /* If an error has occurred in cpplib, note it so we fail
1397 errorcount
+= cpp_errors (parse_in
);
1399 return flag_preprocess_only
;
1402 /* Preprocess the input file to out_stream. */
1406 /* Open the output now. We must do so even if no_output is on,
1407 because there may be other output than from the actual
1408 preprocessing (e.g. from -dM). */
1409 if (out_fname
[0] == '\0')
1410 out_stream
= stdout
;
1412 out_stream
= fopen (out_fname
, "w");
1414 if (out_stream
== NULL
)
1415 fatal_io_error ("opening output file %s", out_fname
);
1417 cpp_preprocess_file (parse_in
, in_fname
, out_stream
);
1420 /* Front end initialization common to C, ObjC and C++. */
1422 c_common_init (filename
)
1423 const char *filename
;
1425 /* Set up preprocessor arithmetic. Must be done after call to
1426 c_common_nodes_and_builtins for type nodes to be good. */
1427 cpp_opts
->precision
= TYPE_PRECISION (intmax_type_node
);
1428 cpp_opts
->char_precision
= TYPE_PRECISION (char_type_node
);
1429 cpp_opts
->int_precision
= TYPE_PRECISION (integer_type_node
);
1430 cpp_opts
->wchar_precision
= TYPE_PRECISION (wchar_type_node
);
1431 cpp_opts
->unsigned_wchar
= TREE_UNSIGNED (wchar_type_node
);
1433 /* Register preprocessor built-ins before calls to
1435 cpp_get_callbacks (parse_in
)->register_builtins
= cb_register_builtins
;
1437 /* NULL is passed up to toplev.c and we exit quickly. */
1438 if (flag_preprocess_only
)
1444 /* Do this before initializing pragmas, as then cpplib's hash table
1445 has been set up. NOTE: we are using our own file name here, not
1446 the one supplied. */
1447 filename
= init_c_lex (in_fname
);
1454 /* Common finish hook for the C, ObjC and C++ front ends. */
1458 FILE *deps_stream
= NULL
;
1460 if (cpp_opts
->deps
.style
!= DEPS_NONE
)
1462 /* If -M or -MM was seen without -MF, default output to the
1465 deps_stream
= out_stream
;
1468 deps_stream
= fopen (deps_file
, deps_append
? "a": "w");
1470 fatal_io_error ("opening dependency file %s", deps_file
);
1474 /* For performance, avoid tearing down cpplib's internal structures
1475 with cpp_destroy (). */
1476 errorcount
+= cpp_finish (parse_in
, deps_stream
);
1478 if (deps_stream
&& deps_stream
!= out_stream
1479 && (ferror (deps_stream
) || fclose (deps_stream
)))
1480 fatal_io_error ("closing dependency file %s", deps_file
);
1482 if (out_stream
&& (ferror (out_stream
) || fclose (out_stream
)))
1483 fatal_io_error ("when writing output to %s", out_fname
);
1486 /* Either of two environment variables can specify output of
1487 dependencies. Their value is either "OUTPUT_FILE" or "OUTPUT_FILE
1488 DEPS_TARGET", where OUTPUT_FILE is the file to write deps info to
1489 and DEPS_TARGET is the target to mention in the deps. They also
1490 result in dependency information being appended to the output file
1491 rather than overwriting it, and like Sun's compiler
1492 SUNPRO_DEPENDENCIES suppresses the dependency on the main file. */
1494 check_deps_environment_vars ()
1498 GET_ENVIRONMENT (spec
, "DEPENDENCIES_OUTPUT");
1500 cpp_opts
->deps
.style
= DEPS_USER
;
1503 GET_ENVIRONMENT (spec
, "SUNPRO_DEPENDENCIES");
1506 cpp_opts
->deps
.style
= DEPS_SYSTEM
;
1507 cpp_opts
->deps
.ignore_main_file
= true;
1513 /* Find the space before the DEPS_TARGET, if there is one. */
1514 char *s
= strchr (spec
, ' ');
1517 /* Let the caller perform MAKE quoting. */
1518 defer_opt (OPT_MT
, s
+ 1);
1522 /* Command line -MF overrides environment variables and default. */
1530 /* Handle deferred command line switches. */
1532 handle_deferred_opts ()
1536 for (i
= 0; i
< deferred_count
; i
++)
1538 struct deferred_opt
*opt
= &deferred_opts
[i
];
1544 cpp_add_dependency_target (parse_in
, opt
->arg
, opt
->code
== OPT_MQ
);
1552 free (deferred_opts
);
1555 /* These settings are appropriate for GCC, but not necessarily so for
1556 cpplib as a library. */
1558 sanitize_cpp_opts ()
1560 /* If we don't know what style of dependencies to output, complain
1561 if any other dependency switches have been given. */
1562 if (deps_seen
&& cpp_opts
->deps
.style
== DEPS_NONE
)
1563 error ("to generate dependencies you must specify either -M or -MM");
1565 /* -dM and dependencies suppress normal output; do it here so that
1566 the last -d[MDN] switch overrides earlier ones. */
1567 if (cpp_opts
->dump_macros
== dump_only
)
1568 cpp_opts
->no_output
= 1;
1570 /* Disable -dD, -dN and -dI if normal output is suppressed. Allow
1571 -dM since at least glibc relies on -M -dM to work. */
1572 if (cpp_opts
->no_output
)
1574 if (cpp_opts
->dump_macros
!= dump_only
)
1575 cpp_opts
->dump_macros
= dump_none
;
1576 cpp_opts
->dump_includes
= 0;
1579 cpp_opts
->unsigned_char
= !flag_signed_char
;
1580 cpp_opts
->stdc_0_in_system_headers
= STDC_0_IN_SYSTEM_HEADERS
;
1582 /* We want -Wno-long-long to override -pedantic -std=non-c99
1583 and/or -Wtraditional, whatever the ordering. */
1584 cpp_opts
->warn_long_long
1585 = warn_long_long
&& ((!flag_isoc99
&& pedantic
) || warn_traditional
);
1588 /* Set the C 89 standard (with 1994 amendments if C94, without GNU
1589 extensions if ISO). There is no concept of gnu94. */
1591 set_std_c89 (c94
, iso
)
1594 cpp_set_lang (parse_in
, c94
? CLK_STDC94
: iso
? CLK_STDC89
: CLK_GNUC89
);
1597 flag_no_gnu_keywords
= iso
;
1598 flag_no_nonansi_builtin
= iso
;
1599 flag_noniso_default_format_attributes
= !iso
;
1602 flag_writable_strings
= 0;
1605 /* Set the C 99 standard (without GNU extensions if ISO). */
1610 cpp_set_lang (parse_in
, iso
? CLK_STDC99
: CLK_GNUC99
);
1612 flag_no_nonansi_builtin
= iso
;
1613 flag_noniso_default_format_attributes
= !iso
;
1617 flag_writable_strings
= 0;
1620 /* Set the C++ 98 standard (without GNU extensions if ISO). */
1625 cpp_set_lang (parse_in
, iso
? CLK_CXX98
: CLK_GNUCXX
);
1626 flag_no_gnu_keywords
= iso
;
1627 flag_no_nonansi_builtin
= iso
;
1628 flag_noniso_default_format_attributes
= !iso
;
1632 /* Handle setting implicit to ON. */
1638 warn_implicit_int
= on
;
1641 if (mesg_implicit_function_declaration
!= 2)
1642 mesg_implicit_function_declaration
= 1;
1645 mesg_implicit_function_declaration
= 0;
1648 /* Args to -d specify what to dump. Silently ignore
1649 unrecognized options; they may be aimed at toplev.c. */
1656 while ((c
= *arg
++) != '\0')
1660 cpp_opts
->dump_macros
= dump_only
;
1664 cpp_opts
->dump_macros
= dump_names
;
1668 cpp_opts
->dump_macros
= dump_definitions
;
1672 cpp_opts
->dump_includes
= 1;
1677 /* Write a slash-separated list of languages in FLAGS to BUF. */
1679 write_langs (buf
, flags
)
1684 if (flags
& CL_C_ONLY
)
1686 if (flags
& CL_OBJC_ONLY
)
1690 strcat (buf
, "ObjC");
1692 if (flags
& CL_CXX_ONLY
)
1696 strcat (buf
, "C++");
1700 /* Complain that switch OPT_INDEX does not apply to this front end. */
1702 complain_wrong_lang (opt_index
)
1705 char ok_langs
[60], bad_langs
[60];
1706 int ok_flags
= cl_options
[opt_index
].flags
;
1708 write_langs (ok_langs
, ok_flags
);
1709 write_langs (bad_langs
, ~ok_flags
);
1710 warning ("\"-%s\" is valid for %s but not for %s",
1711 cl_options
[opt_index
].opt_text
, ok_langs
, bad_langs
);
1714 /* Handle --help output. */
1718 /* To keep the lines from getting too long for some compilers, limit
1719 to about 500 characters (6 lines) per chunk. */
1722 -include <file> Include the contents of <file> before other files\n\
1723 -imacros <file> Accept definition of macros in <file>\n\
1724 -iprefix <path> Specify <path> as a prefix for next two options\n\
1725 -iwithprefix <dir> Add <dir> to the end of the system include path\n\
1726 -iwithprefixbefore <dir> Add <dir> to the end of the main include path\n\
1727 -isystem <dir> Add <dir> to the start of the system include path\n\
1730 -idirafter <dir> Add <dir> to the end of the system include path\n\
1731 -I <dir> Add <dir> to the end of the main include path\n\
1732 -I- Fine-grained include path control; see info docs\n\
1733 -nostdinc Do not search system include directories\n\
1734 (dirs specified with -isystem will still be used)\n\
1735 -nostdinc++ Do not search system include directories for C++\n\
1736 -o <file> Put output into <file>\n\
1739 -trigraphs Support ISO C trigraphs\n\
1740 -std=<std name> Specify the conformance standard; one of:\n\
1741 gnu89, gnu99, c89, c99, iso9899:1990,\n\
1742 iso9899:199409, iso9899:1999, c++98\n\
1743 -w Inhibit warning messages\n\
1744 -W[no-]trigraphs Warn if trigraphs are encountered\n\
1745 -W[no-]comment{s} Warn if one comment starts inside another\n\
1748 -W[no-]traditional Warn about features not present in traditional C\n\
1749 -W[no-]undef Warn if an undefined macro is used by #if\n\
1750 -W[no-]import Warn about the use of the #import directive\n\
1753 -W[no-]error Treat all warnings as errors\n\
1754 -W[no-]system-headers Do not suppress warnings from system headers\n\
1755 -W[no-]all Enable most preprocessor warnings\n\
1758 -M Generate make dependencies\n\
1759 -MM As -M, but ignore system header files\n\
1760 -MD Generate make dependencies and compile\n\
1761 -MMD As -MD, but ignore system header files\n\
1762 -MF <file> Write dependency output to the given file\n\
1763 -MG Treat missing header file as generated files\n\
1766 -MP Generate phony targets for all headers\n\
1767 -MQ <target> Add a MAKE-quoted target\n\
1768 -MT <target> Add an unquoted target\n\
1771 -D<macro> Define a <macro> with string '1' as its value\n\
1772 -D<macro>=<val> Define a <macro> with <val> as its value\n\
1773 -A<question>=<answer> Assert the <answer> to <question>\n\
1774 -A-<question>=<answer> Disable the <answer> to <question>\n\
1775 -U<macro> Undefine <macro> \n\
1776 -v Display the version number\n\
1779 -H Print the name of header files as they are used\n\
1780 -C Do not discard comments\n\
1781 -dM Display a list of macro definitions active at end\n\
1782 -dD Preserve macro definitions in output\n\
1783 -dN As -dD except that only the names are preserved\n\
1784 -dI Include #include directives in the output\n\
1787 -f[no-]preprocessed Treat the input file as already preprocessed\n\
1788 -ftabstop=<number> Distance between tab stops for column reporting\n\
1789 -P Do not generate #line directives\n\
1790 -remap Remap file names when including files\n\
1791 --help Display this information\n\