Branch data Line data Source code
1 : : /* C/ObjC/C++ command line option handling.
2 : : Copyright (C) 2002-2025 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 3, 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 COPYING3. If not see
19 : : <http://www.gnu.org/licenses/>. */
20 : :
21 : : #define INCLUDE_VECTOR
22 : : #include "config.h"
23 : : #include "system.h"
24 : : #include "coretypes.h"
25 : : #include "tm.h"
26 : : #include "target.h"
27 : : #include "c-target.h"
28 : : #include "c-common.h"
29 : : #include "memmodel.h"
30 : : #include "tm_p.h" /* For C_COMMON_OVERRIDE_OPTIONS. */
31 : : #include "diagnostic.h"
32 : : #include "c-pragma.h"
33 : : #include "flags.h"
34 : : #include "toplev.h"
35 : : #include "langhooks.h"
36 : : #include "diagnostics/macro-unwinding.h" /* for virt_loc_aware_diagnostic_finalizer */
37 : : #include "intl.h"
38 : : #include "cppdefault.h"
39 : : #include "incpath.h"
40 : : #include "debug.h" /* For debug_hooks. */
41 : : #include "opts.h"
42 : : #include "plugin.h" /* For PLUGIN_INCLUDE_FILE event. */
43 : : #include "mkdeps.h"
44 : : #include "dumpfile.h"
45 : : #include "file-prefix-map.h" /* add_*_prefix_map() */
46 : : #include "context.h"
47 : : #include "diagnostics/text-sink.h"
48 : :
49 : : #ifndef DOLLARS_IN_IDENTIFIERS
50 : : # define DOLLARS_IN_IDENTIFIERS true
51 : : #endif
52 : :
53 : : #ifndef TARGET_SYSTEM_ROOT
54 : : # define TARGET_SYSTEM_ROOT NULL
55 : : #endif
56 : :
57 : : #ifndef TARGET_OPTF
58 : : #define TARGET_OPTF(ARG)
59 : : #endif
60 : :
61 : : /* CPP's options. */
62 : : cpp_options *cpp_opts;
63 : :
64 : : /* Input filename. */
65 : : static const char *this_input_filename;
66 : :
67 : : /* Filename and stream for preprocessed output. */
68 : : static const char *out_fname;
69 : : static FILE *out_stream;
70 : :
71 : : /* Append dependencies to deps_file. */
72 : : static bool deps_append;
73 : :
74 : : /* If dependency switches (-MF etc.) have been given. */
75 : : static bool deps_seen;
76 : :
77 : : /* If -v seen. */
78 : : static bool verbose;
79 : :
80 : : /* Dependency output file. */
81 : : static const char *deps_file;
82 : :
83 : : /* Structured dependency output file. */
84 : : static const char *fdeps_file;
85 : :
86 : : /* The prefix given by -iprefix, if any. */
87 : : static const char *iprefix;
88 : :
89 : : /* The multilib directory given by -imultilib, if any. */
90 : : static const char *imultilib;
91 : :
92 : : /* The system root, if any. Overridden by -isysroot. */
93 : : static const char *sysroot = TARGET_SYSTEM_ROOT;
94 : :
95 : : /* Zero disables all standard directories for headers. */
96 : : static bool std_inc = true;
97 : :
98 : : /* Zero disables the C++-specific standard directories for headers. */
99 : : static bool std_cxx_inc = true;
100 : :
101 : : /* If the quote chain has been split by -I-. */
102 : : static bool quote_chain_split;
103 : :
104 : : /* Number of deferred options. */
105 : : static size_t deferred_count;
106 : :
107 : : /* Number of deferred options scanned for -include. */
108 : : static size_t include_cursor;
109 : :
110 : : /* Whether any standard preincluded header has been preincluded. */
111 : : static bool done_preinclude;
112 : :
113 : : static void handle_OPT_d (const char *);
114 : : static void set_std_cxx98 (int);
115 : : static void set_std_cxx11 (int);
116 : : static void set_std_cxx14 (int);
117 : : static void set_std_cxx17 (int);
118 : : static void set_std_cxx20 (int);
119 : : static void set_std_cxx23 (int);
120 : : static void set_std_cxx26 (int);
121 : : static void set_std_c89 (int, int);
122 : : static void set_std_c99 (int);
123 : : static void set_std_c11 (int);
124 : : static void set_std_c17 (int);
125 : : static void set_std_c23 (int);
126 : : static void set_std_c2y (int);
127 : : static void check_deps_environment_vars (void);
128 : : static void handle_deferred_opts (void);
129 : : static void sanitize_cpp_opts (void);
130 : : static void add_prefixed_path (const char *, incpath_kind);
131 : : static void push_command_line_include (void);
132 : : static void cb_file_change (cpp_reader *, const line_map_ordinary *);
133 : : static void cb_dir_change (cpp_reader *, const char *);
134 : : static void c_finish_options (void);
135 : :
136 : : #ifndef STDC_0_IN_SYSTEM_HEADERS
137 : : #define STDC_0_IN_SYSTEM_HEADERS 0
138 : : #endif
139 : :
140 : : /* Holds switches parsed by c_common_handle_option (), but whose
141 : : handling is deferred to c_common_post_options (). */
142 : : static void defer_opt (enum opt_code, const char *);
143 : : static struct deferred_opt
144 : : {
145 : : enum opt_code code;
146 : : const char *arg;
147 : : } *deferred_opts;
148 : :
149 : :
150 : : extern const unsigned int
151 : : c_family_lang_mask = (CL_C | CL_CXX | CL_ObjC | CL_ObjCXX);
152 : :
153 : : /* Defer option CODE with argument ARG. */
154 : : static void
155 : 179439 : defer_opt (enum opt_code code, const char *arg)
156 : : {
157 : 179439 : deferred_opts[deferred_count].code = code;
158 : 179439 : deferred_opts[deferred_count].arg = arg;
159 : 179439 : deferred_count++;
160 : 179439 : }
161 : :
162 : : /* Return language mask for option parsing. */
163 : : unsigned int
164 : 6005513 : c_common_option_lang_mask (void)
165 : : {
166 : 6005513 : static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
167 : :
168 : 6005513 : return lang_flags[c_language];
169 : : }
170 : :
171 : : /* Diagnostic finalizer for C/C++/Objective-C/Objective-C++. */
172 : : static void
173 : 313035 : c_diagnostic_text_finalizer (diagnostics::text_sink &text_output,
174 : : const diagnostics::diagnostic_info *diagnostic,
175 : : enum diagnostics::kind)
176 : : {
177 : 313035 : pretty_printer *const pp = text_output.get_printer ();
178 : 313035 : char *saved_prefix = pp_take_prefix (pp);
179 : 313035 : pp_set_prefix (pp, text_output.build_indent_prefix (false));
180 : 313035 : pp_newline (pp);
181 : 313035 : diagnostic_show_locus (&text_output.get_context (),
182 : 313035 : text_output.get_source_printing_options (),
183 : 313035 : diagnostic->m_richloc, diagnostic->m_kind, pp);
184 : : /* By default print macro expansion contexts in the diagnostic
185 : : finalizer -- for tokens resulting from macro expansion. */
186 : 313035 : diagnostics::virt_loc_aware_text_finalizer (text_output, diagnostic);
187 : 313035 : pp_set_prefix (pp, saved_prefix);
188 : 313035 : pp_flush (pp);
189 : 313035 : }
190 : :
191 : : /* Common default settings for diagnostics. */
192 : : void
193 : 209847 : c_common_diagnostics_set_defaults (diagnostics::context *context)
194 : : {
195 : 209847 : diagnostics::text_finalizer (context) = c_diagnostic_text_finalizer;
196 : 209847 : context->set_permissive_option (OPT_fpermissive);
197 : 209847 : }
198 : :
199 : : /* Input charset configuration for diagnostics. */
200 : : static const char *
201 : 61583 : c_common_input_charset_cb (const char * /*filename*/)
202 : : {
203 : 61583 : const char *cs = cpp_opts->input_charset;
204 : 61583 : return cpp_input_conversion_is_trivial (cs) ? nullptr : cs;
205 : : }
206 : :
207 : : /* Whether options from all C-family languages should be accepted
208 : : quietly. */
209 : : static bool accept_all_c_family_options = false;
210 : :
211 : : /* Return whether to complain about a wrong-language option. */
212 : : bool
213 : 292 : c_common_complain_wrong_lang_p (const struct cl_option *option)
214 : : {
215 : 292 : if (accept_all_c_family_options
216 : 6 : && (option->flags & c_family_lang_mask))
217 : 6 : return false;
218 : :
219 : : return true;
220 : : }
221 : :
222 : : /* Initialize options structure OPTS. */
223 : : void
224 : 47203102 : c_common_init_options_struct (struct gcc_options *opts)
225 : : {
226 : 47203102 : opts->x_flag_exceptions = c_dialect_cxx ();
227 : 47203102 : opts->x_warn_pointer_arith = c_dialect_cxx ();
228 : 47203102 : opts->x_warn_write_strings = c_dialect_cxx ();
229 : 47203102 : opts->x_flag_warn_unused_result = true;
230 : :
231 : : /* By default, C99-like requirements for complex multiply and divide. */
232 : 47203102 : opts->x_flag_complex_method = 2;
233 : 47203102 : opts->x_flag_default_complex_method = opts->x_flag_complex_method;
234 : 47203102 : }
235 : :
236 : : /* Common initialization before calling option handlers. */
237 : : void
238 : 209847 : c_common_init_options (unsigned int decoded_options_count,
239 : : struct cl_decoded_option *decoded_options)
240 : : {
241 : 209847 : unsigned int i;
242 : 209847 : struct cpp_callbacks *cb;
243 : :
244 : 209847 : g_string_concat_db
245 : 209847 : = new (ggc_alloc <string_concat_db> ()) string_concat_db ();
246 : :
247 : 323138 : parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX : CLK_GNUC89,
248 : : ident_hash, line_table, ident_hash_extra);
249 : 209847 : cb = cpp_get_callbacks (parse_in);
250 : 209847 : cb->diagnostic = c_cpp_diagnostic;
251 : :
252 : 209847 : cpp_opts = cpp_get_options (parse_in);
253 : 209847 : cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
254 : 209847 : cpp_opts->objc = c_dialect_objc ();
255 : 209847 : cpp_opts->deps.modules = true;
256 : :
257 : : /* Reset to avoid warnings on internal definitions. We set it just
258 : : before passing on command-line options to cpplib. */
259 : 209847 : cpp_opts->warn_dollars = 0;
260 : :
261 : 209847 : deferred_opts = XNEWVEC (struct deferred_opt, decoded_options_count);
262 : :
263 : 209847 : if (c_language == clk_c)
264 : : {
265 : : /* The default for C is gnu23. */
266 : 113291 : set_std_c23 (false /* ISO */);
267 : :
268 : : /* If preprocessing assembly language, accept any of the C-family
269 : : front end options since the driver may pass them through. */
270 : 2887767 : for (i = 1; i < decoded_options_count; i++)
271 : 2662166 : if (decoded_options[i].opt_index == OPT_lang_asm)
272 : : {
273 : 981 : accept_all_c_family_options = true;
274 : 981 : break;
275 : : }
276 : : }
277 : :
278 : : /* Set C++ standard to C++17 if not specified on the command line. */
279 : 209847 : if (c_dialect_cxx ())
280 : 96556 : set_std_cxx17 (/*ISO*/false);
281 : :
282 : 209847 : global_dc->get_source_printing_options ().colorize_source_p = true;
283 : 209847 : }
284 : :
285 : : /* Handle switch SCODE with argument ARG. VALUE is true, unless no-
286 : : form of an -f or -W option was given. Returns false if the switch was
287 : : invalid, true if valid. Use HANDLERS in recursive handle_option calls. */
288 : : bool
289 : 3317107 : c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
290 : : int kind, location_t loc,
291 : : const struct cl_option_handlers *handlers)
292 : : {
293 : 3317107 : const struct cl_option *option = &cl_options[scode];
294 : 3317107 : enum opt_code code = (enum opt_code) scode;
295 : 3317107 : bool result = true;
296 : :
297 : : /* Prevent resetting the language standard to a C dialect when the driver
298 : : has already determined that we're looking at assembler input. */
299 : 3317107 : bool preprocessing_asm_p = (cpp_get_options (parse_in)->lang == CLK_ASM);
300 : :
301 : 3317107 : switch (code)
302 : : {
303 : 1432771 : default:
304 : 1432771 : if (cl_options[code].flags & c_family_lang_mask)
305 : : {
306 : 1432771 : if ((option->flags & CL_TARGET)
307 : 1432771 : && ! targetcm.handle_c_option (scode, arg, value))
308 : : result = false;
309 : : break;
310 : : }
311 : : result = false;
312 : : break;
313 : :
314 : 467 : case OPT__output_pch:
315 : 467 : pch_file = arg;
316 : 467 : break;
317 : :
318 : 10 : case OPT_A:
319 : 10 : defer_opt (code, arg);
320 : 10 : break;
321 : :
322 : 13 : case OPT_C:
323 : 13 : cpp_opts->discard_comments = 0;
324 : 13 : break;
325 : :
326 : 11 : case OPT_CC:
327 : 11 : cpp_opts->discard_comments = 0;
328 : 11 : cpp_opts->discard_comments_in_macro_exp = 0;
329 : 11 : break;
330 : :
331 : 163421 : case OPT_D:
332 : 163421 : defer_opt (code, arg);
333 : 163421 : break;
334 : :
335 : 24 : case OPT_H:
336 : 24 : cpp_opts->print_include_names = 1;
337 : 24 : break;
338 : :
339 : : case OPT_F:
340 : : TARGET_OPTF (xstrdup (arg));
341 : : break;
342 : :
343 : 547367 : case OPT_I:
344 : 547367 : if (strcmp (arg, "-"))
345 : 547367 : add_path (xstrdup (arg), INC_BRACKET, 0, true);
346 : : else
347 : : {
348 : 0 : if (quote_chain_split)
349 : 0 : error ("%<-I-%> specified twice");
350 : 0 : quote_chain_split = true;
351 : 0 : split_quote_chain ();
352 : 0 : inform (input_location, "obsolete option %<-I-%> used, "
353 : : "please use %<-iquote%> instead");
354 : : }
355 : : break;
356 : :
357 : 25 : case OPT_M:
358 : 25 : case OPT_MM:
359 : : /* When doing dependencies with -M or -MM, suppress normal
360 : : preprocessed output, but still do -dM etc. as software
361 : : depends on this. Preprocessed output does occur if -MD, -MMD
362 : : or environment var dependency generation is used. */
363 : 25 : cpp_opts->deps.style = (code == OPT_M ? DEPS_SYSTEM : DEPS_USER);
364 : 25 : flag_no_output = 1;
365 : 25 : break;
366 : :
367 : 5832 : case OPT_MD:
368 : 5832 : case OPT_MMD:
369 : 5832 : cpp_opts->deps.style = (code == OPT_MD ? DEPS_SYSTEM : DEPS_USER);
370 : 5832 : cpp_opts->deps.need_preprocessor_output = true;
371 : 5832 : deps_file = arg;
372 : 5832 : break;
373 : :
374 : 51 : case OPT_fdeps_format_:
375 : : /* https://wg21.link/p1689r5 */
376 : 51 : if (!strcmp (arg, "p1689r5"))
377 : 48 : cpp_opts->deps.fdeps_format = FDEPS_FMT_P1689R5;
378 : : else
379 : 3 : error ("%<-fdeps-format=%> unknown format %qs", arg);
380 : : break;
381 : :
382 : 63 : case OPT_fdeps_file_:
383 : 63 : deps_seen = true;
384 : 63 : fdeps_file = arg;
385 : 63 : break;
386 : :
387 : 63 : case OPT_fdeps_target_:
388 : 63 : deps_seen = true;
389 : 63 : defer_opt (code, arg);
390 : 63 : break;
391 : :
392 : 5776 : case OPT_MF:
393 : 5776 : deps_seen = true;
394 : 5776 : deps_file = arg;
395 : 5776 : break;
396 : :
397 : 3 : case OPT_MG:
398 : 3 : deps_seen = true;
399 : 3 : cpp_opts->deps.missing_files = true;
400 : 3 : break;
401 : :
402 : 5761 : case OPT_MP:
403 : 5761 : deps_seen = true;
404 : 5761 : cpp_opts->deps.phony_targets = true;
405 : 5761 : break;
406 : :
407 : 0 : case OPT_Mmodules:
408 : : /* Do not set deps_seen, so the user can unconditionally turn
409 : : this on or off. */
410 : 0 : cpp_opts->deps.modules = true;
411 : 0 : break;
412 : :
413 : 3 : case OPT_Mno_modules:
414 : : /* Do not set deps_seen, so the user can unconditionally turn
415 : : this on or off. */
416 : 3 : cpp_opts->deps.modules = false;
417 : 3 : break;
418 : :
419 : 5828 : case OPT_MQ:
420 : 5828 : case OPT_MT:
421 : 5828 : deps_seen = true;
422 : 5828 : defer_opt (code, arg);
423 : 5828 : break;
424 : :
425 : 43 : case OPT_P:
426 : 43 : flag_no_line_commands = 1;
427 : 43 : break;
428 : :
429 : 61 : case OPT_U:
430 : 61 : defer_opt (code, arg);
431 : 61 : break;
432 : :
433 : 10874 : case OPT_Wall:
434 : : /* ??? Don't add new options here. Use LangEnabledBy in c.opt. */
435 : :
436 : 10874 : cpp_opts->warn_num_sign_change = value;
437 : 10874 : break;
438 : :
439 : 10956 : case OPT_Wunknown_pragmas:
440 : : /* Set to greater than 1, so that even unknown pragmas in
441 : : system headers will be warned about. */
442 : : /* ??? There is no way to handle this automatically for now. */
443 : 10956 : warn_unknown_pragmas = value * 2;
444 : 10956 : break;
445 : :
446 : 3947 : case OPT_ansi:
447 : 3947 : if (!c_dialect_cxx ())
448 : 3801 : set_std_c89 (false, true);
449 : : else
450 : 146 : set_std_cxx98 (true);
451 : : break;
452 : :
453 : 1615 : case OPT_d:
454 : 1615 : handle_OPT_d (arg);
455 : 1615 : break;
456 : :
457 : 13091 : case OPT_Wabi_:
458 : 13091 : warn_abi = true;
459 : 13091 : if (value == 1)
460 : : {
461 : 0 : warning (0, "%<-Wabi=1%> is not supported, using =2");
462 : 0 : value = 2;
463 : : }
464 : 13091 : warn_abi_version = value;
465 : 13091 : break;
466 : :
467 : 18 : case OPT_fcanonical_system_headers:
468 : 18 : cpp_opts->canonical_system_headers = value;
469 : 18 : break;
470 : :
471 : 12 : case OPT_fcond_mismatch:
472 : 12 : if (!c_dialect_cxx ())
473 : : {
474 : 12 : flag_cond_mismatch = value;
475 : 12 : break;
476 : : }
477 : 0 : warning (0, "switch %qs is no longer supported", option->opt_text);
478 : 0 : break;
479 : :
480 : 308 : case OPT_fbuiltin_:
481 : 308 : if (value)
482 : : result = false;
483 : : else
484 : 308 : disable_builtin_function (arg);
485 : : break;
486 : :
487 : 1090 : case OPT_fdirectives_only:
488 : 1090 : cpp_opts->directives_only = value;
489 : 1090 : break;
490 : :
491 : 7 : case OPT_fdollars_in_identifiers:
492 : 7 : cpp_opts->dollars_in_ident = value;
493 : 7 : break;
494 : :
495 : 8 : case OPT_fmacro_prefix_map_:
496 : 8 : add_macro_prefix_map (arg);
497 : 8 : break;
498 : :
499 : 567 : case OPT_ffreestanding:
500 : 567 : value = !value;
501 : : /* Fall through. */
502 : 575 : case OPT_fhosted:
503 : 575 : flag_hosted = value;
504 : 575 : flag_no_builtin = !value;
505 : 575 : break;
506 : :
507 : 0 : case OPT_fconstant_string_class_:
508 : 0 : constant_string_class_name = arg;
509 : 0 : break;
510 : :
511 : 0 : case OPT_fextended_identifiers:
512 : 0 : cpp_opts->extended_identifiers = value;
513 : 0 : break;
514 : :
515 : 4 : case OPT_fmax_include_depth_:
516 : 4 : cpp_opts->max_include_depth = value;
517 : 4 : break;
518 : :
519 : 4 : case OPT_foperator_names:
520 : 4 : cpp_opts->operator_names = value;
521 : 4 : break;
522 : :
523 : 0 : case OPT_fpch_deps:
524 : 0 : cpp_opts->restore_pch_deps = value;
525 : 0 : break;
526 : :
527 : 475 : case OPT_fpch_preprocess:
528 : 475 : flag_pch_preprocess = value;
529 : 475 : break;
530 : :
531 : 1151 : case OPT_fpermissive:
532 : 1151 : flag_permissive = value;
533 : 1151 : global_dc->m_permissive = value;
534 : 1151 : break;
535 : :
536 : 527 : case OPT_fpreprocessed:
537 : 527 : cpp_opts->preprocessed = value;
538 : 527 : break;
539 : :
540 : 2 : case OPT_fdebug_cpp:
541 : 2 : cpp_opts->debug = value;
542 : 2 : break;
543 : :
544 : 1 : case OPT_ftrack_macro_expansion:
545 : 1 : if (value)
546 : 0 : value = 2;
547 : : /* Fall Through. */
548 : :
549 : 483 : case OPT_ftrack_macro_expansion_:
550 : 483 : if (arg && *arg != '\0')
551 : 482 : cpp_opts->track_macro_expansion = value;
552 : : else
553 : 1 : cpp_opts->track_macro_expansion = 2;
554 : : break;
555 : :
556 : 86 : case OPT_fexec_charset_:
557 : 86 : cpp_opts->narrow_charset = arg;
558 : 86 : break;
559 : :
560 : 2 : case OPT_fwide_exec_charset_:
561 : 2 : cpp_opts->wide_charset = arg;
562 : 2 : break;
563 : :
564 : 93 : case OPT_finput_charset_:
565 : 93 : cpp_opts->input_charset = arg;
566 : 93 : cpp_opts->cpp_input_charset_explicit = 1;
567 : 93 : break;
568 : :
569 : 28 : case OPT_ftemplate_depth_:
570 : 28 : max_tinst_depth = value;
571 : 28 : break;
572 : :
573 : 21 : case OPT_fvisibility_inlines_hidden:
574 : 21 : visibility_options.inlines_hidden = value;
575 : 21 : break;
576 : :
577 : 22 : case OPT_femit_struct_debug_baseonly:
578 : 22 : set_struct_debug_option (&global_options, loc, "base");
579 : 22 : break;
580 : :
581 : 8 : case OPT_femit_struct_debug_reduced:
582 : 8 : set_struct_debug_option (&global_options, loc,
583 : : "dir:ord:sys,dir:gen:any,ind:base");
584 : 8 : break;
585 : :
586 : 12 : case OPT_femit_struct_debug_detailed_:
587 : 12 : set_struct_debug_option (&global_options, loc, arg);
588 : 12 : break;
589 : :
590 : 17 : case OPT_fext_numeric_literals:
591 : 17 : cpp_opts->ext_numeric_literals = value;
592 : 17 : break;
593 : :
594 : 4 : case OPT_idirafter:
595 : 4 : add_path (xstrdup (arg), INC_AFTER, 0, true);
596 : 4 : break;
597 : :
598 : 10056 : case OPT_imacros:
599 : 10056 : case OPT_include:
600 : 10056 : defer_opt (code, arg);
601 : 10056 : break;
602 : :
603 : 5329 : case OPT_imultilib:
604 : 5329 : imultilib = arg;
605 : 5329 : break;
606 : :
607 : 206512 : case OPT_iprefix:
608 : 206512 : iprefix = arg;
609 : 206512 : break;
610 : :
611 : 2862 : case OPT_iquote:
612 : 2862 : add_path (xstrdup (arg), INC_QUOTE, 0, true);
613 : 2862 : break;
614 : :
615 : 0 : case OPT_isysroot:
616 : 0 : sysroot = arg;
617 : 0 : break;
618 : :
619 : 464528 : case OPT_isystem:
620 : 464528 : add_path (xstrdup (arg), INC_SYSTEM, 0, true);
621 : 464528 : break;
622 : :
623 : 0 : case OPT_iwithprefix:
624 : 0 : add_prefixed_path (arg, INC_SYSTEM);
625 : 0 : break;
626 : :
627 : 0 : case OPT_iwithprefixbefore:
628 : 0 : add_prefixed_path (arg, INC_BRACKET);
629 : 0 : break;
630 : :
631 : 81 : case OPT__embed_dir_:
632 : 81 : add_path (xstrdup (arg), INC_EMBED, 0, true);
633 : 81 : break;
634 : :
635 : 981 : case OPT_lang_asm:
636 : 981 : cpp_set_lang (parse_in, CLK_ASM);
637 : 981 : cpp_opts->dollars_in_ident = false;
638 : 981 : break;
639 : :
640 : 60 : case OPT_nostdinc:
641 : 60 : std_inc = false;
642 : 60 : break;
643 : :
644 : 108937 : case OPT_nostdinc__:
645 : 108937 : std_cxx_inc = false;
646 : 108937 : break;
647 : :
648 : 209104 : case OPT_o:
649 : 209104 : if (!out_fname)
650 : 209104 : out_fname = arg;
651 : : else
652 : 0 : error ("output filename specified twice");
653 : : break;
654 : :
655 : 0 : case OPT_print_objc_runtime_info:
656 : 0 : print_struct_values = 1;
657 : 0 : break;
658 : :
659 : 2 : case OPT_remap:
660 : 2 : cpp_opts->remap = 1;
661 : 2 : break;
662 : :
663 : 13923 : case OPT_std_c__98:
664 : 13923 : case OPT_std_gnu__98:
665 : 13923 : if (!preprocessing_asm_p)
666 : 13923 : set_std_cxx98 (code == OPT_std_c__98 /* ISO */);
667 : : break;
668 : :
669 : 5606 : case OPT_std_c__11:
670 : 5606 : case OPT_std_gnu__11:
671 : 5606 : if (!preprocessing_asm_p)
672 : 5606 : set_std_cxx11 (code == OPT_std_c__11 /* ISO */);
673 : : break;
674 : :
675 : 1280 : case OPT_std_c__14:
676 : 1280 : case OPT_std_gnu__14:
677 : 1280 : if (!preprocessing_asm_p)
678 : 1280 : set_std_cxx14 (code == OPT_std_c__14 /* ISO */);
679 : : break;
680 : :
681 : 30552 : case OPT_std_c__17:
682 : 30552 : case OPT_std_gnu__17:
683 : 30552 : if (!preprocessing_asm_p)
684 : 30552 : set_std_cxx17 (code == OPT_std_c__17 /* ISO */);
685 : : break;
686 : :
687 : 5029 : case OPT_std_c__20:
688 : 5029 : case OPT_std_gnu__20:
689 : 5029 : if (!preprocessing_asm_p)
690 : 5029 : set_std_cxx20 (code == OPT_std_c__20 /* ISO */);
691 : : break;
692 : :
693 : 1942 : case OPT_std_c__23:
694 : 1942 : case OPT_std_gnu__23:
695 : 1942 : if (!preprocessing_asm_p)
696 : 1942 : set_std_cxx23 (code == OPT_std_c__23 /* ISO */);
697 : : break;
698 : :
699 : 23651 : case OPT_std_c__26:
700 : 23651 : case OPT_std_gnu__26:
701 : 23651 : if (!preprocessing_asm_p)
702 : 23651 : set_std_cxx26 (code == OPT_std_c__26 /* ISO */);
703 : : break;
704 : :
705 : 190 : case OPT_std_c90:
706 : 190 : case OPT_std_iso9899_199409:
707 : 190 : if (!preprocessing_asm_p)
708 : 190 : set_std_c89 (code == OPT_std_iso9899_199409 /* c94 */, true /* ISO */);
709 : : break;
710 : :
711 : 2952 : case OPT_std_gnu90:
712 : 2952 : if (!preprocessing_asm_p)
713 : 2952 : set_std_c89 (false /* c94 */, false /* ISO */);
714 : : break;
715 : :
716 : 573 : case OPT_std_c99:
717 : 573 : if (!preprocessing_asm_p)
718 : 572 : set_std_c99 (true /* ISO */);
719 : : break;
720 : :
721 : 606 : case OPT_std_gnu99:
722 : 606 : if (!preprocessing_asm_p)
723 : 606 : set_std_c99 (false /* ISO */);
724 : : break;
725 : :
726 : 512 : case OPT_std_c11:
727 : 512 : if (!preprocessing_asm_p)
728 : 512 : set_std_c11 (true /* ISO */);
729 : : break;
730 : :
731 : 3690 : case OPT_std_gnu11:
732 : 3690 : if (!preprocessing_asm_p)
733 : 3690 : set_std_c11 (false /* ISO */);
734 : : break;
735 : :
736 : 42 : case OPT_std_c17:
737 : 42 : if (!preprocessing_asm_p)
738 : 42 : set_std_c17 (true /* ISO */);
739 : : break;
740 : :
741 : 785 : case OPT_std_gnu17:
742 : 785 : if (!preprocessing_asm_p)
743 : 785 : set_std_c17 (false /* ISO */);
744 : : break;
745 : :
746 : 849 : case OPT_std_c23:
747 : 849 : if (!preprocessing_asm_p)
748 : 849 : set_std_c23 (true /* ISO */);
749 : : break;
750 : :
751 : 199 : case OPT_std_gnu23:
752 : 199 : if (!preprocessing_asm_p)
753 : 199 : set_std_c23 (false /* ISO */);
754 : : break;
755 : :
756 : 172 : case OPT_std_c2y:
757 : 172 : if (!preprocessing_asm_p)
758 : 172 : set_std_c2y (true /* ISO */);
759 : : break;
760 : :
761 : 8 : case OPT_std_gnu2y:
762 : 8 : if (!preprocessing_asm_p)
763 : 8 : set_std_c2y (false /* ISO */);
764 : : break;
765 : :
766 : 20 : case OPT_trigraphs:
767 : 20 : cpp_opts->trigraphs = 1;
768 : 20 : break;
769 : :
770 : 2927 : case OPT_traditional_cpp:
771 : 2927 : cpp_opts->traditional = 1;
772 : 2927 : break;
773 : :
774 : 0 : case OPT_fsearch_include_path:
775 : 0 : cpp_opts->main_search = CMS_user;
776 : 0 : break;
777 : :
778 : 0 : case OPT_fsearch_include_path_:
779 : 0 : if (!strcmp (arg, "user"))
780 : 0 : cpp_opts->main_search = CMS_user;
781 : 0 : else if (!strcmp (arg, "system"))
782 : 0 : cpp_opts->main_search = CMS_system;
783 : : else
784 : 0 : error ("invalid argument %qs to %<-fsearch-include-path%>", arg);
785 : : break;
786 : :
787 : 114 : case OPT_v:
788 : 114 : verbose = true;
789 : 114 : break;
790 : : }
791 : :
792 : 3317107 : switch (c_language)
793 : : {
794 : 1436126 : case clk_c:
795 : 1436126 : C_handle_option_auto (&global_options, &global_options_set,
796 : : scode, arg, value,
797 : : c_family_lang_mask, kind,
798 : : loc, handlers, global_dc);
799 : 1436126 : break;
800 : :
801 : 0 : case clk_objc:
802 : 0 : ObjC_handle_option_auto (&global_options, &global_options_set,
803 : : scode, arg, value,
804 : : c_family_lang_mask, kind,
805 : : loc, handlers, global_dc);
806 : 0 : break;
807 : :
808 : 1880981 : case clk_cxx:
809 : 1880981 : CXX_handle_option_auto (&global_options, &global_options_set,
810 : : scode, arg, value,
811 : : c_family_lang_mask, kind,
812 : : loc, handlers, global_dc);
813 : 1880981 : break;
814 : :
815 : 0 : case clk_objcxx:
816 : 0 : ObjCXX_handle_option_auto (&global_options, &global_options_set,
817 : : scode, arg, value,
818 : : c_family_lang_mask, kind,
819 : : loc, handlers, global_dc);
820 : 0 : break;
821 : :
822 : 0 : default:
823 : 0 : gcc_unreachable ();
824 : : }
825 : :
826 : 3317107 : cpp_handle_option_auto (&global_options, scode, cpp_opts);
827 : 3317107 : return result;
828 : : }
829 : :
830 : : /* Default implementation of TARGET_HANDLE_C_OPTION. */
831 : :
832 : : bool
833 : 0 : default_handle_c_option (size_t code ATTRIBUTE_UNUSED,
834 : : const char *arg ATTRIBUTE_UNUSED,
835 : : int value ATTRIBUTE_UNUSED)
836 : : {
837 : 0 : return false;
838 : : }
839 : :
840 : : /* Post-switch processing. */
841 : : bool
842 : 209742 : c_common_post_options (const char **pfilename)
843 : : {
844 : : /* Canonicalize the input and output filenames. */
845 : 209742 : if (in_fnames == NULL)
846 : : {
847 : 0 : in_fnames = XNEWVEC (const char *, 1);
848 : 0 : in_fnames[0] = "";
849 : : }
850 : 209742 : else if (strcmp (in_fnames[0], "-") == 0)
851 : : {
852 : 407 : if (pch_file)
853 : 0 : error ("cannot use %<-%> as input filename for a precompiled header");
854 : :
855 : 407 : in_fnames[0] = "";
856 : : }
857 : :
858 : 209742 : if (out_fname == NULL || !strcmp (out_fname, "-"))
859 : 743 : out_fname = "";
860 : :
861 : 209742 : if (cpp_opts->deps.style == DEPS_NONE)
862 : 203885 : check_deps_environment_vars ();
863 : :
864 : 209742 : handle_deferred_opts ();
865 : :
866 : 209742 : sanitize_cpp_opts ();
867 : :
868 : 209742 : register_include_chains (parse_in, sysroot, iprefix, imultilib,
869 : 209742 : std_inc, std_cxx_inc && c_dialect_cxx (), verbose);
870 : :
871 : : #ifdef C_COMMON_OVERRIDE_OPTIONS
872 : : /* Some machines may reject certain combinations of C
873 : : language-specific options. */
874 : : C_COMMON_OVERRIDE_OPTIONS;
875 : : #endif
876 : :
877 : 209742 : if (flag_excess_precision == EXCESS_PRECISION_DEFAULT)
878 : 359523 : flag_excess_precision = (flag_iso ? EXCESS_PRECISION_STANDARD
879 : : : EXCESS_PRECISION_FAST);
880 : :
881 : : /* ISO C restricts floating-point expression contraction to within
882 : : source-language expressions (-ffp-contract=on, currently an alias
883 : : for -ffp-contract=off). */
884 : 209742 : if (flag_iso
885 : 56799 : && !c_dialect_cxx ()
886 : 6129 : && (OPTION_SET_P (flag_fp_contract_mode)
887 : : == (enum fp_contract_mode) 0)
888 : 6129 : && flag_unsafe_math_optimizations == 0)
889 : 6124 : flag_fp_contract_mode = FP_CONTRACT_OFF;
890 : :
891 : : /* C language modes before C99 enable -fpermissive by default, but
892 : : only if -pedantic-errors is not specified. Also treat
893 : : -fno-permissive as a subset of -pedantic-errors that does not
894 : : reject certain GNU extensions also present the defaults for later
895 : : language modes. */
896 : 209742 : if (!c_dialect_cxx ()
897 : 113187 : && !flag_isoc99
898 : 6934 : && !global_dc->m_pedantic_errors
899 : 5936 : && !OPTION_SET_P (flag_permissive))
900 : : {
901 : 5935 : flag_permissive = 1;
902 : 5935 : global_dc->m_permissive = 1;
903 : : }
904 : :
905 : : /* If we are compiling C, and we are outside of a standards mode,
906 : : we can permit the new values from ISO/IEC TS 18661-3 for
907 : : FLT_EVAL_METHOD. Otherwise, we must restrict the possible values to
908 : : the set specified in ISO C99/C11. */
909 : 209742 : if (!flag_iso
910 : 152943 : && !c_dialect_cxx ()
911 : 107058 : && (OPTION_SET_P (flag_permitted_flt_eval_methods)
912 : : == PERMITTED_FLT_EVAL_METHODS_DEFAULT))
913 : 107057 : flag_permitted_flt_eval_methods = PERMITTED_FLT_EVAL_METHODS_TS_18661;
914 : : else
915 : 102685 : flag_permitted_flt_eval_methods = PERMITTED_FLT_EVAL_METHODS_C11;
916 : :
917 : 209742 : if (cxx_dialect >= cxx26)
918 : 23605 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
919 : : flag_auto_var_init, AUTO_INIT_CXX26);
920 : :
921 : : /* The -Wtrivial-auto-var-init warning is useless for C++, where we always
922 : : add .DEFERRED_INIT calls when some (vacuous) initializers are bypassed
923 : : through jumps from switch condition to case/default label. */
924 : 209742 : if (c_dialect_cxx ())
925 : 96555 : warn_trivial_auto_var_init = 0;
926 : :
927 : : /* C23 Annex F does not permit certain built-in functions to raise
928 : : "inexact". */
929 : 209742 : if (flag_isoc23)
930 : 100046 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
931 : : flag_fp_int_builtin_inexact, 0);
932 : :
933 : : /* By default we use C99 inline semantics in GNU99 or C99 mode. C99
934 : : inline semantics are not supported in GNU89 or C89 mode. */
935 : 209742 : if (flag_gnu89_inline == -1)
936 : 209302 : flag_gnu89_inline = !flag_isoc99;
937 : 440 : else if (!flag_gnu89_inline && !flag_isoc99)
938 : 1 : error ("%<-fno-gnu89-inline%> is only supported in GNU99 or C99 mode");
939 : :
940 : : /* Default to ObjC sjlj exception handling if NeXT runtime < v2. */
941 : 209742 : if (flag_objc_sjlj_exceptions < 0)
942 : 419484 : flag_objc_sjlj_exceptions = (flag_next_runtime && flag_objc_abi < 2);
943 : 209742 : if (flag_objc_exceptions && !flag_objc_sjlj_exceptions)
944 : 0 : flag_exceptions = 1;
945 : :
946 : : /* If -ffreestanding, -fno-hosted or -fno-builtin then disable
947 : : pattern recognition. */
948 : 209742 : if (flag_no_builtin)
949 : 760 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
950 : : flag_tree_loop_distribute_patterns, 0);
951 : :
952 : : /* -Woverlength-strings is off by default, but is enabled by -Wpedantic.
953 : : It is never enabled in C++, as the minimum limit is not normative
954 : : in that standard. */
955 : 209742 : if (c_dialect_cxx ())
956 : 96555 : warn_overlength_strings = 0;
957 : :
958 : : /* Wmain is enabled by default in C++ but not in C. */
959 : : /* Wmain is disabled by default for -ffreestanding (!flag_hosted),
960 : : even if -Wall or -Wpedantic was given (warn_main will be 2 if set
961 : : by -Wall, 1 if set by -Wmain). */
962 : 209742 : if (warn_main == -1)
963 : 256237 : warn_main = (c_dialect_cxx () && flag_hosted) ? 1 : 0;
964 : 55519 : else if (warn_main == 2)
965 : 55198 : warn_main = flag_hosted ? 1 : 0;
966 : :
967 : : /* In C, -Wall and -Wc++-compat enable -Wenum-compare; if it has not
968 : : yet been set, it is disabled by default. In C++, it is enabled
969 : : by default. */
970 : 209742 : if (warn_enum_compare == -1)
971 : 200269 : warn_enum_compare = c_dialect_cxx () ? 1 : 0;
972 : :
973 : : /* For C++26 default to -Wkeyword-macro if -Wpedantic. */
974 : 209742 : if (cxx_dialect >= cxx26 && pedantic)
975 : : {
976 : 14067 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
977 : : warn_keyword_macro, 1);
978 : 14067 : if (warn_keyword_macro)
979 : 14066 : cpp_opts->cpp_warn_keyword_macro = warn_keyword_macro;
980 : : }
981 : :
982 : : /* -Wpacked-bitfield-compat is on by default for the C languages. The
983 : : warning is issued in stor-layout.cc which is not part of the front-end so
984 : : we need to selectively turn it on here. */
985 : 209742 : if (warn_packed_bitfield_compat == -1)
986 : 209734 : warn_packed_bitfield_compat = 1;
987 : :
988 : : /* Special format checking options don't work without -Wformat; warn if
989 : : they are used. */
990 : 209742 : if (!warn_format)
991 : : {
992 : 198520 : warning (OPT_Wformat_y2k,
993 : : "%<-Wformat-y2k%> ignored without %<-Wformat%>");
994 : 198520 : warning (OPT_Wformat_extra_args,
995 : : "%<-Wformat-extra-args%> ignored without %<-Wformat%>");
996 : 198520 : warning (OPT_Wformat_zero_length,
997 : : "%<-Wformat-zero-length%> ignored without %<-Wformat%>");
998 : 198520 : warning (OPT_Wformat_nonliteral,
999 : : "%<-Wformat-nonliteral%> ignored without %<-Wformat%>");
1000 : 198520 : warning (OPT_Wformat_contains_nul,
1001 : : "%<-Wformat-contains-nul%> ignored without %<-Wformat%>");
1002 : 198520 : warning (OPT_Wformat_security,
1003 : : "%<-Wformat-security%> ignored without %<-Wformat%>");
1004 : : }
1005 : :
1006 : : /* -Wimplicit-function-declaration is enabled by default for C99. */
1007 : 209742 : if (warn_implicit_function_declaration == -1)
1008 : 201415 : warn_implicit_function_declaration = flag_isoc99;
1009 : :
1010 : : /* -Wimplicit-int is enabled by default for C99. */
1011 : 209742 : if (warn_implicit_int == -1)
1012 : 201472 : warn_implicit_int = flag_isoc99;
1013 : :
1014 : : /* -Wold-style-definition is enabled by default for C23. */
1015 : 209742 : if (warn_old_style_definition == -1)
1016 : 205452 : warn_old_style_definition = flag_isoc23;
1017 : :
1018 : : /* -Wshift-overflow is enabled by default in C99 and C++11 modes. */
1019 : 209742 : if (warn_shift_overflow == -1)
1020 : 398449 : warn_shift_overflow = cxx_dialect >= cxx11 || flag_isoc99;
1021 : :
1022 : : /* -Wmissing-parameter-name is enabled by -pedantic before C23,
1023 : : and for -Wc11-c23-compat. */
1024 : 209742 : if (warn_missing_parameter_name == -1)
1025 : 209739 : warn_missing_parameter_name
1026 : 46963 : = ((pedantic && !flag_isoc23 && warn_c11_c23_compat != 0)
1027 : 256747 : || warn_c11_c23_compat > 0);
1028 : :
1029 : : /* Likewise for -Wfree-labels. */
1030 : 209742 : if (warn_free_labels == -1)
1031 : 46963 : warn_free_labels = ((pedantic && !flag_isoc23 && warn_c11_c23_compat != 0)
1032 : 256747 : || warn_c11_c23_compat > 0);
1033 : :
1034 : 209742 : if (warn_deprecated_non_prototype == -1)
1035 : 209737 : warn_deprecated_non_prototype = warn_c11_c23_compat > 0;
1036 : :
1037 : : /* -Wshift-negative-value is enabled by -Wextra in C99 and C++11 to C++17
1038 : : modes. */
1039 : 209742 : if (warn_shift_negative_value == -1)
1040 : 419444 : warn_shift_negative_value = (extra_warnings
1041 : 7761 : && (cxx_dialect >= cxx11 || flag_isoc99)
1042 : 419573 : && cxx_dialect < cxx20);
1043 : :
1044 : : /* -Wregister is enabled by default in C++17. */
1045 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set, warn_register,
1046 : : cxx_dialect >= cxx17);
1047 : :
1048 : : /* Explicit -Wdeprecated turns on warnings from later standards. */
1049 : 1641419 : auto deprecated_in = [&](enum cxx_dialect d)
1050 : : {
1051 : 1431677 : if (OPTION_SET_P (warn_deprecated)) return !!warn_deprecated;
1052 : 1430083 : return (warn_deprecated && cxx_dialect >= d);
1053 : : };
1054 : :
1055 : : /* -Wcomma-subscript is enabled by default in C++20. */
1056 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1057 : : warn_comma_subscript,
1058 : : cxx_dialect >= cxx23
1059 : : || deprecated_in (cxx20));
1060 : :
1061 : : /* -Wvolatile is enabled by default in C++20. */
1062 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set, warn_volatile,
1063 : : deprecated_in (cxx20));
1064 : :
1065 : : /* -Wdeprecated-enum-enum-conversion is enabled by default in C++20. */
1066 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1067 : : warn_deprecated_enum_enum_conv,
1068 : : deprecated_in (cxx20));
1069 : :
1070 : : /* -Wdeprecated-enum-float-conversion is enabled by default in C++20. */
1071 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1072 : : warn_deprecated_enum_float_conv,
1073 : : deprecated_in (cxx20));
1074 : :
1075 : : /* -Wdeprecated-literal-operator is enabled by default in C++23. */
1076 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1077 : : warn_deprecated_literal_operator,
1078 : : deprecated_in (cxx23));
1079 : :
1080 : : /* -Warray-compare is enabled by default in C++20. */
1081 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1082 : : warn_array_compare,
1083 : : warn_array_compare || deprecated_in (cxx20));
1084 : :
1085 : : /* -Wdeprecated-variadic-comma-omission is enabled by default in C++26. */
1086 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1087 : : warn_deprecated_variadic_comma_omission,
1088 : : deprecated_in (cxx26));
1089 : :
1090 : : /* -Wtemplate-id-cdtor is enabled by default in C++20. */
1091 : 242382 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1092 : : warn_template_id_cdtor,
1093 : : cxx_dialect >= cxx20 || warn_cxx20_compat);
1094 : :
1095 : : /* Declone C++ 'structors if -Os. */
1096 : 209742 : if (flag_declone_ctor_dtor == -1)
1097 : 209705 : flag_declone_ctor_dtor = optimize_size;
1098 : :
1099 : 209742 : if (flag_abi_compat_version == 1)
1100 : : {
1101 : 0 : warning (0, "%<-fabi-compat-version=1%> is not supported, using =2");
1102 : 0 : flag_abi_compat_version = 2;
1103 : : }
1104 : :
1105 : : /* Change flag_abi_version to be the actual current ABI level, for the
1106 : : benefit of c_cpp_builtins, and to make comparison simpler. */
1107 : 209742 : const int latest_abi_version = 21;
1108 : : /* Possibly different for non-default ABI fixes within a release. */
1109 : 209742 : const int default_abi_version = latest_abi_version;
1110 : : /* Generate compatibility aliases for ABI v18 (GCC 13) by default. */
1111 : 209742 : const int abi_compat_default = 18;
1112 : :
1113 : 209742 : if (flag_abi_version > latest_abi_version)
1114 : 0 : warning (0, "%<-fabi-version=%d%> is not supported, using =%d",
1115 : : flag_abi_version, latest_abi_version);
1116 : :
1117 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1118 : : flag_abi_version, default_abi_version);
1119 : :
1120 : : #define clamp(X) if (X == 0 || X > latest_abi_version) X = latest_abi_version
1121 : 209742 : clamp (flag_abi_version);
1122 : : /* Don't clamp warn_abi_version, let it be 0 or out of bounds. */
1123 : 209742 : clamp (flag_abi_compat_version);
1124 : : #undef clamp
1125 : :
1126 : : /* Default -Wabi= or -fabi-compat-version= from each other. */
1127 : 209742 : if (warn_abi_version == -1 && flag_abi_compat_version != -1)
1128 : 192 : warn_abi_version = flag_abi_compat_version;
1129 : 209550 : else if (flag_abi_compat_version == -1 && warn_abi_version != -1)
1130 : 13044 : flag_abi_compat_version = warn_abi_version;
1131 : 196506 : else if (warn_abi_version == -1 && flag_abi_compat_version == -1)
1132 : : {
1133 : 196461 : warn_abi_version = 0;
1134 : 196461 : if (flag_abi_version == default_abi_version)
1135 : 196226 : flag_abi_compat_version = abi_compat_default;
1136 : : else
1137 : 235 : flag_abi_compat_version = latest_abi_version;
1138 : : }
1139 : :
1140 : : /* Allow warnings vs ABI versions beyond what we currently support. */
1141 : 209742 : if (warn_abi_version == 0)
1142 : 196476 : warn_abi_version = 1000;
1143 : :
1144 : : /* By default, enable the new inheriting constructor semantics along with ABI
1145 : : 11. New and old should coexist fine, but it is a change in what
1146 : : artificial symbols are generated. */
1147 : 419228 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1148 : : flag_new_inheriting_ctors,
1149 : : abi_version_at_least (11));
1150 : :
1151 : : /* For GCC 7, only enable DR150 resolution by default if -std=c++17. */
1152 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set, flag_new_ttp,
1153 : : cxx_dialect >= cxx17);
1154 : :
1155 : : /* C++11 guarantees forward progress. */
1156 : 393531 : SET_OPTION_IF_UNSET (&global_options, &global_options_set, flag_finite_loops,
1157 : : optimize >= 2 && cxx_dialect >= cxx11);
1158 : :
1159 : : /* It's OK to discard calls to pure/const functions that might throw. */
1160 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1161 : : flag_delete_dead_exceptions, true);
1162 : :
1163 : 209742 : if (cxx_dialect >= cxx11)
1164 : : {
1165 : : /* If we're allowing C++0x constructs, don't warn about C++98
1166 : : identifiers which are keywords in C++0x. */
1167 : 82556 : warn_cxx11_compat = 0;
1168 : 82556 : cpp_opts->cpp_warn_cxx11_compat = 0;
1169 : :
1170 : 82556 : if (warn_narrowing == -1)
1171 : 80385 : warn_narrowing = 1;
1172 : :
1173 : : /* Unless -f{,no-}ext-numeric-literals has been used explicitly,
1174 : : for -std=c++{11,14,17,20,23,26} default to
1175 : : -fno-ext-numeric-literals. */
1176 : 82556 : if (flag_iso && !OPTION_SET_P (flag_ext_numeric_literals))
1177 : 41884 : cpp_opts->ext_numeric_literals = 0;
1178 : : }
1179 : 127186 : else if (warn_narrowing == -1)
1180 : 126698 : warn_narrowing = 0;
1181 : :
1182 : 209742 : if (cxx_dialect >= cxx20)
1183 : : {
1184 : : /* Don't warn about C++20 compatibility changes in C++20 or later. */
1185 : 30572 : warn_cxx20_compat = 0;
1186 : 30572 : cpp_opts->cpp_warn_cxx20_compat = 0;
1187 : : }
1188 : 209742 : if (cxx_dialect >= cxx26)
1189 : : /* Don't warn about C++26 compatibility changes in C++26 or later. */
1190 : 23605 : warn_cxx26_compat = 0;
1191 : :
1192 : : /* C++17 has stricter evaluation order requirements; let's use some of them
1193 : : for earlier C++ as well, so chaining works as expected. */
1194 : 209742 : if (c_dialect_cxx ()
1195 : 96555 : && flag_strong_eval_order == -1)
1196 : 117391 : flag_strong_eval_order = (cxx_dialect >= cxx17 ? 2 : 1);
1197 : :
1198 : 209742 : if (flag_implicit_constexpr && cxx_dialect < cxx14)
1199 : 0 : flag_implicit_constexpr = false;
1200 : :
1201 : : /* Global sized deallocation is new in C++14. */
1202 : 209742 : if (flag_sized_deallocation == -1)
1203 : 209738 : flag_sized_deallocation = (cxx_dialect >= cxx14);
1204 : :
1205 : : /* Pedwarn about invalid constexpr functions before C++23. */
1206 : 209742 : if (warn_invalid_constexpr == -1)
1207 : 209726 : warn_invalid_constexpr = (cxx_dialect < cxx23);
1208 : :
1209 : : /* char8_t support is implicitly enabled in C++20 and C23. */
1210 : 209742 : if (flag_char8_t == -1)
1211 : 340234 : flag_char8_t = (cxx_dialect >= cxx20) || flag_isoc23;
1212 : 209742 : cpp_opts->unsigned_utf8char = flag_char8_t ? 1 : cpp_opts->unsigned_char;
1213 : :
1214 : 209742 : cpp_opts->cpp_tabstop = global_dc->get_column_options ().m_tabstop;
1215 : :
1216 : 209742 : if (flag_extern_tls_init)
1217 : : {
1218 : 209740 : if (!TARGET_SUPPORTS_ALIASES || !SUPPORTS_WEAK)
1219 : : {
1220 : : /* Lazy TLS initialization for a variable in another TU requires
1221 : : alias and weak reference support. */
1222 : : if (flag_extern_tls_init > 0)
1223 : : sorry ("external TLS initialization functions not supported "
1224 : : "on this target");
1225 : :
1226 : : flag_extern_tls_init = 0;
1227 : : }
1228 : : else
1229 : 209740 : flag_extern_tls_init = 1;
1230 : : }
1231 : :
1232 : : /* Enable by default only for C++ and C++ with ObjC extensions. */
1233 : 209742 : if (warn_return_type == -1 && c_dialect_cxx ())
1234 : 93051 : warn_return_type = 1;
1235 : :
1236 : : /* C++20 is the final version of concepts. We still use -fconcepts
1237 : : to know when concepts are enabled. */
1238 : 209742 : if (cxx_dialect >= cxx20)
1239 : 30572 : flag_concepts = 1;
1240 : :
1241 : : /* Coroutines are also a C++20 feature. */
1242 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1243 : : flag_coroutines, cxx_dialect >= cxx20);
1244 : :
1245 : : /* Enable lifetime extension of range based for temporaries for C++23. */
1246 : 209742 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1247 : : flag_range_for_ext_temps, cxx_dialect >= cxx23);
1248 : :
1249 : : /* EnabledBy unfortunately can't specify value to use if set and
1250 : : LangEnabledBy can't specify multiple options with &&. For -Wunused
1251 : : or -Wunused -Wextra we want these to default to 3 unless user specified
1252 : : some other level explicitly. */
1253 : 209742 : if (warn_unused_but_set_parameter == 1)
1254 : 7605 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1255 : : warn_unused_but_set_parameter, 3);
1256 : 209742 : if (warn_unused_but_set_variable == 1)
1257 : 10414 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
1258 : : warn_unused_but_set_variable, 3);
1259 : :
1260 : : /* -fimmediate-escalation has no effect when immediate functions are not
1261 : : supported. */
1262 : 209742 : if (flag_immediate_escalation && cxx_dialect < cxx20)
1263 : 179170 : flag_immediate_escalation = 0;
1264 : :
1265 : 209742 : if (num_in_fnames > 1)
1266 : 0 : error ("too many filenames given; type %<%s %s%> for usage",
1267 : : progname, "--help");
1268 : :
1269 : 209742 : if (flag_preprocess_only)
1270 : : {
1271 : : /* Open the output now. We must do so even if flag_no_output is
1272 : : on, because there may be other output than from the actual
1273 : : preprocessing (e.g. from -dM). */
1274 : 6789 : if (out_fname[0] == '\0')
1275 : 743 : out_stream = stdout;
1276 : : else
1277 : 6046 : out_stream = fopen (out_fname, "w");
1278 : :
1279 : 6789 : if (out_stream == NULL)
1280 : 0 : fatal_error (input_location, "opening output file %s: %m", out_fname);
1281 : :
1282 : 6789 : init_pp_output (out_stream);
1283 : : }
1284 : : else
1285 : : {
1286 : 202953 : init_c_lex ();
1287 : :
1288 : : /* When writing a PCH file, avoid reading some other PCH file,
1289 : : because the default address space slot then can't be used
1290 : : for the output PCH file. */
1291 : 202953 : if (pch_file)
1292 : : {
1293 : 467 : c_common_no_more_pch ();
1294 : : /* Only -g0 and -gdwarf* are supported with PCH, for other
1295 : : debug formats we warn here and refuse to load any PCH files. */
1296 : 467 : if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG)
1297 : 0 : warning (OPT_Wdeprecated,
1298 : : "the %qs debug info cannot be used with "
1299 : : "pre-compiled headers",
1300 : : debug_set_names (write_symbols & ~DWARF2_DEBUG));
1301 : : /* Let libcpp know that the main file is a header so it won't
1302 : : complain about things like #include_next and #pragma once. */
1303 : 467 : cpp_opts->main_search = CMS_header;
1304 : : }
1305 : 202486 : else if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG)
1306 : 481 : c_common_no_more_pch ();
1307 : :
1308 : : /* Yuk. WTF is this? I do know ObjC relies on it somewhere. */
1309 : 202953 : input_location = UNKNOWN_LOCATION;
1310 : : }
1311 : :
1312 : 209742 : struct cpp_callbacks *cb = cpp_get_callbacks (parse_in);
1313 : 209742 : cb->file_change = cb_file_change;
1314 : 209742 : cb->dir_change = cb_dir_change;
1315 : 209742 : if (lang_hooks.preprocess_options)
1316 : 96555 : lang_hooks.preprocess_options (parse_in);
1317 : 209742 : cpp_post_options (parse_in);
1318 : 209742 : init_global_opts_from_cpp (&global_options, cpp_get_options (parse_in));
1319 : : /* For C++23 and explicit -finput-charset=UTF-8, turn on -Winvalid-utf8
1320 : : by default and make it a pedwarn unless -Wno-invalid-utf8. */
1321 : 209742 : if (cxx_dialect >= cxx23
1322 : 25545 : && cpp_opts->cpp_input_charset_explicit
1323 : 23 : && strcmp (cpp_opts->input_charset, "UTF-8") == 0
1324 : 21 : && (cpp_opts->cpp_warn_invalid_utf8
1325 : 16 : || !global_options_set.x_warn_invalid_utf8))
1326 : : {
1327 : 18 : global_options.x_warn_invalid_utf8 = 1;
1328 : 28 : cpp_opts->cpp_warn_invalid_utf8 = cpp_opts->cpp_pedantic ? 2 : 1;
1329 : : }
1330 : :
1331 : : /* Let diagnostics infrastructure know how to convert input files the same
1332 : : way libcpp will do it, namely using the configured input charset and
1333 : : skipping a UTF-8 BOM if present. */
1334 : 209742 : diagnostic_initialize_input_context (global_dc,
1335 : : c_common_input_charset_cb, true);
1336 : 209742 : input_location = UNKNOWN_LOCATION;
1337 : :
1338 : 419484 : *pfilename = this_input_filename
1339 : 419484 : = cpp_read_main_file (parse_in, in_fnames[0],
1340 : : /* We'll inject preamble pieces if this is
1341 : : not preprocessed. */
1342 : 209742 : !cpp_opts->preprocessed);
1343 : :
1344 : : /* Don't do any compilation or preprocessing if there is no input file. */
1345 : 209742 : if (this_input_filename == NULL)
1346 : : {
1347 : 0 : errorcount++;
1348 : 0 : return false;
1349 : : }
1350 : :
1351 : 209742 : if (flag_working_directory
1352 : 42543 : && flag_preprocess_only && !flag_no_line_commands)
1353 : 2279 : pp_dir_change (parse_in, get_src_pwd ());
1354 : :
1355 : : /* Disable LTO output when outputting a precompiled header. */
1356 : 209742 : if (pch_file && flag_lto)
1357 : : {
1358 : 0 : flag_lto = 0;
1359 : 0 : flag_generate_lto = 0;
1360 : : }
1361 : :
1362 : 209742 : return flag_preprocess_only;
1363 : : }
1364 : :
1365 : : /* Front end initialization common to C, ObjC and C++. */
1366 : : bool
1367 : 209538 : c_common_init (void)
1368 : : {
1369 : : /* Set up preprocessor arithmetic. Must be done after call to
1370 : : c_common_nodes_and_builtins for type nodes to be good. */
1371 : 209538 : cpp_opts->precision = TYPE_PRECISION (intmax_type_node);
1372 : 209538 : cpp_opts->char_precision = TYPE_PRECISION (char_type_node);
1373 : 209538 : cpp_opts->int_precision = TYPE_PRECISION (integer_type_node);
1374 : 209538 : cpp_opts->wchar_precision = TYPE_PRECISION (wchar_type_node);
1375 : 209538 : cpp_opts->unsigned_wchar = TYPE_UNSIGNED (wchar_type_node);
1376 : 209538 : cpp_opts->bytes_big_endian = BYTES_BIG_ENDIAN;
1377 : :
1378 : : /* This can't happen until after wchar_precision and bytes_big_endian
1379 : : are known. */
1380 : 209538 : cpp_init_iconv (parse_in);
1381 : :
1382 : 209538 : if (version_flag)
1383 : : {
1384 : 111 : int i;
1385 : 111 : fputs ("Compiler executable checksum: ", stderr);
1386 : 1998 : for (i = 0; i < 16; i++)
1387 : 1776 : fprintf (stderr, "%02x", executable_checksum[i]);
1388 : 111 : putc ('\n', stderr);
1389 : : }
1390 : :
1391 : : /* Has to wait until now so that cpplib has its hash table. */
1392 : 209538 : init_pragma ();
1393 : :
1394 : 209538 : if (flag_preprocess_only)
1395 : : {
1396 : 6784 : c_init_preprocess ();
1397 : 6784 : c_finish_options ();
1398 : 6784 : preprocess_file (parse_in);
1399 : 6784 : return false;
1400 : : }
1401 : :
1402 : : return true;
1403 : : }
1404 : :
1405 : : /* Initialize the integrated preprocessor after debug output has been
1406 : : initialized; loop over each input file. */
1407 : : void
1408 : 202754 : c_common_parse_file (void)
1409 : : {
1410 : 202754 : auto dumps = g->get_dumps ();
1411 : 202754 : for (unsigned int i = 0;;)
1412 : : {
1413 : 202754 : c_finish_options ();
1414 : : /* Open the dump file to use for the original dump output
1415 : : here, to be used during parsing for the current file. */
1416 : 202754 : dumps->dump_start (TDI_original, &dump_flags);
1417 : 202754 : pch_init ();
1418 : 202754 : push_file_scope ();
1419 : 202754 : c_parse_file ();
1420 : 202467 : pop_file_scope ();
1421 : : /* And end the main input file, if the debug writer wants it */
1422 : 202467 : if (debug_hooks->start_end_main_source_file)
1423 : 40074 : (*debug_hooks->end_source_file) (0);
1424 : 202467 : if (++i >= num_in_fnames)
1425 : : break;
1426 : 0 : cpp_undef_all (parse_in);
1427 : 0 : cpp_clear_file_cache (parse_in);
1428 : 0 : this_input_filename
1429 : 0 : = cpp_read_main_file (parse_in, in_fnames[i]);
1430 : : /* If an input file is missing, abandon further compilation.
1431 : : cpplib has issued a diagnostic. */
1432 : 0 : if (!this_input_filename)
1433 : : break;
1434 : 0 : dumps->dump_finish (TDI_original);
1435 : : }
1436 : :
1437 : 202467 : c_parse_final_cleanups ();
1438 : 202455 : dumps->dump_finish (TDI_original);
1439 : 202455 : }
1440 : :
1441 : : /* Common finish hook for the C, ObjC and C++ front ends. */
1442 : : void
1443 : 209046 : c_common_finish (void)
1444 : : {
1445 : 209046 : FILE *deps_stream = NULL;
1446 : 209046 : FILE *fdeps_stream = NULL;
1447 : :
1448 : : /* Note that we write the dependencies even if there are errors. This is
1449 : : useful for handling outdated generated headers that now trigger errors
1450 : : (for example, with #error) which would be resolved by re-generating
1451 : : them. In a sense, this complements -MG. */
1452 : 209046 : if (cpp_opts->deps.style != DEPS_NONE)
1453 : : {
1454 : : /* If -M or -MM was seen without -MF, default output to the
1455 : : output stream. */
1456 : 5852 : if (!deps_file)
1457 : 22 : deps_stream = out_stream;
1458 : 5830 : else if (deps_file[0] == '-' && deps_file[1] == '\0')
1459 : 0 : deps_stream = stdout;
1460 : : else
1461 : : {
1462 : 11660 : deps_stream = fopen (deps_file, deps_append ? "a" : "w");
1463 : 5830 : if (!deps_stream)
1464 : 0 : fatal_error (input_location, "opening dependency file %s: %m",
1465 : : deps_file);
1466 : : }
1467 : : }
1468 : :
1469 : : /* When we call cpp_finish (), it may generate some diagnostics using
1470 : : locations it remembered from the preprocessing phase, e.g. for
1471 : : -Wunused-macros. So inform c_cpp_diagnostic () not to override those
1472 : : locations with input_location, which would be incorrect now. */
1473 : 209046 : override_libcpp_locations = false;
1474 : :
1475 : 209046 : if (cpp_opts->deps.fdeps_format != FDEPS_FMT_NONE)
1476 : : {
1477 : 36 : if (!fdeps_file)
1478 : 0 : fdeps_stream = out_stream;
1479 : 36 : else if (fdeps_file[0] == '-' && fdeps_file[1] == '\0')
1480 : 0 : fdeps_stream = stdout;
1481 : : else
1482 : : {
1483 : 36 : fdeps_stream = fopen (fdeps_file, "w");
1484 : 36 : if (!fdeps_stream)
1485 : 0 : fatal_error (input_location, "opening dependency file %s: %m",
1486 : : fdeps_file);
1487 : : }
1488 : 36 : if (fdeps_stream == deps_stream && fdeps_stream != stdout)
1489 : 0 : fatal_error (input_location, "%<-MF%> and %<-fdeps-file=%> cannot share an output file %s: %m",
1490 : : fdeps_file);
1491 : : }
1492 : :
1493 : : /* For performance, avoid tearing down cpplib's internal structures
1494 : : with cpp_destroy (). */
1495 : 209046 : cpp_finish (parse_in, deps_stream, fdeps_stream);
1496 : :
1497 : 5852 : if (deps_stream && deps_stream != out_stream && deps_stream != stdout
1498 : 214876 : && (ferror (deps_stream) || fclose (deps_stream)))
1499 : 0 : fatal_error (input_location, "closing dependency file %s: %m", deps_file);
1500 : :
1501 : 209046 : if (out_stream && (ferror (out_stream) || fclose (out_stream)))
1502 : 0 : fatal_error (input_location, "when writing output to %s: %m", out_fname);
1503 : 209046 : }
1504 : :
1505 : : /* Either of two environment variables can specify output of
1506 : : dependencies. Their value is either "OUTPUT_FILE" or "OUTPUT_FILE
1507 : : DEPS_TARGET", where OUTPUT_FILE is the file to write deps info to
1508 : : and DEPS_TARGET is the target to mention in the deps. They also
1509 : : result in dependency information being appended to the output file
1510 : : rather than overwriting it, and like Sun's compiler
1511 : : SUNPRO_DEPENDENCIES suppresses the dependency on the main file. */
1512 : : static void
1513 : 203885 : check_deps_environment_vars (void)
1514 : : {
1515 : 203885 : char *spec;
1516 : :
1517 : 203885 : spec = getenv ("DEPENDENCIES_OUTPUT");
1518 : 203885 : if (spec)
1519 : 0 : cpp_opts->deps.style = DEPS_USER;
1520 : : else
1521 : : {
1522 : 203885 : spec = getenv ("SUNPRO_DEPENDENCIES");
1523 : 203885 : if (spec)
1524 : : {
1525 : 0 : cpp_opts->deps.style = DEPS_SYSTEM;
1526 : 0 : cpp_opts->deps.ignore_main_file = true;
1527 : : }
1528 : : }
1529 : :
1530 : 0 : if (spec)
1531 : : {
1532 : : /* Find the space before the DEPS_TARGET, if there is one. */
1533 : 0 : char *s = strchr (spec, ' ');
1534 : 0 : if (s)
1535 : : {
1536 : : /* Let the caller perform MAKE quoting. */
1537 : 0 : defer_opt (OPT_MT, s + 1);
1538 : 0 : *s = '\0';
1539 : : }
1540 : :
1541 : : /* Command line -MF overrides environment variables and default. */
1542 : 0 : if (!deps_file)
1543 : 0 : deps_file = spec;
1544 : :
1545 : 0 : deps_append = 1;
1546 : 0 : deps_seen = true;
1547 : : }
1548 : 203885 : }
1549 : :
1550 : : /* Handle deferred command line switches. */
1551 : : static void
1552 : 209742 : handle_deferred_opts (void)
1553 : : {
1554 : : /* Avoid allocating the deps buffer if we don't need it.
1555 : : (This flag may be true without there having been -MT or -MQ
1556 : : options, but we'll still need the deps buffer.) */
1557 : 209742 : if (!deps_seen)
1558 : : return;
1559 : :
1560 : 5859 : if (mkdeps *deps = cpp_get_deps (parse_in))
1561 : 34804 : for (unsigned i = 0; i < deferred_count; i++)
1562 : : {
1563 : 28969 : struct deferred_opt *opt = &deferred_opts[i];
1564 : :
1565 : 28969 : if (opt->code == OPT_MT || opt->code == OPT_MQ)
1566 : 5828 : deps_add_target (deps, opt->arg, opt->code == OPT_MQ);
1567 : 23141 : else if (opt->code == OPT_fdeps_target_)
1568 : 42 : fdeps_add_target (deps, opt->arg, true);
1569 : : }
1570 : : }
1571 : :
1572 : : /* These settings are appropriate for GCC, but not necessarily so for
1573 : : cpplib as a library. */
1574 : : static void
1575 : 209742 : sanitize_cpp_opts (void)
1576 : : {
1577 : : /* If we don't know what style of dependencies to output, complain
1578 : : if any other dependency switches have been given. */
1579 : 209742 : if (deps_seen && cpp_opts->deps.style == DEPS_NONE)
1580 : 24 : error ("to generate dependencies you must specify either %<-M%> "
1581 : : "or %<-MM%>");
1582 : :
1583 : : /* -dM and dependencies suppress normal output; do it here so that
1584 : : the last -d[MDN] switch overrides earlier ones. */
1585 : 209742 : if (flag_dump_macros == 'M')
1586 : 80 : flag_no_output = 1;
1587 : :
1588 : : /* By default, -fdirectives-only implies -dD. This allows subsequent phases
1589 : : to perform proper macro expansion. */
1590 : 209742 : if (cpp_opts->directives_only && !cpp_opts->preprocessed && !flag_dump_macros)
1591 : 68 : flag_dump_macros = 'D';
1592 : :
1593 : : /* Disable -dD, -dN and -dI if normal output is suppressed. Allow
1594 : : -dM since at least glibc relies on -M -dM to work. */
1595 : : /* Also, flag_no_output implies flag_no_line_commands, always. */
1596 : 209742 : if (flag_no_output)
1597 : : {
1598 : 104 : if (flag_dump_macros != 'M')
1599 : 24 : flag_dump_macros = 0;
1600 : 104 : flag_dump_includes = 0;
1601 : 104 : flag_no_line_commands = 1;
1602 : : }
1603 : 209638 : else if (cpp_opts->deps.missing_files)
1604 : 1 : error ("%<-MG%> may only be used with %<-M%> or %<-MM%>");
1605 : :
1606 : 209742 : cpp_opts->unsigned_char = !flag_signed_char;
1607 : 209742 : cpp_opts->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS;
1608 : :
1609 : : /* Wlong-long is disabled by default. It is enabled by:
1610 : : [-Wpedantic | -Wtraditional] -std=[gnu|c]++98 ; or
1611 : : [-Wpedantic | -Wtraditional] -std=non-c99
1612 : :
1613 : : Either -Wlong-long or -Wno-long-long override any other settings.
1614 : : ??? These conditions should be handled in c.opt. */
1615 : 209742 : if (warn_long_long == -1)
1616 : : {
1617 : 162024 : warn_long_long = ((pedantic || warn_traditional)
1618 : 165722 : && (c_dialect_cxx () ? cxx_dialect == cxx98 : !flag_isoc99));
1619 : 165698 : cpp_opts->cpp_warn_long_long = warn_long_long;
1620 : : }
1621 : :
1622 : : /* If we're generating preprocessor output, emit current directory
1623 : : if explicitly requested or if debugging information is enabled.
1624 : : ??? Maybe we should only do it for debugging formats that
1625 : : actually output the current directory? */
1626 : 209742 : if (flag_working_directory == -1)
1627 : 208413 : flag_working_directory = (debug_info_level != DINFO_LEVEL_NONE);
1628 : :
1629 : 209742 : if (warn_implicit_fallthrough < 5)
1630 : 209738 : cpp_opts->cpp_warn_implicit_fallthrough = warn_implicit_fallthrough;
1631 : : else
1632 : 4 : cpp_opts->cpp_warn_implicit_fallthrough = 0;
1633 : :
1634 : 209742 : if (cpp_opts->directives_only)
1635 : : {
1636 : 109 : if (cpp_warn_unused_macros)
1637 : 4 : error ("%<-fdirectives-only%> is incompatible "
1638 : : "with %<-Wunused-macros%>");
1639 : 109 : if (cpp_opts->traditional)
1640 : 1 : error ("%<-fdirectives-only%> is incompatible with %<-traditional%>");
1641 : : }
1642 : 209742 : }
1643 : :
1644 : : /* Add include path with a prefix at the front of its name. */
1645 : : static void
1646 : 0 : add_prefixed_path (const char *suffix, incpath_kind chain)
1647 : : {
1648 : 0 : char *path;
1649 : 0 : const char *prefix;
1650 : 0 : size_t prefix_len, suffix_len;
1651 : :
1652 : 0 : suffix_len = strlen (suffix);
1653 : 0 : prefix = iprefix ? iprefix : cpp_GCC_INCLUDE_DIR;
1654 : 0 : prefix_len = iprefix ? strlen (iprefix) : cpp_GCC_INCLUDE_DIR_len;
1655 : :
1656 : 0 : path = (char *) xmalloc (prefix_len + suffix_len + 1);
1657 : 0 : memcpy (path, prefix, prefix_len);
1658 : 0 : memcpy (path + prefix_len, suffix, suffix_len);
1659 : 0 : path[prefix_len + suffix_len] = '\0';
1660 : :
1661 : 0 : add_path (path, chain, 0, false);
1662 : 0 : }
1663 : :
1664 : : /* Handle -D, -U, -A, -imacros, and the first -include. */
1665 : : static void
1666 : 209538 : c_finish_options (void)
1667 : : {
1668 : 209538 : if (!cpp_opts->preprocessed)
1669 : : {
1670 : 209011 : const line_map_ordinary *bltin_map
1671 : 209011 : = linemap_check_ordinary (linemap_add (line_table, LC_RENAME, 0,
1672 : : special_fname_builtin (), 0));
1673 : 209011 : cb_file_change (parse_in, bltin_map);
1674 : 209011 : linemap_line_start (line_table, 0, 1);
1675 : :
1676 : : /* Make sure all of the builtins about to be declared have
1677 : : BUILTINS_LOCATION has their location_t. */
1678 : 209011 : cpp_force_token_locations (parse_in, BUILTINS_LOCATION);
1679 : :
1680 : 209011 : cpp_init_builtins (parse_in, flag_hosted);
1681 : 209011 : c_cpp_builtins (parse_in);
1682 : :
1683 : : /* We're about to send user input to cpplib, so make it warn for
1684 : : things that we previously (when we sent it internal definitions)
1685 : : told it to not warn.
1686 : :
1687 : : C99 permits implementation-defined characters in identifiers.
1688 : : The documented meaning of -std= is to turn off extensions that
1689 : : conflict with the specified standard, and since a strictly
1690 : : conforming program cannot contain a '$', we do not condition
1691 : : their acceptance on the -std= setting. */
1692 : 209011 : cpp_opts->warn_dollars = (cpp_opts->cpp_pedantic && !cpp_opts->c99);
1693 : :
1694 : 209011 : const line_map_ordinary *cmd_map
1695 : 209011 : = linemap_check_ordinary (linemap_add (line_table, LC_RENAME, 0,
1696 : 209011 : _("<command-line>"), 0));
1697 : 209011 : cb_file_change (parse_in, cmd_map);
1698 : 209011 : linemap_line_start (line_table, 0, 1);
1699 : :
1700 : 209011 : bool fortify_seen_p = false;
1701 : 209011 : bool cxx_assert_seen_p = false;
1702 : :
1703 : : /* All command line defines must have the same location. */
1704 : 209011 : cpp_force_token_locations (parse_in, line_table->highest_line);
1705 : 388288 : for (size_t i = 0; i < deferred_count; i++)
1706 : : {
1707 : 179277 : struct deferred_opt *opt = &deferred_opts[i];
1708 : :
1709 : 179277 : if (opt->code == OPT_D)
1710 : 163281 : cpp_define (parse_in, opt->arg);
1711 : 15996 : else if (opt->code == OPT_U)
1712 : 61 : cpp_undef (parse_in, opt->arg);
1713 : 15935 : else if (opt->code == OPT_A)
1714 : : {
1715 : 10 : if (opt->arg[0] == '-')
1716 : 2 : cpp_unassert (parse_in, opt->arg + 1);
1717 : : else
1718 : 8 : cpp_assert (parse_in, opt->arg);
1719 : : }
1720 : :
1721 : 179277 : if (UNLIKELY (flag_hardened)
1722 : 83 : && (opt->code == OPT_D || opt->code == OPT_U))
1723 : : {
1724 : 83 : if (!fortify_seen_p)
1725 : 79 : fortify_seen_p
1726 : 79 : = (!strncmp (opt->arg, "_FORTIFY_SOURCE", 15)
1727 : 79 : && (opt->arg[15] == '\0' || opt->arg[15] == '='));
1728 : 83 : if (!cxx_assert_seen_p)
1729 : 83 : cxx_assert_seen_p
1730 : 83 : = (!strncmp (opt->arg, "_GLIBCXX_ASSERTIONS", 19)
1731 : 83 : && (opt->arg[19] == '\0' || opt->arg[19] == '='));
1732 : : }
1733 : : }
1734 : :
1735 : 209011 : if (flag_hardened)
1736 : : {
1737 : 91 : if (!fortify_seen_p && optimize > 0)
1738 : 71 : cpp_define_formatted (parse_in, "_FORTIFY_SOURCE=%u",
1739 : 71 : targetm.fortify_source_default_level ());
1740 : 20 : else if (optimize == 0)
1741 : 20 : warning_at (UNKNOWN_LOCATION, OPT_Whardened,
1742 : : "%<_FORTIFY_SOURCE%> is not enabled by %<-fhardened%> "
1743 : : "because optimizations are turned off");
1744 : : else
1745 : 0 : warning_at (UNKNOWN_LOCATION, OPT_Whardened,
1746 : : "%<_FORTIFY_SOURCE%> is not enabled by %<-fhardened%> "
1747 : : "because it was specified in %<-D%> or %<-U%>");
1748 : 91 : if (!cxx_assert_seen_p)
1749 : 87 : cpp_define (parse_in, "_GLIBCXX_ASSERTIONS");
1750 : : else
1751 : 4 : warning_at (UNKNOWN_LOCATION, OPT_Whardened,
1752 : : "%<_GLIBCXX_ASSERTIONS%> is not enabled by "
1753 : : "%<-fhardened%> because it was specified in %<-D%> "
1754 : : "or %<-U%>");
1755 : : }
1756 : :
1757 : 209011 : cpp_stop_forcing_token_locations (parse_in);
1758 : : }
1759 : 527 : else if (cpp_opts->directives_only)
1760 : 41 : cpp_init_special_builtins (parse_in);
1761 : :
1762 : : /* Start the main input file, if the debug writer wants it. */
1763 : 209538 : if (debug_hooks->start_end_main_source_file
1764 : 42474 : && !flag_preprocess_only)
1765 : 40191 : (*debug_hooks->start_source_file) (0, this_input_filename);
1766 : :
1767 : 209538 : if (!cpp_opts->preprocessed)
1768 : : /* Handle -imacros after -D and -U. */
1769 : 388288 : for (size_t i = 0; i < deferred_count; i++)
1770 : : {
1771 : 179277 : struct deferred_opt *opt = &deferred_opts[i];
1772 : :
1773 : 179277 : if (opt->code == OPT_imacros
1774 : 179277 : && cpp_push_include (parse_in, opt->arg))
1775 : : {
1776 : : /* Disable push_command_line_include callback for now. */
1777 : 8 : include_cursor = deferred_count + 1;
1778 : 8 : cpp_scan_nooutput (parse_in);
1779 : : }
1780 : : }
1781 : :
1782 : 209538 : include_cursor = 0;
1783 : 209538 : push_command_line_include ();
1784 : 209538 : }
1785 : :
1786 : : /* Give CPP the next file given by -include, if any. */
1787 : : static void
1788 : 739323 : push_command_line_include (void)
1789 : : {
1790 : : /* This can happen if disabled by -imacros for example.
1791 : : Punt so that we don't set "<command-line>" as the filename for
1792 : : the header. */
1793 : 739323 : if (include_cursor > deferred_count)
1794 : : return;
1795 : :
1796 : 428511 : if (!done_preinclude)
1797 : : {
1798 : 209538 : done_preinclude = true;
1799 : 209538 : if (flag_hosted && std_inc && !cpp_opts->preprocessed)
1800 : : {
1801 : 208929 : const char *preinc = targetcm.c_preinclude ();
1802 : 208929 : if (preinc && cpp_push_default_include (parse_in, preinc))
1803 : : return;
1804 : : }
1805 : : }
1806 : :
1807 : 219582 : pch_cpp_save_state ();
1808 : :
1809 : 608448 : while (include_cursor < deferred_count)
1810 : : {
1811 : 179329 : struct deferred_opt *opt = &deferred_opts[include_cursor++];
1812 : :
1813 : 358605 : if (!cpp_opts->preprocessed && opt->code == OPT_include
1814 : 189377 : && cpp_push_include (parse_in, opt->arg))
1815 : : return;
1816 : : }
1817 : :
1818 : 209537 : if (include_cursor == deferred_count)
1819 : : {
1820 : 209537 : include_cursor++;
1821 : : /* -Wunused-macros should only warn about macros defined hereafter. */
1822 : 209537 : cpp_opts->warn_unused_macros = cpp_warn_unused_macros;
1823 : : /* Restore the line map back to the main file. */
1824 : 209537 : if (!cpp_opts->preprocessed)
1825 : : {
1826 : 209010 : cpp_change_file (parse_in, LC_RENAME, this_input_filename);
1827 : 209010 : if (lang_hooks.preprocess_main_file)
1828 : : /* We're starting the main file. Inform the FE of that. */
1829 : 96297 : lang_hooks.preprocess_main_file
1830 : 96297 : (parse_in, line_table, LINEMAPS_LAST_ORDINARY_MAP (line_table));
1831 : : }
1832 : :
1833 : : /* Set this here so the client can change the option if it wishes,
1834 : : and after stacking the main file so we don't trace the main file. */
1835 : 209537 : line_table->trace_includes = cpp_opts->print_include_names;
1836 : : }
1837 : : }
1838 : :
1839 : : /* File change callback. Has to handle -include files. */
1840 : : static void
1841 : 19632436 : cb_file_change (cpp_reader *reader, const line_map_ordinary *new_map)
1842 : : {
1843 : 19632436 : if (flag_preprocess_only)
1844 : 149780 : pp_file_change (new_map);
1845 : : else
1846 : 19482656 : fe_file_change (new_map);
1847 : :
1848 : 19423285 : if (new_map && cpp_opts->preprocessed
1849 : 37810 : && lang_hooks.preprocess_main_file && MAIN_FILE_P (new_map)
1850 : 19634985 : && ORDINARY_MAP_STARTING_LINE_NUMBER (new_map))
1851 : : /* We're starting the main file. Inform the FE of that. */
1852 : 450 : lang_hooks.preprocess_main_file (reader, line_table, new_map);
1853 : :
1854 : 19632436 : if (new_map
1855 : 19423285 : && (new_map->reason == LC_ENTER || new_map->reason == LC_RENAME))
1856 : : {
1857 : : /* Signal to plugins that a file is included. This could happen
1858 : : several times with the same file path, e.g. because of
1859 : : several '#include' or '#line' directives... */
1860 : 10133393 : invoke_plugin_callbacks
1861 : 10133393 : (PLUGIN_INCLUDE_FILE,
1862 : 10133393 : const_cast<char*> (ORDINARY_MAP_FILE_NAME (new_map)));
1863 : : }
1864 : :
1865 : 19423285 : if (new_map == 0 || (new_map->reason == LC_LEAVE && MAIN_FILE_P (new_map)))
1866 : : {
1867 : 529785 : pch_cpp_save_state ();
1868 : 529785 : push_command_line_include ();
1869 : : }
1870 : 19632435 : }
1871 : :
1872 : : void
1873 : 53 : cb_dir_change (cpp_reader * ARG_UNUSED (pfile), const char *dir)
1874 : : {
1875 : 53 : if (!set_src_pwd (dir))
1876 : 0 : warning (0, "too late for # directive to set debug directory");
1877 : 53 : }
1878 : :
1879 : : /* Set the C 89 standard (with 1994 amendments if C94, without GNU
1880 : : extensions if ISO). There is no concept of gnu94. */
1881 : : static void
1882 : 6943 : set_std_c89 (int c94, int iso)
1883 : : {
1884 : 9895 : cpp_set_lang (parse_in, c94 ? CLK_STDC94 : iso ? CLK_STDC89 : CLK_GNUC89);
1885 : 6943 : flag_iso = iso;
1886 : 6943 : flag_no_asm = iso;
1887 : 6943 : flag_no_gnu_keywords = iso;
1888 : 6943 : flag_no_nonansi_builtin = iso;
1889 : 6943 : flag_isoc94 = c94;
1890 : 6943 : flag_isoc99 = 0;
1891 : 6943 : flag_isoc11 = 0;
1892 : 6943 : flag_isoc23 = 0;
1893 : 6943 : flag_isoc2y = 0;
1894 : 6943 : lang_hooks.name = "GNU C89";
1895 : 6943 : }
1896 : :
1897 : : /* Set the C 99 standard (without GNU extensions if ISO). */
1898 : : static void
1899 : 1178 : set_std_c99 (int iso)
1900 : : {
1901 : 1784 : cpp_set_lang (parse_in, iso ? CLK_STDC99 : CLK_GNUC99);
1902 : 1178 : flag_no_asm = iso;
1903 : 1178 : flag_no_nonansi_builtin = iso;
1904 : 1178 : flag_iso = iso;
1905 : 1178 : flag_isoc2y = 0;
1906 : 1178 : flag_isoc23 = 0;
1907 : 1178 : flag_isoc11 = 0;
1908 : 1178 : flag_isoc99 = 1;
1909 : 1178 : flag_isoc94 = 1;
1910 : 1178 : lang_hooks.name = "GNU C99";
1911 : 1178 : }
1912 : :
1913 : : /* Set the C 11 standard (without GNU extensions if ISO). */
1914 : : static void
1915 : 4202 : set_std_c11 (int iso)
1916 : : {
1917 : 7892 : cpp_set_lang (parse_in, iso ? CLK_STDC11 : CLK_GNUC11);
1918 : 4202 : flag_no_asm = iso;
1919 : 4202 : flag_no_nonansi_builtin = iso;
1920 : 4202 : flag_iso = iso;
1921 : 4202 : flag_isoc2y = 0;
1922 : 4202 : flag_isoc23 = 0;
1923 : 4202 : flag_isoc11 = 1;
1924 : 4202 : flag_isoc99 = 1;
1925 : 4202 : flag_isoc94 = 1;
1926 : 4202 : lang_hooks.name = "GNU C11";
1927 : 4202 : }
1928 : :
1929 : : /* Set the C 17 standard (without GNU extensions if ISO). */
1930 : : static void
1931 : 827 : set_std_c17 (int iso)
1932 : : {
1933 : 1612 : cpp_set_lang (parse_in, iso ? CLK_STDC17 : CLK_GNUC17);
1934 : 827 : flag_no_asm = iso;
1935 : 827 : flag_no_nonansi_builtin = iso;
1936 : 827 : flag_iso = iso;
1937 : 827 : flag_isoc2y = 0;
1938 : 827 : flag_isoc23 = 0;
1939 : 827 : flag_isoc11 = 1;
1940 : 827 : flag_isoc99 = 1;
1941 : 827 : flag_isoc94 = 1;
1942 : 827 : lang_hooks.name = "GNU C17";
1943 : 827 : }
1944 : :
1945 : : /* Set the C 23 standard (without GNU extensions if ISO). */
1946 : : static void
1947 : 114339 : set_std_c23 (int iso)
1948 : : {
1949 : 227829 : cpp_set_lang (parse_in, iso ? CLK_STDC23 : CLK_GNUC23);
1950 : 114339 : flag_no_asm = iso;
1951 : 114339 : flag_no_nonansi_builtin = iso;
1952 : 114339 : flag_iso = iso;
1953 : 114339 : flag_isoc2y = 0;
1954 : 114339 : flag_isoc23 = 1;
1955 : 114339 : flag_isoc11 = 1;
1956 : 114339 : flag_isoc99 = 1;
1957 : 114339 : flag_isoc94 = 1;
1958 : 114339 : lang_hooks.name = "GNU C23";
1959 : 114339 : }
1960 : :
1961 : : /* Set the C 2Y standard (without GNU extensions if ISO). */
1962 : : static void
1963 : 180 : set_std_c2y (int iso)
1964 : : {
1965 : 188 : cpp_set_lang (parse_in, iso ? CLK_STDC2Y : CLK_GNUC2Y);
1966 : 180 : flag_no_asm = iso;
1967 : 180 : flag_no_nonansi_builtin = iso;
1968 : 180 : flag_iso = iso;
1969 : 180 : flag_isoc2y = 1;
1970 : 180 : flag_isoc23 = 1;
1971 : 180 : flag_isoc11 = 1;
1972 : 180 : flag_isoc99 = 1;
1973 : 180 : flag_isoc94 = 1;
1974 : 180 : lang_hooks.name = "GNU C2Y";
1975 : 180 : }
1976 : :
1977 : :
1978 : : /* Set the C++ 98 standard (without GNU extensions if ISO). */
1979 : : static void
1980 : 14069 : set_std_cxx98 (int iso)
1981 : : {
1982 : 19355 : cpp_set_lang (parse_in, iso ? CLK_CXX98 : CLK_GNUCXX);
1983 : 14069 : flag_no_gnu_keywords = iso;
1984 : 14069 : flag_no_nonansi_builtin = iso;
1985 : 14069 : flag_iso = iso;
1986 : 14069 : flag_isoc94 = 0;
1987 : 14069 : flag_isoc99 = 0;
1988 : 14069 : cxx_dialect = cxx98;
1989 : 14069 : lang_hooks.name = "GNU C++98";
1990 : 14069 : }
1991 : :
1992 : : /* Set the C++ 2011 standard (without GNU extensions if ISO). */
1993 : : static void
1994 : 5606 : set_std_cxx11 (int iso)
1995 : : {
1996 : 7032 : cpp_set_lang (parse_in, iso ? CLK_CXX11 : CLK_GNUCXX11);
1997 : 5606 : flag_no_gnu_keywords = iso;
1998 : 5606 : flag_no_nonansi_builtin = iso;
1999 : 5606 : flag_iso = iso;
2000 : : /* C++11 includes the C99 standard library. */
2001 : 5606 : flag_isoc94 = 1;
2002 : 5606 : flag_isoc99 = 1;
2003 : 5606 : cxx_dialect = cxx11;
2004 : 5606 : lang_hooks.name = "GNU C++11";
2005 : 5606 : }
2006 : :
2007 : : /* Set the C++ 2014 standard (without GNU extensions if ISO). */
2008 : : static void
2009 : 1280 : set_std_cxx14 (int iso)
2010 : : {
2011 : 1549 : cpp_set_lang (parse_in, iso ? CLK_CXX14 : CLK_GNUCXX14);
2012 : 1280 : flag_no_gnu_keywords = iso;
2013 : 1280 : flag_no_nonansi_builtin = iso;
2014 : 1280 : flag_iso = iso;
2015 : : /* C++14 includes the C99 standard library. */
2016 : 1280 : flag_isoc94 = 1;
2017 : 1280 : flag_isoc99 = 1;
2018 : 1280 : cxx_dialect = cxx14;
2019 : 1280 : lang_hooks.name = "GNU C++14";
2020 : 1280 : }
2021 : :
2022 : : /* Set the C++ 2017 standard (without GNU extensions if ISO). */
2023 : : static void
2024 : 127108 : set_std_cxx17 (int iso)
2025 : : {
2026 : 238433 : cpp_set_lang (parse_in, iso ? CLK_CXX17 : CLK_GNUCXX17);
2027 : 127108 : flag_no_gnu_keywords = iso;
2028 : 127108 : flag_no_nonansi_builtin = iso;
2029 : 127108 : flag_iso = iso;
2030 : : /* C++17 includes the C11 standard library. */
2031 : 127108 : flag_isoc94 = 1;
2032 : 127108 : flag_isoc99 = 1;
2033 : 127108 : flag_isoc11 = 1;
2034 : 127108 : cxx_dialect = cxx17;
2035 : 127108 : lang_hooks.name = "GNU C++17";
2036 : 127108 : }
2037 : :
2038 : : /* Set the C++ 2020 standard (without GNU extensions if ISO). */
2039 : : static void
2040 : 5029 : set_std_cxx20 (int iso)
2041 : : {
2042 : 6445 : cpp_set_lang (parse_in, iso ? CLK_CXX20 : CLK_GNUCXX20);
2043 : 5029 : flag_no_gnu_keywords = iso;
2044 : 5029 : flag_no_nonansi_builtin = iso;
2045 : 5029 : flag_iso = iso;
2046 : : /* C++20 includes the C11 standard library. */
2047 : 5029 : flag_isoc94 = 1;
2048 : 5029 : flag_isoc99 = 1;
2049 : 5029 : flag_isoc11 = 1;
2050 : 5029 : cxx_dialect = cxx20;
2051 : 5029 : lang_hooks.name = "GNU C++20";
2052 : 5029 : }
2053 : :
2054 : : /* Set the C++ 2023 standard (without GNU extensions if ISO). */
2055 : : static void
2056 : 1942 : set_std_cxx23 (int iso)
2057 : : {
2058 : 2452 : cpp_set_lang (parse_in, iso ? CLK_CXX23 : CLK_GNUCXX23);
2059 : 1942 : flag_no_gnu_keywords = iso;
2060 : 1942 : flag_no_nonansi_builtin = iso;
2061 : 1942 : flag_iso = iso;
2062 : : /* C++23 includes the C11 standard library. */
2063 : 1942 : flag_isoc94 = 1;
2064 : 1942 : flag_isoc99 = 1;
2065 : 1942 : flag_isoc11 = 1;
2066 : 1942 : cxx_dialect = cxx23;
2067 : 1942 : lang_hooks.name = "GNU C++23";
2068 : 1942 : }
2069 : :
2070 : : /* Set the C++ 2026 standard (without GNU extensions if ISO). */
2071 : : static void
2072 : 23651 : set_std_cxx26 (int iso)
2073 : : {
2074 : 31396 : cpp_set_lang (parse_in, iso ? CLK_CXX26 : CLK_GNUCXX26);
2075 : 23651 : flag_no_gnu_keywords = iso;
2076 : 23651 : flag_no_nonansi_builtin = iso;
2077 : 23651 : flag_iso = iso;
2078 : : /* C++26 includes the C11 standard library. */
2079 : 23651 : flag_isoc94 = 1;
2080 : 23651 : flag_isoc99 = 1;
2081 : 23651 : flag_isoc11 = 1;
2082 : 23651 : cxx_dialect = cxx26;
2083 : 23651 : lang_hooks.name = "GNU C++26";
2084 : 23651 : }
2085 : :
2086 : : /* Args to -d specify what to dump. Silently ignore
2087 : : unrecognized options; they may be aimed at toplev.cc. */
2088 : : static void
2089 : 1615 : handle_OPT_d (const char *arg)
2090 : : {
2091 : 1615 : char c;
2092 : :
2093 : 3230 : while ((c = *arg++) != '\0')
2094 : 1615 : switch (c)
2095 : : {
2096 : 778 : case 'M': /* Dump macros only. */
2097 : 778 : case 'N': /* Dump names. */
2098 : 778 : case 'D': /* Dump definitions. */
2099 : 778 : case 'U': /* Dump used macros. */
2100 : 778 : flag_dump_macros = c;
2101 : 778 : break;
2102 : :
2103 : 2 : case 'I':
2104 : 2 : flag_dump_includes = 1;
2105 : 2 : break;
2106 : : }
2107 : 1615 : }
|