LCOV - code coverage report
Current view: top level - gcc/c-family - c-opts.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 89.8 % 1070 961
Test Date: 2026-12-05 16:10:02 Functions: 94.7 % 38 36
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* C/ObjC/C++ command line option handling.
       2              :    Copyright (C) 2002-2026 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_cxx29 (int);
     122              : static void set_std_c89 (int, int);
     123              : static void set_std_c99 (int);
     124              : static void set_std_c11 (int);
     125              : static void set_std_c17 (int);
     126              : static void set_std_c23 (int);
     127              : static void set_std_c2y (int);
     128              : static void check_deps_environment_vars (void);
     129              : static void handle_deferred_opts (void);
     130              : static void sanitize_cpp_opts (void);
     131              : static void add_prefixed_path (const char *, incpath_kind);
     132              : static void push_command_line_include (void);
     133              : static void cb_file_change (cpp_reader *, const line_map_ordinary *);
     134              : static void cb_dir_change (cpp_reader *, const char *);
     135              : static void c_finish_options (void);
     136              : 
     137              : #ifndef STDC_0_IN_SYSTEM_HEADERS
     138              : #define STDC_0_IN_SYSTEM_HEADERS 0
     139              : #endif
     140              : 
     141              : /* Holds switches parsed by c_common_handle_option (), but whose
     142              :    handling is deferred to c_common_post_options ().  */
     143              : static void defer_opt (enum opt_code, const char *);
     144              : static struct deferred_opt
     145              : {
     146              :   enum opt_code code;
     147              :   const char *arg;
     148              : } *deferred_opts;
     149              : 
     150              : 
     151              : extern const unsigned int
     152              : c_family_lang_mask = (CL_C | CL_CXX | CL_ObjC | CL_ObjCXX);
     153              : 
     154              : /* Defer option CODE with argument ARG.  */
     155              : static void
     156       197664 : defer_opt (enum opt_code code, const char *arg)
     157              : {
     158       197664 :   deferred_opts[deferred_count].code = code;
     159       197664 :   deferred_opts[deferred_count].arg = arg;
     160       197664 :   deferred_count++;
     161            0 : }
     162              : 
     163              : /* Return language mask for option parsing.  */
     164              : unsigned int
     165      7193184 : c_common_option_lang_mask (void)
     166              : {
     167      7193184 :   static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
     168              : 
     169      7193184 :   return lang_flags[c_language];
     170              : }
     171              : 
     172              : /* Diagnostic finalizer for C/C++/Objective-C/Objective-C++.  */
     173              : static void
     174       355981 : c_diagnostic_text_finalizer (diagnostics::text_sink &text_output,
     175              :                              const diagnostics::diagnostic_info *diagnostic,
     176              :                              enum diagnostics::kind)
     177              : {
     178       355981 :   pretty_printer *const pp = text_output.get_printer ();
     179       355981 :   char *saved_prefix = pp_take_prefix (pp);
     180       355981 :   pp_set_prefix (pp, text_output.build_indent_prefix (false));
     181       355981 :   pp_newline (pp);
     182       355981 :   diagnostic_show_locus (&text_output.get_context (),
     183       355981 :                          text_output.get_source_printing_options (),
     184       355981 :                          diagnostic->m_richloc, diagnostic->m_kind, pp);
     185              :   /* By default print macro expansion contexts in the diagnostic
     186              :      finalizer -- for tokens resulting from macro expansion.  */
     187       355981 :   diagnostics::virt_loc_aware_text_finalizer (text_output, diagnostic);
     188       355981 :   pp_set_prefix (pp, saved_prefix);
     189       355981 :   pp_flush (pp);
     190       355981 : }
     191              : 
     192              : /* Common default settings for diagnostics.  */
     193              : void
     194       219016 : c_common_diagnostics_set_defaults (diagnostics::context *context)
     195              : {
     196       219016 :   diagnostics::text_finalizer (context) = c_diagnostic_text_finalizer;
     197       219016 :   context->set_permissive_option (OPT_fpermissive);
     198       219016 : }
     199              : 
     200              : /* Input charset configuration for diagnostics.  */
     201              : static const char *
     202        66826 : c_common_input_charset_cb (const char * /*filename*/)
     203              : {
     204        66826 :   const char *cs = cpp_opts->input_charset;
     205        66826 :   return cpp_input_conversion_is_trivial (cs) ? nullptr : cs;
     206              : }
     207              : 
     208              : /* Whether options from all C-family languages should be accepted
     209              :    quietly.  */
     210              : static bool accept_all_c_family_options = false;
     211              : 
     212              : /* Return whether to complain about a wrong-language option.  */
     213              : bool
     214          389 : c_common_complain_wrong_lang_p (const struct cl_option *option)
     215              : {
     216          389 :   if (accept_all_c_family_options
     217            6 :       && (option->flags & c_family_lang_mask))
     218            6 :     return false;
     219              : 
     220              :   return true;
     221              : }
     222              : 
     223              : /* Initialize options structure OPTS.  */
     224              : void
     225     50385190 : c_common_init_options_struct (struct gcc_options *opts)
     226              : {
     227     50385190 :   opts->x_flag_exceptions = c_dialect_cxx ();
     228     50385190 :   opts->x_warn_pointer_arith = c_dialect_cxx ();
     229     50385190 :   opts->x_warn_write_strings = c_dialect_cxx ();
     230     50385190 :   opts->x_flag_warn_unused_result = true;
     231              : 
     232              :   /* By default, C99-like requirements for complex multiply and divide.  */
     233     50385190 :   opts->x_flag_complex_method = 2;
     234     50385190 : }
     235              : 
     236              : /* Common initialization before calling option handlers.  */
     237              : void
     238       219016 : c_common_init_options (unsigned int decoded_options_count,
     239              :                        struct cl_decoded_option *decoded_options)
     240              : {
     241       219016 :   unsigned int i;
     242       219016 :   struct cpp_callbacks *cb;
     243              : 
     244       219016 :   g_string_concat_db
     245       219016 :     = new (ggc_alloc <string_concat_db> ()) string_concat_db ();
     246              : 
     247       335266 :   parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX : CLK_GNUC89,
     248              :                                 ident_hash, line_table, ident_hash_extra);
     249       219016 :   cb = cpp_get_callbacks (parse_in);
     250       219016 :   cb->diagnostic = c_cpp_diagnostic;
     251              : 
     252       219016 :   cpp_opts = cpp_get_options (parse_in);
     253       219016 :   cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
     254       219016 :   cpp_opts->objc = c_dialect_objc ();
     255       219016 :   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       219016 :   cpp_opts->warn_dollars = 0;
     260              : 
     261       219016 :   deferred_opts = XNEWVEC (struct deferred_opt, decoded_options_count);
     262              : 
     263       219016 :   if (c_language == clk_c)
     264              :     {
     265              :       /* The default for C is gnu23.  */
     266       116250 :       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      2973495 :       for (i = 1; i < decoded_options_count; i++)
     271      2741976 :         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++20 if not specified on the command line.  */
     279       219016 :   if (c_dialect_cxx ())
     280       102766 :     set_std_cxx20 (/*ISO*/false);
     281              : 
     282       219016 :   global_dc->get_source_printing_options ().colorize_source_p = true;
     283       219016 : }
     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      3467361 : 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      3467361 :   const struct cl_option *option = &cl_options[scode];
     294      3467361 :   enum opt_code code = (enum opt_code) scode;
     295      3467361 :   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      3467361 :   bool preprocessing_asm_p = (cpp_get_options (parse_in)->lang == CLK_ASM);
     300              : 
     301      3467361 :   switch (code)
     302              :     {
     303      1485071 :     default:
     304      1485071 :       if (cl_options[code].flags & c_family_lang_mask)
     305              :         {
     306      1485071 :           if ((option->flags & CL_TARGET)
     307      1485071 :               && ! targetcm.handle_c_option (scode, arg, value))
     308              :             result = false;
     309              :           break;
     310              :         }
     311              :       result = false;
     312              :       break;
     313              : 
     314          470 :     case OPT__output_pch:
     315          470 :       pch_file = arg;
     316          470 :       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       181966 :     case OPT_D:
     332       181966 :       defer_opt (code, arg);
     333       181966 :       break;
     334              : 
     335           25 :     case OPT_H:
     336           25 :       cpp_opts->print_include_names = 1;
     337           25 :       break;
     338              : 
     339              :     case OPT_F:
     340              :       TARGET_OPTF (xstrdup (arg));
     341              :       break;
     342              : 
     343       580201 :     case OPT_I:
     344       580201 :       if (strcmp (arg, "-"))
     345       580201 :         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           31 :     case OPT_M:
     358           31 :     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           31 :       cpp_opts->deps.style = (code == OPT_M ? DEPS_SYSTEM : DEPS_USER);
     364           31 :       flag_no_output = 1;
     365           31 :       break;
     366              : 
     367         5896 :     case OPT_MD:
     368         5896 :     case OPT_MMD:
     369         5896 :       cpp_opts->deps.style = (code == OPT_MD ? DEPS_SYSTEM : DEPS_USER);
     370         5896 :       cpp_opts->deps.need_preprocessor_output = true;
     371         5896 :       deps_file = arg;
     372         5896 :       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         5843 :     case OPT_MF:
     393         5843 :       deps_seen = true;
     394         5843 :       deps_file = arg;
     395         5843 :       break;
     396              : 
     397            6 :     case OPT_MG:
     398            6 :       deps_seen = true;
     399            6 :       cpp_opts->deps.missing_files = true;
     400            6 :       break;
     401              : 
     402         5825 :     case OPT_MP:
     403         5825 :       deps_seen = true;
     404         5825 :       cpp_opts->deps.phony_targets = true;
     405         5825 :       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         5892 :     case OPT_MQ:
     420         5892 :     case OPT_MT:
     421         5892 :       deps_seen = true;
     422         5892 :       defer_opt (code, arg);
     423         5892 :       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        11067 :     case OPT_Wall:
     434              :       /* ??? Don't add new options here. Use LangEnabledBy in c.opt.  */
     435              : 
     436        11067 :       cpp_opts->warn_num_sign_change = value;
     437        11067 :       break;
     438              : 
     439        11157 :     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        11157 :       warn_unknown_pragmas = value * 2;
     444        11157 :       break;
     445              : 
     446         4019 :     case OPT_ansi:
     447         4019 :       if (!c_dialect_cxx ())
     448         3873 :         set_std_c89 (false, true);
     449              :       else
     450          146 :         set_std_cxx98 (true);
     451              :       break;
     452              : 
     453         1638 :     case OPT_d:
     454         1638 :       handle_OPT_d (arg);
     455         1638 :       break;
     456              : 
     457        12737 :     case OPT_Wabi_:
     458        12737 :       warn_abi = true;
     459        12737 :       if (value == 1)
     460              :         {
     461            0 :           warning (0, "%<-Wabi=1%> is not supported, using =2");
     462            0 :           value = 2;
     463              :         }
     464        12737 :       warn_abi_version = value;
     465        12737 :       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         1102 :     case OPT_fdirectives_only:
     488         1102 :       cpp_opts->directives_only = value;
     489         1102 :       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          635 :     case OPT_ffreestanding:
     500          635 :       value = !value;
     501              :       /* Fall through.  */
     502          643 :     case OPT_fhosted:
     503          643 :       flag_hosted = value;
     504          643 :       flag_no_builtin = !value;
     505          643 :       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          511 :     case OPT_fpch_preprocess:
     528          511 :       flag_pch_preprocess = value;
     529          511 :       break;
     530              : 
     531         1152 :     case OPT_fpermissive:
     532         1152 :       flag_permissive = value;
     533         1152 :       global_dc->m_permissive = value;
     534         1152 :       break;
     535              : 
     536          563 :     case OPT_fpreprocessed:
     537          563 :       cpp_opts->preprocessed = value;
     538          563 :       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          136 :     case OPT_fexec_charset_:
     557          136 :       cpp_opts->narrow_charset = arg;
     558          136 :       break;
     559              : 
     560            2 :     case OPT_fwide_exec_charset_:
     561            2 :       cpp_opts->wide_charset = arg;
     562            2 :       break;
     563              : 
     564          106 :     case OPT_finput_charset_:
     565          106 :       cpp_opts->input_charset = arg;
     566          106 :       cpp_opts->cpp_input_charset_explicit = 1;
     567          106 :       break;
     568              : 
     569           29 :     case OPT_ftemplate_depth_:
     570           29 :       max_tinst_depth = value;
     571           29 :       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         9672 :     case OPT_imacros:
     599         9672 :     case OPT_include:
     600         9672 :       defer_opt (code, arg);
     601         9672 :       break;
     602              : 
     603         5345 :     case OPT_imultilib:
     604         5345 :       imultilib = arg;
     605         5345 :       break;
     606              : 
     607       215645 :     case OPT_iprefix:
     608       215645 :       iprefix = arg;
     609       215645 :       break;
     610              : 
     611         2918 :     case OPT_iquote:
     612         2918 :       add_path (xstrdup (arg), INC_QUOTE, 0, true);
     613         2918 :       break;
     614              : 
     615            0 :     case OPT_isysroot:
     616            0 :       sysroot = arg;
     617            0 :       break;
     618              : 
     619       481765 :     case OPT_isystem:
     620       481765 :       add_path (xstrdup (arg), INC_SYSTEM, 0, true);
     621       481765 :       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           94 :     case OPT__embed_dir_:
     632           94 :       add_path (xstrdup (arg), INC_EMBED, 0, true);
     633           94 :       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       114798 :     case OPT_nostdinc__:
     645       114798 :       std_cxx_inc = false;
     646       114798 :       break;
     647              : 
     648       218307 :     case OPT_o:
     649       218307 :       if (!out_fname)
     650       218307 :         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        14296 :     case OPT_std_c__98:
     664        14296 :     case OPT_std_gnu__98:
     665        14296 :       if (!preprocessing_asm_p)
     666        14296 :         set_std_cxx98 (code == OPT_std_c__98 /* ISO */);
     667              :       break;
     668              : 
     669         5806 :     case OPT_std_c__11:
     670         5806 :     case OPT_std_gnu__11:
     671         5806 :       if (!preprocessing_asm_p)
     672         5806 :         set_std_cxx11 (code == OPT_std_c__11 /* ISO */);
     673              :       break;
     674              : 
     675         1348 :     case OPT_std_c__14:
     676         1348 :     case OPT_std_gnu__14:
     677         1348 :       if (!preprocessing_asm_p)
     678         1348 :         set_std_cxx14 (code == OPT_std_c__14 /* ISO */);
     679              :       break;
     680              : 
     681         4275 :     case OPT_std_c__17:
     682         4275 :     case OPT_std_gnu__17:
     683         4275 :       if (!preprocessing_asm_p)
     684         4275 :         set_std_cxx17 (code == OPT_std_c__17 /* ISO */);
     685              :       break;
     686              : 
     687        32671 :     case OPT_std_c__20:
     688        32671 :     case OPT_std_gnu__20:
     689        32671 :       if (!preprocessing_asm_p)
     690        32671 :         set_std_cxx20 (code == OPT_std_c__20 /* ISO */);
     691              :       break;
     692              : 
     693         2225 :     case OPT_std_c__23:
     694         2225 :     case OPT_std_gnu__23:
     695         2225 :       if (!preprocessing_asm_p)
     696         2225 :         set_std_cxx23 (code == OPT_std_c__23 /* ISO */);
     697              :       break;
     698              : 
     699         1464 :     case OPT_std_c__26:
     700         1464 :     case OPT_std_gnu__26:
     701         1464 :       if (!preprocessing_asm_p)
     702         1464 :         set_std_cxx26 (code == OPT_std_c__26 /* ISO */);
     703              :       break;
     704              : 
     705        24421 :     case OPT_std_c__29:
     706        24421 :     case OPT_std_gnu__29:
     707        24421 :       if (!preprocessing_asm_p)
     708        24421 :         set_std_cxx29 (code == OPT_std_c__29 /* ISO */);
     709              :       break;
     710              : 
     711          191 :     case OPT_std_c90:
     712          191 :     case OPT_std_iso9899_199409:
     713          191 :       if (!preprocessing_asm_p)
     714          191 :         set_std_c89 (code == OPT_std_iso9899_199409 /* c94 */, true /* ISO */);
     715              :       break;
     716              : 
     717         2953 :     case OPT_std_gnu90:
     718         2953 :       if (!preprocessing_asm_p)
     719         2953 :         set_std_c89 (false /* c94 */, false /* ISO */);
     720              :       break;
     721              : 
     722          589 :     case OPT_std_c99:
     723          589 :       if (!preprocessing_asm_p)
     724          588 :         set_std_c99 (true /* ISO */);
     725              :       break;
     726              : 
     727          641 :     case OPT_std_gnu99:
     728          641 :       if (!preprocessing_asm_p)
     729          641 :         set_std_c99 (false /* ISO */);
     730              :       break;
     731              : 
     732          515 :     case OPT_std_c11:
     733          515 :       if (!preprocessing_asm_p)
     734          515 :         set_std_c11 (true /* ISO */);
     735              :       break;
     736              : 
     737         3725 :     case OPT_std_gnu11:
     738         3725 :       if (!preprocessing_asm_p)
     739         3725 :         set_std_c11 (false /* ISO */);
     740              :       break;
     741              : 
     742           43 :     case OPT_std_c17:
     743           43 :       if (!preprocessing_asm_p)
     744           43 :         set_std_c17 (true /* ISO */);
     745              :       break;
     746              : 
     747          778 :     case OPT_std_gnu17:
     748          778 :       if (!preprocessing_asm_p)
     749          778 :         set_std_c17 (false /* ISO */);
     750              :       break;
     751              : 
     752          993 :     case OPT_std_c23:
     753          993 :       if (!preprocessing_asm_p)
     754          993 :         set_std_c23 (true /* ISO */);
     755              :       break;
     756              : 
     757          216 :     case OPT_std_gnu23:
     758          216 :       if (!preprocessing_asm_p)
     759          216 :         set_std_c23 (false /* ISO */);
     760              :       break;
     761              : 
     762          208 :     case OPT_std_c2y:
     763          208 :       if (!preprocessing_asm_p)
     764          208 :         set_std_c2y (true /* ISO */);
     765              :       break;
     766              : 
     767           12 :     case OPT_std_gnu2y:
     768           12 :       if (!preprocessing_asm_p)
     769           12 :         set_std_c2y (false /* ISO */);
     770              :       break;
     771              : 
     772           21 :     case OPT_trigraphs:
     773           21 :       cpp_opts->trigraphs = 1;
     774           21 :       break;
     775              : 
     776         2927 :     case OPT_traditional_cpp:
     777         2927 :       cpp_opts->traditional = 1;
     778         2927 :       break;
     779              : 
     780            0 :     case OPT_fsearch_include_path:
     781            0 :       cpp_opts->main_search = CMS_user;
     782            0 :       break;
     783              : 
     784            6 :     case OPT_fsearch_include_path_:
     785            6 :       if (!strcmp (arg, "user"))
     786            0 :         cpp_opts->main_search = CMS_user;
     787            6 :       else if (!strcmp (arg, "system"))
     788            6 :         cpp_opts->main_search = CMS_system;
     789              :       else
     790            0 :         error ("invalid argument %qs to %<-fsearch-include-path%>", arg);
     791              :       break;
     792              : 
     793          114 :     case OPT_v:
     794          114 :       verbose = true;
     795          114 :       break;
     796              :     }
     797              : 
     798      3467361 :   switch (c_language)
     799              :     {
     800      1467165 :     case clk_c:
     801      1467165 :       C_handle_option_auto (&global_options, &global_options_set,
     802              :                             scode, arg, value,
     803              :                             c_family_lang_mask, kind,
     804              :                             loc, handlers, global_dc);
     805      1467165 :       break;
     806              : 
     807            0 :     case clk_objc:
     808            0 :       ObjC_handle_option_auto (&global_options, &global_options_set,
     809              :                                scode, arg, value,
     810              :                                c_family_lang_mask, kind,
     811              :                                loc, handlers, global_dc);
     812            0 :       break;
     813              : 
     814      2000196 :     case clk_cxx:
     815      2000196 :       CXX_handle_option_auto (&global_options, &global_options_set,
     816              :                               scode, arg, value,
     817              :                               c_family_lang_mask, kind,
     818              :                               loc, handlers, global_dc);
     819      2000196 :       break;
     820              : 
     821            0 :     case clk_objcxx:
     822            0 :       ObjCXX_handle_option_auto (&global_options, &global_options_set,
     823              :                                  scode, arg, value,
     824              :                                  c_family_lang_mask, kind,
     825              :                                  loc, handlers, global_dc);
     826            0 :       break;
     827              : 
     828            0 :     default:
     829            0 :       gcc_unreachable ();
     830              :     }
     831              : 
     832      3467361 :   cpp_handle_option_auto (&global_options, scode, cpp_opts);
     833      3467361 :   return result;
     834              : }
     835              : 
     836              : /* Default implementation of TARGET_HANDLE_C_OPTION.  */
     837              : 
     838              : bool
     839            0 : default_handle_c_option (size_t code ATTRIBUTE_UNUSED,
     840              :                          const char *arg ATTRIBUTE_UNUSED,
     841              :                          int value ATTRIBUTE_UNUSED)
     842              : {
     843            0 :   return false;
     844              : }
     845              : 
     846              : /* Post-switch processing.  */
     847              : bool
     848       218930 : c_common_post_options (const char **pfilename)
     849              : {
     850              :   /* Canonicalize the input and output filenames.  */
     851       218930 :   if (in_fnames == NULL)
     852              :     {
     853            0 :       in_fnames = XNEWVEC (const char *, 1);
     854            0 :       in_fnames[0] = "";
     855              :     }
     856       218930 :   else if (strcmp (in_fnames[0], "-") == 0)
     857              :     {
     858          407 :       if (pch_file)
     859            0 :         error ("cannot use %<-%> as input filename for a precompiled header");
     860              : 
     861          407 :       in_fnames[0] = "";
     862              :     }
     863              : 
     864       218930 :   if (out_fname == NULL || !strcmp (out_fname, "-"))
     865          709 :     out_fname = "";
     866              : 
     867       218930 :   if (cpp_opts->deps.style == DEPS_NONE)
     868       213003 :     check_deps_environment_vars ();
     869              : 
     870       218930 :   handle_deferred_opts ();
     871              : 
     872       218930 :   sanitize_cpp_opts ();
     873              : 
     874              :   /* Don't register include chains if under -fpreprocessed since we might not
     875              :      have correct sysroot this mode, and this may cause file permission
     876              :      issue.  */
     877       218930 :   if (!cpp_opts->preprocessed)
     878       218367 :     register_include_chains (parse_in, sysroot, iprefix, imultilib,
     879       218367 :                              std_inc, std_cxx_inc && c_dialect_cxx (), verbose);
     880              : 
     881              : #ifdef C_COMMON_OVERRIDE_OPTIONS
     882              :   /* Some machines may reject certain combinations of C
     883              :      language-specific options.  */
     884              :   C_COMMON_OVERRIDE_OPTIONS;
     885              : #endif
     886              : 
     887       218930 :   if (flag_excess_precision == EXCESS_PRECISION_DEFAULT)
     888       373569 :     flag_excess_precision = (flag_iso ? EXCESS_PRECISION_STANDARD
     889              :                              : EXCESS_PRECISION_FAST);
     890              : 
     891              :   /* ISO C restricts floating-point expression contraction to within
     892              :      source-language expressions (-ffp-contract=on, currently an alias
     893              :      for -ffp-contract=off).  */
     894       218930 :   if (flag_iso
     895        60931 :       && !c_dialect_cxx ()
     896         6369 :       && (OPTION_SET_P (flag_fp_contract_mode)
     897              :           == (enum fp_contract_mode) 0)
     898         6369 :       && flag_unsafe_math_optimizations == 0)
     899         6364 :     flag_fp_contract_mode = FP_CONTRACT_OFF;
     900              : 
     901              :   /* C language modes before C99 enable -fpermissive by default, but
     902              :      only if -pedantic-errors is not specified.  Also treat
     903              :      -fno-permissive as a subset of -pedantic-errors that does not
     904              :      reject certain GNU extensions also present the defaults for later
     905              :      language modes.  */
     906       218930 :   if (!c_dialect_cxx ()
     907       116165 :       && !flag_isoc99
     908         6975 :       && !global_dc->m_pedantic_errors
     909         5938 :       && !OPTION_SET_P (flag_permissive))
     910              :     {
     911         5937 :       flag_permissive = 1;
     912         5937 :       global_dc->m_permissive = 1;
     913              :     }
     914              : 
     915              :   /* If we are compiling C, and we are outside of a standards mode,
     916              :      we can permit the new values from ISO/IEC TS 18661-3 for
     917              :      FLT_EVAL_METHOD.  Otherwise, we must restrict the possible values to
     918              :      the set specified in ISO C99/C11.  */
     919       218930 :   if (!flag_iso
     920       157999 :       && !c_dialect_cxx ()
     921       109796 :       && (OPTION_SET_P (flag_permitted_flt_eval_methods)
     922              :           == PERMITTED_FLT_EVAL_METHODS_DEFAULT))
     923       109795 :     flag_permitted_flt_eval_methods = PERMITTED_FLT_EVAL_METHODS_TS_18661;
     924              :   else
     925       109135 :     flag_permitted_flt_eval_methods = PERMITTED_FLT_EVAL_METHODS_C11;
     926              : 
     927       218930 :   if (cxx_dialect >= cxx26)
     928              :     {
     929        25839 :       SET_OPTION_IF_UNSET (&global_options, &global_options_set,
     930              :                            flag_auto_var_init, AUTO_INIT_CXX26);
     931        25839 :       if (flag_auto_var_init > AUTO_INIT_UNINITIALIZED)
     932        25835 :         flag_auto_var_init
     933        25835 :           = auto_init_type (flag_auto_var_init | AUTO_INIT_CXX26);
     934              :     }
     935              : 
     936              :   /* The -Wtrivial-auto-var-init warning is useless for C++, where we always
     937              :      add .DEFERRED_INIT calls when some (vacuous) initializers are bypassed
     938              :      through jumps from switch condition to case/default label.  */
     939       218930 :   if (c_dialect_cxx ())
     940       102765 :     warn_trivial_auto_var_init = 0;
     941              : 
     942              :   /* C23 Annex F does not permit certain built-in functions to raise
     943              :      "inexact".  */
     944       218930 :   if (flag_isoc23)
     945       102900 :     SET_OPTION_IF_UNSET (&global_options, &global_options_set,
     946              :                          flag_fp_int_builtin_inexact, 0);
     947              : 
     948              :   /* By default we use C99 inline semantics in GNU99 or C99 mode.  C99
     949              :      inline semantics are not supported in GNU89 or C89 mode.  */
     950       218930 :   if (flag_gnu89_inline == -1)
     951       218483 :     flag_gnu89_inline = !flag_isoc99;
     952          447 :   else if (!flag_gnu89_inline && !flag_isoc99)
     953            1 :     error ("%<-fno-gnu89-inline%> is only supported in GNU99 or C99 mode");
     954              : 
     955              :   /* Default to ObjC sjlj exception handling if NeXT runtime < v2.  */
     956       218930 :   if (flag_objc_sjlj_exceptions < 0)
     957       437860 :     flag_objc_sjlj_exceptions = (flag_next_runtime && flag_objc_abi < 2);
     958       218930 :   if (flag_objc_exceptions && !flag_objc_sjlj_exceptions)
     959            0 :     flag_exceptions = 1;
     960              : 
     961              :   /* If -ffreestanding, -fno-hosted or -fno-builtin then disable
     962              :      pattern recognition.  */
     963       218930 :   if (flag_no_builtin)
     964          792 :     SET_OPTION_IF_UNSET (&global_options, &global_options_set,
     965              :                          flag_tree_loop_distribute_patterns, 0);
     966              : 
     967              :   /* -Woverlength-strings is off by default, but is enabled by -Wpedantic.
     968              :      It is never enabled in C++, as the minimum limit is not normative
     969              :      in that standard.  */
     970       218930 :   if (c_dialect_cxx ())
     971       102765 :     warn_overlength_strings = 0;
     972              : 
     973              :   /* Wmain is enabled by default in C++ but not in C.  */
     974              :   /* Wmain is disabled by default for -ffreestanding (!flag_hosted),
     975              :      even if -Wall or -Wpedantic was given (warn_main will be 2 if set
     976              :      by -Wall, 1 if set by -Wmain).  */
     977       218930 :   if (warn_main == -1)
     978       264492 :     warn_main = (c_dialect_cxx () && flag_hosted) ? 1 : 0;
     979        59151 :   else if (warn_main == 2)
     980        58800 :     warn_main = flag_hosted ? 1 : 0;
     981              : 
     982              :   /* In C, -Wall and -Wc++-compat enable -Wenum-compare; if it has not
     983              :      yet been set, it is disabled by default.  In C++, it is enabled
     984              :      by default.  */
     985       218930 :   if (warn_enum_compare == -1)
     986       209256 :     warn_enum_compare = c_dialect_cxx () ? 1 : 0;
     987              : 
     988              :   /* For C++26 default to -Wkeyword-macro if -Wpedantic.  */
     989       218930 :   if (cxx_dialect >= cxx26 && pedantic)
     990              :     {
     991        16315 :       SET_OPTION_IF_UNSET (&global_options, &global_options_set,
     992              :                            warn_keyword_macro, 1);
     993        16315 :       if (warn_keyword_macro)
     994        16314 :         cpp_opts->cpp_warn_keyword_macro = warn_keyword_macro;
     995              :     }
     996              : 
     997              :   /* -Wpacked-bitfield-compat is on by default for the C languages.  The
     998              :      warning is issued in stor-layout.cc which is not part of the front-end so
     999              :      we need to selectively turn it on here.  */
    1000       218930 :   if (warn_packed_bitfield_compat == -1)
    1001       218922 :     warn_packed_bitfield_compat = 1;
    1002              : 
    1003              :   /* Special format checking options don't work without -Wformat; warn if
    1004              :      they are used.  */
    1005       218930 :   if (!warn_format)
    1006              :     {
    1007       207516 :       warning (OPT_Wformat_y2k,
    1008              :                "%<-Wformat-y2k%> ignored without %<-Wformat%>");
    1009       207516 :       warning (OPT_Wformat_extra_args,
    1010              :                "%<-Wformat-extra-args%> ignored without %<-Wformat%>");
    1011       207516 :       warning (OPT_Wformat_zero_length,
    1012              :                "%<-Wformat-zero-length%> ignored without %<-Wformat%>");
    1013       207516 :       warning (OPT_Wformat_nonliteral,
    1014              :                "%<-Wformat-nonliteral%> ignored without %<-Wformat%>");
    1015       207516 :       warning (OPT_Wformat_contains_nul,
    1016              :                "%<-Wformat-contains-nul%> ignored without %<-Wformat%>");
    1017       207516 :       warning (OPT_Wformat_security,
    1018              :                "%<-Wformat-security%> ignored without %<-Wformat%>");
    1019              :     }
    1020              : 
    1021              :   /* -Wimplicit-function-declaration is enabled by default for C99.  */
    1022       218930 :   if (warn_implicit_function_declaration == -1)
    1023       210470 :     warn_implicit_function_declaration = flag_isoc99;
    1024              : 
    1025              :   /* -Wimplicit-int is enabled by default for C99.  */
    1026       218930 :   if (warn_implicit_int == -1)
    1027       210527 :     warn_implicit_int = flag_isoc99;
    1028              : 
    1029              :   /* -Wold-style-definition is enabled by default for C23.  */
    1030       218930 :   if (warn_old_style_definition == -1)
    1031       214631 :     warn_old_style_definition = flag_isoc23;
    1032              : 
    1033              :   /* -Wshift-overflow is enabled by default in C99 and C++11 modes.  */
    1034       218930 :   if (warn_shift_overflow == -1)
    1035       416410 :     warn_shift_overflow = cxx_dialect >= cxx11 || flag_isoc99;
    1036              : 
    1037              :   /* -Wmissing-parameter-name is enabled by -pedantic before C23,
    1038              :      and for -Wc11-c23-compat.  */
    1039       218930 :   if (warn_missing_parameter_name == -1)
    1040       218927 :     warn_missing_parameter_name
    1041        50433 :       = ((pedantic && !flag_isoc23 && warn_c11_c23_compat != 0)
    1042       269405 :          || warn_c11_c23_compat > 0);
    1043              : 
    1044              :   /* Likewise for -Wfree-labels.  */
    1045       218930 :   if (warn_free_labels == -1)
    1046        50433 :     warn_free_labels = ((pedantic && !flag_isoc23 && warn_c11_c23_compat != 0)
    1047       269405 :                         || warn_c11_c23_compat > 0);
    1048              : 
    1049       218930 :   if (warn_deprecated_non_prototype == -1)
    1050       218925 :     warn_deprecated_non_prototype = warn_c11_c23_compat > 0;
    1051              : 
    1052              :   /* -Wshift-negative-value is enabled by -Wextra in C99 and C++11 to C++17
    1053              :      modes.  */
    1054       218930 :   if (warn_shift_negative_value == -1)
    1055       437820 :     warn_shift_negative_value = (extra_warnings
    1056         7871 :                                  && (cxx_dialect >= cxx11 || flag_isoc99)
    1057       438186 :                                  && cxx_dialect < cxx20);
    1058              : 
    1059              :   /* -Wregister is enabled by default in C++17.  */
    1060       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set, warn_register,
    1061              :                        cxx_dialect >= cxx17);
    1062              : 
    1063              :   /* Explicit -Wdeprecated turns on warnings from later standards.  */
    1064      1712207 :   auto deprecated_in = [&](enum cxx_dialect d)
    1065              :   {
    1066      1493277 :     if (OPTION_SET_P (warn_deprecated)) return !!warn_deprecated;
    1067      1491789 :     return (warn_deprecated && cxx_dialect >= d);
    1068              :   };
    1069              : 
    1070              :   /* -Wcomma-subscript is enabled by default in C++20.  */
    1071       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1072              :                        warn_comma_subscript,
    1073              :                        cxx_dialect >= cxx23
    1074              :                        || deprecated_in (cxx20));
    1075              : 
    1076              :   /* -Wvolatile is enabled by default in C++20.  */
    1077       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set, warn_volatile,
    1078              :                        deprecated_in (cxx20));
    1079              : 
    1080              :   /* -Wdeprecated-enum-enum-conversion is enabled by default in C++20.  */
    1081       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1082              :                        warn_deprecated_enum_enum_conv,
    1083              :                        deprecated_in (cxx20));
    1084              : 
    1085              :   /* -Wdeprecated-enum-float-conversion is enabled by default in C++20.  */
    1086       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1087              :                        warn_deprecated_enum_float_conv,
    1088              :                        deprecated_in (cxx20));
    1089              : 
    1090              :   /* -Wdeprecated-literal-operator is enabled by default in C++23.  */
    1091       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1092              :                        warn_deprecated_literal_operator,
    1093              :                        deprecated_in (cxx23));
    1094              : 
    1095              :   /* -Warray-compare is enabled by default in C++20.  */
    1096       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1097              :                        warn_array_compare,
    1098              :                        warn_array_compare || deprecated_in (cxx20));
    1099              : 
    1100              :   /* -Wdeprecated-variadic-comma-omission is enabled by default in C++26.  */
    1101       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1102              :                        warn_deprecated_variadic_comma_omission,
    1103              :                        deprecated_in (cxx26));
    1104              : 
    1105              :   /* -Wtemplate-id-cdtor is enabled by default in C++20.  */
    1106       297360 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1107              :                        warn_template_id_cdtor,
    1108              :                        cxx_dialect >= cxx20 || warn_cxx20_compat);
    1109              : 
    1110              :   /* For C++29 default to -Wdeprecated-octal-literal.  At least
    1111              :      for the time being, don't use deprecated_in (cxx29) here, warning
    1112              :      with -Wdeprecated in C++26 and older modes for octal literal means
    1113              :      we warn even on correctly portable code using
    1114              :      #if __cpp_0o_octals >= 202611L
    1115              :        0o4561375437615437
    1116              :      #else
    1117              :        04561375437615437
    1118              :      #endif
    1119              :      and one can't easily use 0o prefixed octal literals in C++26 and
    1120              :      older code because there will be pedwarn for those or no support
    1121              :      in older compilers at all.  So, that just tells developers not to use
    1122              :      octal literals at all.  */
    1123       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1124              :                        warn_deprecated_octal_literal, cxx_dialect >= cxx29);
    1125       218930 :   cpp_opts->cpp_warn_deprecated_octal_literal = warn_deprecated_octal_literal;
    1126              : 
    1127              :   /* Declone C++ 'structors if -Os.  */
    1128       218930 :   if (flag_declone_ctor_dtor == -1)
    1129       218893 :     flag_declone_ctor_dtor = optimize_size;
    1130              : 
    1131       218930 :   if (flag_abi_compat_version == 1)
    1132              :     {
    1133            0 :       warning (0, "%<-fabi-compat-version=1%> is not supported, using =2");
    1134            0 :       flag_abi_compat_version = 2;
    1135              :     }
    1136              : 
    1137              :   /* Change flag_abi_version to be the actual current ABI level, for the
    1138              :      benefit of c_cpp_builtins, and to make comparison simpler.  */
    1139       218930 :   const int latest_abi_version = 21;
    1140              :   /* Possibly different for non-default ABI fixes within a release.  */
    1141       218930 :   const int default_abi_version = latest_abi_version;
    1142              :   /* Generate compatibility aliases for ABI v18 (GCC 13) by default.  */
    1143       218930 :   const int abi_compat_default = 18;
    1144              : 
    1145       218930 :   if (flag_abi_version > latest_abi_version)
    1146            0 :     warning (0, "%<-fabi-version=%d%> is not supported, using =%d",
    1147              :              flag_abi_version, latest_abi_version);
    1148              : 
    1149       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1150              :                        flag_abi_version, default_abi_version);
    1151              : 
    1152              : #define clamp(X) if (X == 0 || X > latest_abi_version) X = latest_abi_version
    1153       218930 :   clamp (flag_abi_version);
    1154              :   /* Don't clamp warn_abi_version, let it be 0 or out of bounds.  */
    1155       218930 :   clamp (flag_abi_compat_version);
    1156              : #undef clamp
    1157              : 
    1158              :   /* Default -Wabi= or -fabi-compat-version= from each other.  */
    1159       218930 :   if (warn_abi_version == -1 && flag_abi_compat_version != -1)
    1160          197 :     warn_abi_version = flag_abi_compat_version;
    1161       218733 :   else if (flag_abi_compat_version == -1 && warn_abi_version != -1)
    1162        12690 :     flag_abi_compat_version = warn_abi_version;
    1163       206043 :   else if (warn_abi_version == -1 && flag_abi_compat_version == -1)
    1164              :     {
    1165       205998 :       warn_abi_version = 0;
    1166       205998 :       if (flag_abi_version == default_abi_version)
    1167       205763 :         flag_abi_compat_version = abi_compat_default;
    1168              :       else
    1169          235 :         flag_abi_compat_version = latest_abi_version;
    1170              :     }
    1171              : 
    1172              :   /* Allow warnings vs ABI versions beyond what we currently support.  */
    1173       218930 :   if (warn_abi_version == 0)
    1174       206013 :     warn_abi_version = 1000;
    1175              : 
    1176              :   /* By default, enable the new inheriting constructor semantics along with ABI
    1177              :      11.  New and old should coexist fine, but it is a change in what
    1178              :      artificial symbols are generated.  */
    1179       437604 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1180              :                        flag_new_inheriting_ctors,
    1181              :                        abi_version_at_least (11));
    1182              : 
    1183              :   /* For GCC 7, only enable DR150 resolution by default if -std=c++17.  */
    1184       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set, flag_new_ttp,
    1185              :                        cxx_dialect >= cxx17);
    1186              : 
    1187              :   /* C++11 guarantees forward progress.  */
    1188       411488 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set, flag_finite_loops,
    1189              :                        optimize >= 2 && cxx_dialect >= cxx11);
    1190              : 
    1191              :   /* It's OK to discard calls to pure/const functions that might throw.  */
    1192       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1193              :                        flag_delete_dead_exceptions, true);
    1194              : 
    1195       218930 :   if (cxx_dialect >= cxx11)
    1196              :     {
    1197              :       /* If we're allowing C++0x constructs, don't warn about C++98
    1198              :          identifiers which are keywords in C++0x.  */
    1199        88393 :       warn_cxx11_compat = 0;
    1200        88393 :       cpp_opts->cpp_warn_cxx11_compat = 0;
    1201              : 
    1202        88393 :       if (warn_narrowing == -1)
    1203        86168 :         warn_narrowing = 1;
    1204              : 
    1205              :       /* Unless -f{,no-}ext-numeric-literals has been used explicitly,
    1206              :          for -std=c++{11,14,17,20,23,26} default to
    1207              :          -fno-ext-numeric-literals.  */
    1208        88393 :       if (flag_iso && !OPTION_SET_P (flag_ext_numeric_literals))
    1209        45580 :         cpp_opts->ext_numeric_literals = 0;
    1210              :     }
    1211       130537 :   else if (warn_narrowing == -1)
    1212       130041 :     warn_narrowing = 0;
    1213              : 
    1214       218930 :   if (cxx_dialect >= cxx20)
    1215              :     {
    1216              :       /* Don't warn about C++20 compatibility changes in C++20 or later.  */
    1217        77002 :       warn_cxx20_compat = 0;
    1218        77002 :       cpp_opts->cpp_warn_cxx20_compat = 0;
    1219              :     }
    1220       218930 :   if (cxx_dialect >= cxx26)
    1221              :     /* Don't warn about C++26 compatibility changes in C++26 or later.  */
    1222        25839 :     warn_cxx26_compat = 0;
    1223              : 
    1224              :   /* C++17 has stricter evaluation order requirements; let's use some of them
    1225              :      for earlier C++ as well, so chaining works as expected.  */
    1226       218930 :   if (c_dialect_cxx ()
    1227       102765 :       && flag_strong_eval_order == -1)
    1228       124242 :     flag_strong_eval_order = (cxx_dialect >= cxx17 ? 2 : 1);
    1229              : 
    1230       218930 :   if (flag_implicit_constexpr && cxx_dialect < cxx14)
    1231            0 :     flag_implicit_constexpr = false;
    1232              : 
    1233              :   /* Global sized deallocation is new in C++14.  */
    1234       218930 :   if (flag_sized_deallocation == -1)
    1235       218923 :     flag_sized_deallocation = (cxx_dialect >= cxx14);
    1236              : 
    1237              :   /* Pedwarn about invalid constexpr functions before C++23.  */
    1238       218930 :   if (warn_invalid_constexpr == -1)
    1239       218910 :     warn_invalid_constexpr = (cxx_dialect < cxx23);
    1240              : 
    1241              :   /* char8_t support is implicitly enabled in C++20 and C23.  */
    1242       218930 :   if (flag_char8_t == -1)
    1243       398667 :     flag_char8_t = (cxx_dialect >= cxx20) || flag_isoc23;
    1244       218930 :   cpp_opts->unsigned_utf8char = flag_char8_t ? 1 : cpp_opts->unsigned_char;
    1245              : 
    1246       218930 :   cpp_opts->cpp_tabstop = global_dc->get_column_options ().m_tabstop;
    1247              : 
    1248       218930 :   if (flag_extern_tls_init)
    1249              :     {
    1250       218928 :       if (!TARGET_SUPPORTS_ALIASES || !SUPPORTS_WEAK)
    1251              :         {
    1252              :           /* Lazy TLS initialization for a variable in another TU requires
    1253              :              alias and weak reference support.  */
    1254              :           if (flag_extern_tls_init > 0)
    1255              :             sorry ("external TLS initialization functions not supported "
    1256              :                    "on this target");
    1257              : 
    1258              :           flag_extern_tls_init = 0;
    1259              :         }
    1260              :       else
    1261       218928 :         flag_extern_tls_init = 1;
    1262              :     }
    1263              : 
    1264              :   /* Enable by default only for C++ and C++ with ObjC extensions.  */
    1265       218930 :   if (warn_return_type == -1 && c_dialect_cxx ())
    1266        99186 :     warn_return_type = 1;
    1267              : 
    1268              :   /* C++20 is the final version of concepts.  We still use -fconcepts
    1269              :      to know when concepts are enabled.  */
    1270       218930 :   if (cxx_dialect >= cxx20)
    1271        77002 :     flag_concepts = 1;
    1272              : 
    1273              :   /* Coroutines are also a C++20 feature.  */
    1274       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1275              :                        flag_coroutines, cxx_dialect >= cxx20);
    1276              : 
    1277              :   /* Enable lifetime extension of range based for temporaries for C++23.  */
    1278       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1279              :                        flag_range_for_ext_temps, cxx_dialect >= cxx23);
    1280              : 
    1281              :   /* Contracts are in C++26.  Keep lang_specific_driver in sync.  */
    1282       218930 :   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1283              :                        flag_contracts, cxx_dialect >= cxx26);
    1284              : 
    1285              :   /* EnabledBy unfortunately can't specify value to use if set and
    1286              :      LangEnabledBy can't specify multiple options with &&.  For -Wunused
    1287              :      or -Wunused -Wextra we want these to default to 3 unless user specified
    1288              :      some other level explicitly.  */
    1289       218930 :   if (warn_unused_but_set_parameter == 1)
    1290         7715 :     SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1291              :                          warn_unused_but_set_parameter, 3);
    1292       218930 :   if (warn_unused_but_set_variable == 1)
    1293        10613 :     SET_OPTION_IF_UNSET (&global_options, &global_options_set,
    1294              :                          warn_unused_but_set_variable, 3);
    1295              : 
    1296              :   /* -fimmediate-escalation has no effect when immediate functions are not
    1297              :      supported.  */
    1298       218930 :   if (flag_immediate_escalation && cxx_dialect < cxx20)
    1299       141928 :     flag_immediate_escalation = 0;
    1300              : 
    1301       218930 :   if (flag_reflection && cxx_dialect < cxx26)
    1302            0 :     error ("%<-freflection%> only supported with %<-std=c++26%> or "
    1303              :            "%<-std=gnu++26%>");
    1304              : 
    1305       218930 :   if (num_in_fnames > 1)
    1306            0 :     error ("too many filenames given; type %<%s %s%> for usage",
    1307              :            progname, "--help");
    1308              : 
    1309       218930 :   if (flag_preprocess_only)
    1310              :     {
    1311              :       /* Open the output now.  We must do so even if flag_no_output is
    1312              :          on, because there may be other output than from the actual
    1313              :          preprocessing (e.g. from -dM).  */
    1314         7243 :       if (out_fname[0] == '\0')
    1315          709 :         out_stream = stdout;
    1316              :       else
    1317         6534 :         out_stream = fopen (out_fname, "w");
    1318              : 
    1319         7243 :       if (out_stream == NULL)
    1320            0 :         fatal_error (input_location, "opening output file %s: %m", out_fname);
    1321              : 
    1322         7243 :       init_pp_output (out_stream);
    1323              :     }
    1324              :   else
    1325              :     {
    1326       211687 :       init_c_lex ();
    1327              : 
    1328              :       /* When writing a PCH file, avoid reading some other PCH file,
    1329              :          because the default address space slot then can't be used
    1330              :          for the output PCH file.  */
    1331       211687 :       if (pch_file)
    1332              :         {
    1333          470 :           c_common_no_more_pch ();
    1334              :           /* Only -g0 and -gdwarf* are supported with PCH, for other
    1335              :              debug formats we warn here and refuse to load any PCH files.  */
    1336          470 :           if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG)
    1337            0 :               warning (OPT_Wdeprecated,
    1338              :                        "the %qs debug info cannot be used with "
    1339              :                        "pre-compiled headers",
    1340              :                        debug_set_names (write_symbols & ~DWARF2_DEBUG));
    1341              :           /* Let libcpp know that the main file is a header so it won't
    1342              :              complain about things like #include_next and #pragma once.  */
    1343          470 :           cpp_opts->main_search = CMS_header;
    1344              :         }
    1345       211217 :       else if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG)
    1346          432 :         c_common_no_more_pch ();
    1347              : 
    1348              :       /* Yuk.  WTF is this?  I do know ObjC relies on it somewhere.  */
    1349       211687 :       input_location = UNKNOWN_LOCATION;
    1350              :     }
    1351              : 
    1352       218930 :   struct cpp_callbacks *cb = cpp_get_callbacks (parse_in);
    1353       218930 :   cb->file_change = cb_file_change;
    1354       218930 :   cb->dir_change = cb_dir_change;
    1355       218930 :   if (lang_hooks.preprocess_options)
    1356       102765 :     lang_hooks.preprocess_options (parse_in);
    1357       218930 :   cpp_post_options (parse_in);
    1358       218930 :   init_global_opts_from_cpp (&global_options, cpp_get_options (parse_in));
    1359              :   /* For C++23 and explicit -finput-charset=UTF-8, turn on -Winvalid-utf8
    1360              :      by default and make it a pedwarn unless -Wno-invalid-utf8.  */
    1361       218930 :   if (cxx_dialect >= cxx23
    1362        28061 :       && cpp_opts->cpp_input_charset_explicit
    1363           28 :       && strcmp (cpp_opts->input_charset, "UTF-8") == 0
    1364           26 :       && (cpp_opts->cpp_warn_invalid_utf8
    1365           21 :           || !global_options_set.x_warn_invalid_utf8))
    1366              :     {
    1367           23 :       global_options.x_warn_invalid_utf8 = 1;
    1368           34 :       cpp_opts->cpp_warn_invalid_utf8 = cpp_opts->cpp_pedantic ? 2 : 1;
    1369              :     }
    1370              : 
    1371              :   /* Let diagnostics infrastructure know how to convert input files the same
    1372              :      way libcpp will do it, namely using the configured input charset and
    1373              :      skipping a UTF-8 BOM if present.  */
    1374       218930 :   diagnostic_initialize_input_context (global_dc,
    1375              :                                        c_common_input_charset_cb, true);
    1376       218930 :   input_location = UNKNOWN_LOCATION;
    1377              : 
    1378       437860 :   *pfilename = this_input_filename
    1379       437860 :     = cpp_read_main_file (parse_in, in_fnames[0],
    1380              :                           /* We'll inject preamble pieces if this is
    1381              :                              not preprocessed.  */
    1382       218930 :                           !cpp_opts->preprocessed);
    1383              : 
    1384              :   /* Don't do any compilation or preprocessing if there is no input file.  */
    1385       218930 :   if (this_input_filename == NULL)
    1386              :     {
    1387            0 :       errorcount++;
    1388            0 :       return false;
    1389              :     }
    1390              : 
    1391       218930 :   if (flag_working_directory
    1392        42699 :       && flag_preprocess_only && !flag_no_line_commands)
    1393         2266 :     pp_dir_change (parse_in, get_src_pwd ());
    1394              : 
    1395              :   /* Disable LTO output when outputting a precompiled header.  */
    1396       218930 :   if (pch_file && flag_lto)
    1397              :     {
    1398            0 :       flag_lto = 0;
    1399            0 :       flag_generate_lto = 0;
    1400              :     }
    1401              : 
    1402       218930 :   return flag_preprocess_only;
    1403              : }
    1404              : 
    1405              : /* Front end initialization common to C, ObjC and C++.  */
    1406              : bool
    1407       218715 : c_common_init (void)
    1408              : {
    1409              :   /* Set up preprocessor arithmetic.  Must be done after call to
    1410              :      c_common_nodes_and_builtins for type nodes to be good.  */
    1411       218715 :   cpp_opts->precision = TYPE_PRECISION (intmax_type_node);
    1412       218715 :   cpp_opts->char_precision = TYPE_PRECISION (char_type_node);
    1413       218715 :   cpp_opts->int_precision = TYPE_PRECISION (integer_type_node);
    1414       218715 :   cpp_opts->wchar_precision = TYPE_PRECISION (wchar_type_node);
    1415       218715 :   cpp_opts->unsigned_wchar = TYPE_UNSIGNED (wchar_type_node);
    1416       218715 :   cpp_opts->bytes_big_endian = BYTES_BIG_ENDIAN;
    1417              : 
    1418              :   /* This can't happen until after wchar_precision and bytes_big_endian
    1419              :      are known.  */
    1420       218715 :   cpp_init_iconv (parse_in);
    1421              : 
    1422       218715 :   if (version_flag)
    1423              :     {
    1424          111 :       int i;
    1425          111 :       fputs ("Compiler executable checksum: ", stderr);
    1426         1998 :       for (i = 0; i < 16; i++)
    1427         1776 :         fprintf (stderr, "%02x", executable_checksum[i]);
    1428          111 :       putc ('\n', stderr);
    1429              :     }
    1430              : 
    1431              :   /* Has to wait until now so that cpplib has its hash table.  */
    1432       218715 :   init_pragma ();
    1433              : 
    1434       218715 :   if (flag_preprocess_only)
    1435              :     {
    1436         7238 :       c_init_preprocess ();
    1437         7238 :       c_finish_options ();
    1438         7238 :       preprocess_file (parse_in);
    1439         7238 :       return false;
    1440              :     }
    1441              : 
    1442              :   return true;
    1443              : }
    1444              : 
    1445              : /* Initialize the integrated preprocessor after debug output has been
    1446              :    initialized; loop over each input file.  */
    1447              : void
    1448       211477 : c_common_parse_file (void)
    1449              : {
    1450       211477 :   auto dumps = g->get_dumps ();
    1451       211477 :   for (unsigned int i = 0;;)
    1452              :     {
    1453       211477 :       c_finish_options ();
    1454              :       /* Open the dump file to use for the original dump output
    1455              :          here, to be used during parsing for the current file.  */
    1456       211477 :       dumps->dump_start (TDI_original, &dump_flags);
    1457       211477 :       pch_init ();
    1458       211477 :       push_file_scope ();
    1459       211477 :       c_parse_file ();
    1460       211179 :       pop_file_scope ();
    1461              :       /* And end the main input file, if the debug writer wants it  */
    1462       211179 :       if (debug_hooks->start_end_main_source_file)
    1463        40245 :         (*debug_hooks->end_source_file) (0);
    1464       211179 :       if (++i >= num_in_fnames)
    1465              :         break;
    1466            0 :       cpp_undef_all (parse_in);
    1467            0 :       cpp_clear_file_cache (parse_in);
    1468            0 :       this_input_filename
    1469            0 :         = cpp_read_main_file (parse_in, in_fnames[i]);
    1470              :       /* If an input file is missing, abandon further compilation.
    1471              :          cpplib has issued a diagnostic.  */
    1472            0 :       if (!this_input_filename)
    1473              :         break;
    1474            0 :       dumps->dump_finish (TDI_original);
    1475              :     }
    1476              : 
    1477       211179 :   c_parse_final_cleanups ();
    1478       211165 :   dumps->dump_finish (TDI_original);
    1479       211165 : }
    1480              : 
    1481              : /* Common finish hook for the C, ObjC and C++ front ends.  */
    1482              : void
    1483       218208 : c_common_finish (void)
    1484              : {
    1485       218208 :   FILE *deps_stream = NULL;
    1486       218208 :   FILE *fdeps_stream = NULL;
    1487              : 
    1488              :   /* Note that we write the dependencies even if there are errors. This is
    1489              :      useful for handling outdated generated headers that now trigger errors
    1490              :      (for example, with #error) which would be resolved by re-generating
    1491              :      them. In a sense, this complements -MG.  */
    1492       218208 :   if (cpp_opts->deps.style != DEPS_NONE)
    1493              :     {
    1494              :       /* If -M or -MM was seen without -MF, default output to the
    1495              :          output stream.  */
    1496         5922 :       if (!deps_file)
    1497           25 :         deps_stream = out_stream;
    1498         5897 :       else if (deps_file[0] == '-' && deps_file[1] == '\0')
    1499            0 :         deps_stream = stdout;
    1500              :       else
    1501              :         {
    1502        11794 :           deps_stream = fopen (deps_file, deps_append ? "a" : "w");
    1503         5897 :           if (!deps_stream)
    1504            0 :             fatal_error (input_location, "opening dependency file %s: %m",
    1505              :                          deps_file);
    1506              :         }
    1507              :     }
    1508              : 
    1509              :   /* When we call cpp_finish (), it may generate some diagnostics using
    1510              :      locations it remembered from the preprocessing phase, e.g. for
    1511              :      -Wunused-macros.  So inform c_cpp_diagnostic () not to override those
    1512              :      locations with input_location, which would be incorrect now.  */
    1513       218208 :   override_libcpp_locations = false;
    1514              : 
    1515       218208 :   if (cpp_opts->deps.fdeps_format != FDEPS_FMT_NONE)
    1516              :     {
    1517           36 :       if (!fdeps_file)
    1518            0 :         fdeps_stream = out_stream;
    1519           36 :       else if (fdeps_file[0] == '-' && fdeps_file[1] == '\0')
    1520            0 :         fdeps_stream = stdout;
    1521              :       else
    1522              :         {
    1523           36 :           fdeps_stream = fopen (fdeps_file, "w");
    1524           36 :           if (!fdeps_stream)
    1525            0 :             fatal_error (input_location, "opening dependency file %s: %m",
    1526              :                          fdeps_file);
    1527              :         }
    1528           36 :       if (fdeps_stream == deps_stream && fdeps_stream != stdout)
    1529            0 :         fatal_error (input_location, "%<-MF%> and %<-fdeps-file=%> cannot share an output file %s: %m",
    1530            0 :                      fdeps_file ? fdeps_file : out_fname);
    1531              :     }
    1532              : 
    1533              :   /* For performance, avoid tearing down cpplib's internal structures
    1534              :      with cpp_destroy ().  */
    1535       218208 :   cpp_finish (parse_in, deps_stream, fdeps_stream);
    1536              : 
    1537         5922 :   if (deps_stream && deps_stream != out_stream && deps_stream != stdout
    1538       224105 :       && (ferror (deps_stream) || fclose (deps_stream)))
    1539            0 :     fatal_error (input_location, "closing dependency file %s: %m", deps_file);
    1540              : 
    1541       218208 :   if (out_stream && (ferror (out_stream) || fclose (out_stream)))
    1542            0 :     fatal_error (input_location, "when writing output to %s: %m", out_fname);
    1543       218208 : }
    1544              : 
    1545              : /* Either of two environment variables can specify output of
    1546              :    dependencies.  Their value is either "OUTPUT_FILE" or "OUTPUT_FILE
    1547              :    DEPS_TARGET", where OUTPUT_FILE is the file to write deps info to
    1548              :    and DEPS_TARGET is the target to mention in the deps.  They also
    1549              :    result in dependency information being appended to the output file
    1550              :    rather than overwriting it, and like Sun's compiler
    1551              :    SUNPRO_DEPENDENCIES suppresses the dependency on the main file.  */
    1552              : static void
    1553       213003 : check_deps_environment_vars (void)
    1554              : {
    1555       213003 :   char *spec;
    1556              : 
    1557       213003 :   spec = getenv ("DEPENDENCIES_OUTPUT");
    1558       213003 :   if (spec)
    1559            0 :     cpp_opts->deps.style = DEPS_USER;
    1560              :   else
    1561              :     {
    1562       213003 :       spec = getenv ("SUNPRO_DEPENDENCIES");
    1563       213003 :       if (spec)
    1564              :         {
    1565            0 :           cpp_opts->deps.style = DEPS_SYSTEM;
    1566            0 :           cpp_opts->deps.ignore_main_file = true;
    1567              :         }
    1568              :     }
    1569              : 
    1570            0 :   if (spec)
    1571              :     {
    1572              :       /* Find the space before the DEPS_TARGET, if there is one.  */
    1573            0 :       char *s = strchr (spec, ' ');
    1574            0 :       if (s)
    1575              :         {
    1576              :           /* Let the caller perform MAKE quoting.  */
    1577            0 :           defer_opt (OPT_MT, s + 1);
    1578            0 :           *s = '\0';
    1579              :         }
    1580              : 
    1581              :       /* Command line -MF overrides environment variables and default.  */
    1582            0 :       if (!deps_file)
    1583            0 :         deps_file = spec;
    1584              : 
    1585            0 :       deps_append = 1;
    1586            0 :       deps_seen = true;
    1587              :     }
    1588       213003 : }
    1589              : 
    1590              : /* Handle deferred command line switches.  */
    1591              : static void
    1592       218930 : handle_deferred_opts (void)
    1593              : {
    1594              :   /* Avoid allocating the deps buffer if we don't need it.
    1595              :      (This flag may be true without there having been -MT or -MQ
    1596              :      options, but we'll still need the deps buffer.)  */
    1597       218930 :   if (!deps_seen)
    1598              :     return;
    1599              : 
    1600         5926 :   if (mkdeps *deps = cpp_get_deps (parse_in))
    1601        35050 :     for (unsigned i = 0; i < deferred_count; i++)
    1602              :       {
    1603        29148 :         struct deferred_opt *opt = &deferred_opts[i];
    1604              : 
    1605        29148 :         if (opt->code == OPT_MT || opt->code == OPT_MQ)
    1606         5892 :           deps_add_target (deps, opt->arg, opt->code == OPT_MQ);
    1607        23256 :         else if (opt->code == OPT_fdeps_target_)
    1608           42 :           fdeps_add_target (deps, opt->arg, true);
    1609              :       }
    1610              : }
    1611              : 
    1612              : /* These settings are appropriate for GCC, but not necessarily so for
    1613              :    cpplib as a library.  */
    1614              : static void
    1615       218930 : sanitize_cpp_opts (void)
    1616              : {
    1617              :   /* If we don't know what style of dependencies to output, complain
    1618              :      if any other dependency switches have been given.  */
    1619       218930 :   if (deps_seen && cpp_opts->deps.style == DEPS_NONE)
    1620           24 :     error ("to generate dependencies you must specify either %<-M%> "
    1621              :            "or %<-MM%>");
    1622              : 
    1623              :   /* -dM and dependencies suppress normal output; do it here so that
    1624              :      the last -d[MDN] switch overrides earlier ones.  */
    1625       218930 :   if (flag_dump_macros == 'M')
    1626           80 :     flag_no_output = 1;
    1627              : 
    1628              :   /* By default, -fdirectives-only implies -dD.  This allows subsequent phases
    1629              :      to perform proper macro expansion.  */
    1630       218930 :   if (cpp_opts->directives_only && !cpp_opts->preprocessed && !flag_dump_macros)
    1631           80 :     flag_dump_macros = 'D';
    1632              : 
    1633              :   /* Disable -dD, -dN and -dI if normal output is suppressed.  Allow
    1634              :      -dM since at least glibc relies on -M -dM to work.  */
    1635              :   /* Also, flag_no_output implies flag_no_line_commands, always.  */
    1636       218930 :   if (flag_no_output)
    1637              :     {
    1638          110 :       if (flag_dump_macros != 'M')
    1639           30 :         flag_dump_macros = 0;
    1640          110 :       flag_dump_includes = 0;
    1641          110 :       flag_no_line_commands = 1;
    1642              :     }
    1643       218820 :   else if (cpp_opts->deps.missing_files)
    1644            1 :     error ("%<-MG%> may only be used with %<-M%> or %<-MM%>");
    1645              : 
    1646       218930 :   cpp_opts->unsigned_char = !flag_signed_char;
    1647       218930 :   cpp_opts->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS;
    1648              : 
    1649              :   /* Wlong-long is disabled by default. It is enabled by:
    1650              :       [-Wpedantic | -Wtraditional] -std=[gnu|c]++98 ; or
    1651              :       [-Wpedantic | -Wtraditional] -std=non-c99
    1652              : 
    1653              :       Either -Wlong-long or -Wno-long-long override any other settings.
    1654              :       ??? These conditions should be handled in c.opt.  */
    1655       218930 :   if (warn_long_long == -1)
    1656              :     {
    1657       167742 :       warn_long_long = ((pedantic || warn_traditional)
    1658       171581 :                         && (c_dialect_cxx () ? cxx_dialect == cxx98 : !flag_isoc99));
    1659       171557 :       cpp_opts->cpp_warn_long_long = warn_long_long;
    1660              :     }
    1661              : 
    1662              :   /* If we're generating preprocessor output, emit current directory
    1663              :      if explicitly requested or if debugging information is enabled.
    1664              :      ??? Maybe we should only do it for debugging formats that
    1665              :      actually output the current directory?  */
    1666       218930 :   if (flag_working_directory == -1)
    1667       217614 :     flag_working_directory = (debug_info_level != DINFO_LEVEL_NONE);
    1668              : 
    1669       218930 :   if (warn_implicit_fallthrough < 5)
    1670       218930 :     cpp_opts->cpp_warn_implicit_fallthrough = warn_implicit_fallthrough;
    1671              :   else
    1672            4 :     cpp_opts->cpp_warn_implicit_fallthrough = 0;
    1673              : 
    1674       218930 :   if (cpp_opts->directives_only)
    1675              :     {
    1676          121 :       if (cpp_warn_unused_macros)
    1677            4 :         error ("%<-fdirectives-only%> is incompatible "
    1678              :                "with %<-Wunused-macros%>");
    1679          121 :       if (cpp_opts->traditional)
    1680            1 :         error ("%<-fdirectives-only%> is incompatible with %<-traditional%>");
    1681              :     }
    1682       218930 : }
    1683              : 
    1684              : /* Add include path with a prefix at the front of its name.  */
    1685              : static void
    1686            0 : add_prefixed_path (const char *suffix, incpath_kind chain)
    1687              : {
    1688            0 :   char *path;
    1689            0 :   const char *prefix;
    1690            0 :   size_t prefix_len, suffix_len;
    1691              : 
    1692            0 :   suffix_len = strlen (suffix);
    1693            0 :   prefix     = iprefix ? iprefix : cpp_GCC_INCLUDE_DIR;
    1694            0 :   prefix_len = iprefix ? strlen (iprefix) : cpp_GCC_INCLUDE_DIR_len;
    1695              : 
    1696            0 :   path = (char *) xmalloc (prefix_len + suffix_len + 1);
    1697            0 :   memcpy (path, prefix, prefix_len);
    1698            0 :   memcpy (path + prefix_len, suffix, suffix_len);
    1699            0 :   path[prefix_len + suffix_len] = '\0';
    1700              : 
    1701            0 :   add_path (path, chain, 0, false);
    1702            0 : }
    1703              : 
    1704              : /* Handle -D, -U, -A, -imacros, and the first -include.  */
    1705              : static void
    1706       218715 : c_finish_options (void)
    1707              : {
    1708       218715 :   if (!cpp_opts->preprocessed)
    1709              :     {
    1710       218152 :       const line_map_ordinary *bltin_map
    1711       218152 :         = linemap_check_ordinary (linemap_add (line_table, LC_RENAME, 0,
    1712              :                                                special_fname_builtin (), 0));
    1713       218152 :       cb_file_change (parse_in, bltin_map);
    1714       218152 :       linemap_line_start (line_table, 0, 1);
    1715              : 
    1716              :       /* Make sure all of the builtins about to be declared have
    1717              :          BUILTINS_LOCATION has their location_t.  */
    1718       218152 :       cpp_force_token_locations (parse_in, BUILTINS_LOCATION);
    1719              : 
    1720       218152 :       cpp_init_builtins (parse_in, flag_hosted);
    1721       218152 :       c_cpp_builtins (parse_in);
    1722              : 
    1723              :       /* We're about to send user input to cpplib, so make it warn for
    1724              :          things that we previously (when we sent it internal definitions)
    1725              :          told it to not warn.
    1726              : 
    1727              :          C99 permits implementation-defined characters in identifiers.
    1728              :          The documented meaning of -std= is to turn off extensions that
    1729              :          conflict with the specified standard, and since a strictly
    1730              :          conforming program cannot contain a '$', we do not condition
    1731              :          their acceptance on the -std= setting.  */
    1732       218152 :       cpp_opts->warn_dollars = (cpp_opts->cpp_pedantic && !cpp_opts->c99);
    1733              : 
    1734       218152 :       const line_map_ordinary *cmd_map
    1735       218152 :         = linemap_check_ordinary (linemap_add (line_table, LC_RENAME, 0,
    1736       218152 :                                                _("<command-line>"), 0));
    1737       218152 :       cb_file_change (parse_in, cmd_map);
    1738       218152 :       linemap_line_start (line_table, 0, 1);
    1739              : 
    1740       218152 :       bool fortify_seen_p = false;
    1741       218152 :       bool cxx_assert_seen_p = false;
    1742              : 
    1743              :       /* All command line defines must have the same location.  */
    1744       218152 :       line_table->cmdline_location = line_table->highest_line;
    1745       218152 :       cpp_force_token_locations (parse_in, line_table->highest_line);
    1746       633799 :       for (size_t i = 0; i < deferred_count; i++)
    1747              :         {
    1748       197495 :           struct deferred_opt *opt = &deferred_opts[i];
    1749              : 
    1750       197495 :           if (opt->code == OPT_D)
    1751       181819 :             cpp_define (parse_in, opt->arg);
    1752        15676 :           else if (opt->code == OPT_U)
    1753           61 :             cpp_undef (parse_in, opt->arg);
    1754        15615 :           else if (opt->code == OPT_A)
    1755              :             {
    1756           10 :               if (opt->arg[0] == '-')
    1757            2 :                 cpp_unassert (parse_in, opt->arg + 1);
    1758              :               else
    1759            8 :                 cpp_assert (parse_in, opt->arg);
    1760              :             }
    1761              : 
    1762       197495 :           if (UNLIKELY (flag_hardened)
    1763           83 :               && (opt->code == OPT_D || opt->code == OPT_U))
    1764              :             {
    1765           83 :               if (!fortify_seen_p)
    1766           79 :                 fortify_seen_p
    1767           79 :                   = (!strncmp (opt->arg, "_FORTIFY_SOURCE", 15)
    1768           79 :                      && (opt->arg[15] == '\0' || opt->arg[15] == '='));
    1769           83 :               if (!cxx_assert_seen_p)
    1770           83 :                 cxx_assert_seen_p
    1771           83 :                   = (!strncmp (opt->arg, "_GLIBCXX_ASSERTIONS", 19)
    1772           83 :                      && (opt->arg[19] == '\0' || opt->arg[19] == '='));
    1773              :             }
    1774              :         }
    1775              : 
    1776       218152 :       if (flag_hardened)
    1777              :         {
    1778           92 :           if (!fortify_seen_p && optimize > 0)
    1779           72 :             cpp_define_formatted (parse_in, "_FORTIFY_SOURCE=%u",
    1780           72 :                                   targetm.fortify_source_default_level ());
    1781           20 :           else if (optimize == 0)
    1782           20 :             warning_at (UNKNOWN_LOCATION, OPT_Whardened,
    1783              :                         "%<_FORTIFY_SOURCE%> is not enabled by %<-fhardened%> "
    1784              :                         "because optimizations are turned off");
    1785              :           else
    1786            0 :             warning_at (UNKNOWN_LOCATION, OPT_Whardened,
    1787              :                         "%<_FORTIFY_SOURCE%> is not enabled by %<-fhardened%> "
    1788              :                         "because it was specified in %<-D%> or %<-U%>");
    1789           92 :           if (!cxx_assert_seen_p)
    1790           88 :             cpp_define (parse_in, "_GLIBCXX_ASSERTIONS");
    1791              :           else
    1792            4 :             warning_at (UNKNOWN_LOCATION, OPT_Whardened,
    1793              :                         "%<_GLIBCXX_ASSERTIONS%> is not enabled by "
    1794              :                         "%<-fhardened%> because it was specified in %<-D%> "
    1795              :                         "or %<-U%>");
    1796              :         }
    1797              : 
    1798       218152 :       cpp_stop_forcing_token_locations (parse_in);
    1799              :     }
    1800          563 :   else if (cpp_opts->directives_only)
    1801           41 :     cpp_init_special_builtins (parse_in);
    1802              : 
    1803              :   /* Start the main input file, if the debug writer wants it. */
    1804       218715 :   if (debug_hooks->start_end_main_source_file
    1805        42630 :       && !flag_preprocess_only)
    1806        40360 :     (*debug_hooks->start_source_file) (0, this_input_filename);
    1807              : 
    1808       218715 :   if (!cpp_opts->preprocessed)
    1809              :     /* Handle -imacros after -D and -U.  */
    1810       415647 :     for (size_t i = 0; i < deferred_count; i++)
    1811              :       {
    1812       197495 :         struct deferred_opt *opt = &deferred_opts[i];
    1813              : 
    1814       197495 :         if (opt->code == OPT_imacros
    1815       197495 :             && cpp_push_include (parse_in, opt->arg))
    1816              :           {
    1817              :             /* Disable push_command_line_include callback for now.  */
    1818            8 :             include_cursor = deferred_count + 1;
    1819            8 :             cpp_scan_nooutput (parse_in);
    1820              :           }
    1821              :       }
    1822              : 
    1823       218715 :   include_cursor = 0;
    1824       218715 :   push_command_line_include ();
    1825       218715 : }
    1826              : 
    1827              : /* Give CPP the next file given by -include, if any.  */
    1828              : static void
    1829       770088 : push_command_line_include (void)
    1830              : {
    1831              :   /* This can happen if disabled by -imacros for example.
    1832              :      Punt so that we don't set "<command-line>" as the filename for
    1833              :      the header.  */
    1834       770088 :   if (include_cursor > deferred_count)
    1835              :     return;
    1836              : 
    1837       446445 :   if (!done_preinclude)
    1838              :     {
    1839       218715 :       done_preinclude = true;
    1840       218715 :       if (flag_hosted && std_inc && !cpp_opts->preprocessed)
    1841              :         {
    1842       218070 :           const char *preinc = targetcm.c_preinclude ();
    1843       218070 :           if (preinc && cpp_push_default_include (parse_in, preinc))
    1844              :             return;
    1845              :         }
    1846              :     }
    1847              : 
    1848       228375 :   pch_cpp_save_state ();
    1849              : 
    1850       644636 :   while (include_cursor < deferred_count)
    1851              :     {
    1852       197547 :       struct deferred_opt *opt = &deferred_opts[include_cursor++];
    1853              : 
    1854       395041 :       if (!cpp_opts->preprocessed && opt->code == OPT_include
    1855       207211 :           && cpp_push_include (parse_in, opt->arg))
    1856              :         return;
    1857              :     }
    1858              : 
    1859       218714 :   if (include_cursor == deferred_count)
    1860              :     {
    1861       218714 :       include_cursor++;
    1862              :       /* -Wunused-macros should only warn about macros defined hereafter.  */
    1863       218714 :       cpp_opts->warn_unused_macros = cpp_warn_unused_macros;
    1864              :       /* Restore the line map back to the main file.  */
    1865       218714 :       if (!cpp_opts->preprocessed)
    1866              :         {
    1867       218151 :           cpp_change_file (parse_in, LC_RENAME, this_input_filename);
    1868       218151 :           if (lang_hooks.preprocess_main_file)
    1869              :             /* We're starting the main file.  Inform the FE of that.  */
    1870       102485 :             lang_hooks.preprocess_main_file
    1871       102485 :               (parse_in, line_table, LINEMAPS_LAST_ORDINARY_MAP (line_table));
    1872              :         }
    1873              : 
    1874              :       /* Set this here so the client can change the option if it wishes,
    1875              :          and after stacking the main file so we don't trace the main file.  */
    1876       218714 :       line_table->trace_includes = cpp_opts->print_include_names;
    1877              :     }
    1878              : }
    1879              : 
    1880              : /* File change callback.  Has to handle -include files.  */
    1881              : static void
    1882     21366901 : cb_file_change (cpp_reader *reader, const line_map_ordinary *new_map)
    1883              : {
    1884     21366901 :   if (flag_preprocess_only)
    1885       186810 :     pp_file_change (new_map);
    1886              :   else
    1887     21180091 :     fe_file_change (new_map);
    1888              : 
    1889     21148578 :   if (new_map && cpp_opts->preprocessed
    1890        42876 :       && lang_hooks.preprocess_main_file && MAIN_FILE_P (new_map)
    1891     21369583 :       && ORDINARY_MAP_STARTING_LINE_NUMBER (new_map))
    1892              :     /* We're starting the main file.  Inform the FE of that.  */
    1893          489 :     lang_hooks.preprocess_main_file (reader, line_table, new_map);
    1894              : 
    1895     21366901 :   if (new_map
    1896     21148578 :       && (new_map->reason == LC_ENTER || new_map->reason == LC_RENAME))
    1897              :     {
    1898              :       /* Signal to plugins that a file is included.  This could happen
    1899              :          several times with the same file path, e.g. because of
    1900              :          several '#include' or '#line' directives...  */
    1901     11013124 :       invoke_plugin_callbacks
    1902     11013124 :         (PLUGIN_INCLUDE_FILE,
    1903     11013124 :          const_cast<char*> (ORDINARY_MAP_FILE_NAME (new_map)));
    1904              :     }
    1905              : 
    1906     21148578 :   if (new_map == 0 || (new_map->reason == LC_LEAVE && MAIN_FILE_P (new_map)))
    1907              :     {
    1908       551373 :       pch_cpp_save_state ();
    1909       551373 :       push_command_line_include ();
    1910              :     }
    1911     21366900 : }
    1912              : 
    1913              : void
    1914           62 : cb_dir_change (cpp_reader * ARG_UNUSED (pfile), const char *dir)
    1915              : {
    1916           62 :   if (!set_src_pwd (dir))
    1917            0 :     warning (0, "too late for # directive to set debug directory");
    1918           62 : }
    1919              : 
    1920              : /* Set the C 89 standard (with 1994 amendments if C94, without GNU
    1921              :    extensions if ISO).  There is no concept of gnu94.  */
    1922              : static void
    1923         7017 : set_std_c89 (int c94, int iso)
    1924              : {
    1925         9970 :   cpp_set_lang (parse_in, c94 ? CLK_STDC94 : iso ? CLK_STDC89 : CLK_GNUC89);
    1926         7017 :   flag_iso = iso;
    1927         7017 :   flag_no_asm = iso;
    1928         7017 :   flag_no_gnu_keywords = iso;
    1929         7017 :   flag_no_nonansi_builtin = iso;
    1930         7017 :   flag_isoc94 = c94;
    1931         7017 :   flag_isoc99 = 0;
    1932         7017 :   flag_isoc11 = 0;
    1933         7017 :   flag_isoc23 = 0;
    1934         7017 :   flag_isoc2y = 0;
    1935         7017 :   lang_hooks.name = "GNU C89";
    1936         7017 : }
    1937              : 
    1938              : /* Set the C 99 standard (without GNU extensions if ISO).  */
    1939              : static void
    1940         1229 : set_std_c99 (int iso)
    1941              : {
    1942         1870 :   cpp_set_lang (parse_in, iso ? CLK_STDC99 : CLK_GNUC99);
    1943         1229 :   flag_no_asm = iso;
    1944         1229 :   flag_no_nonansi_builtin = iso;
    1945         1229 :   flag_iso = iso;
    1946         1229 :   flag_isoc2y = 0;
    1947         1229 :   flag_isoc23 = 0;
    1948         1229 :   flag_isoc11 = 0;
    1949         1229 :   flag_isoc99 = 1;
    1950         1229 :   flag_isoc94 = 1;
    1951         1229 :   lang_hooks.name = "GNU C99";
    1952         1229 : }
    1953              : 
    1954              : /* Set the C 11 standard (without GNU extensions if ISO).  */
    1955              : static void
    1956         4240 : set_std_c11 (int iso)
    1957              : {
    1958         7965 :   cpp_set_lang (parse_in, iso ? CLK_STDC11 : CLK_GNUC11);
    1959         4240 :   flag_no_asm = iso;
    1960         4240 :   flag_no_nonansi_builtin = iso;
    1961         4240 :   flag_iso = iso;
    1962         4240 :   flag_isoc2y = 0;
    1963         4240 :   flag_isoc23 = 0;
    1964         4240 :   flag_isoc11 = 1;
    1965         4240 :   flag_isoc99 = 1;
    1966         4240 :   flag_isoc94 = 1;
    1967         4240 :   lang_hooks.name = "GNU C11";
    1968         4240 : }
    1969              : 
    1970              : /* Set the C 17 standard (without GNU extensions if ISO).  */
    1971              : static void
    1972          821 : set_std_c17 (int iso)
    1973              : {
    1974         1599 :   cpp_set_lang (parse_in, iso ? CLK_STDC17 : CLK_GNUC17);
    1975          821 :   flag_no_asm = iso;
    1976          821 :   flag_no_nonansi_builtin = iso;
    1977          821 :   flag_iso = iso;
    1978          821 :   flag_isoc2y = 0;
    1979          821 :   flag_isoc23 = 0;
    1980          821 :   flag_isoc11 = 1;
    1981          821 :   flag_isoc99 = 1;
    1982          821 :   flag_isoc94 = 1;
    1983          821 :   lang_hooks.name = "GNU C17";
    1984          821 : }
    1985              : 
    1986              : /* Set the C 23 standard (without GNU extensions if ISO).  */
    1987              : static void
    1988       117459 : set_std_c23 (int iso)
    1989              : {
    1990       233925 :   cpp_set_lang (parse_in, iso ? CLK_STDC23 : CLK_GNUC23);
    1991       117459 :   flag_no_asm = iso;
    1992       117459 :   flag_no_nonansi_builtin = iso;
    1993       117459 :   flag_iso = iso;
    1994       117459 :   flag_isoc2y = 0;
    1995       117459 :   flag_isoc23 = 1;
    1996       117459 :   flag_isoc11 = 1;
    1997       117459 :   flag_isoc99 = 1;
    1998       117459 :   flag_isoc94 = 1;
    1999       117459 :   lang_hooks.name = "GNU C23";
    2000       117459 : }
    2001              : 
    2002              : /* Set the C 2Y standard (without GNU extensions if ISO).  */
    2003              : static void
    2004          220 : set_std_c2y (int iso)
    2005              : {
    2006          232 :   cpp_set_lang (parse_in, iso ? CLK_STDC2Y : CLK_GNUC2Y);
    2007          220 :   flag_no_asm = iso;
    2008          220 :   flag_no_nonansi_builtin = iso;
    2009          220 :   flag_iso = iso;
    2010          220 :   flag_isoc2y = 1;
    2011          220 :   flag_isoc23 = 1;
    2012          220 :   flag_isoc11 = 1;
    2013          220 :   flag_isoc99 = 1;
    2014          220 :   flag_isoc94 = 1;
    2015          220 :   lang_hooks.name = "GNU C2Y";
    2016          220 : }
    2017              : 
    2018              : 
    2019              : /* Set the C++ 98 standard (without GNU extensions if ISO).  */
    2020              : static void
    2021        14442 : set_std_cxx98 (int iso)
    2022              : {
    2023        19905 :   cpp_set_lang (parse_in, iso ? CLK_CXX98 : CLK_GNUCXX);
    2024        14442 :   flag_no_gnu_keywords = iso;
    2025        14442 :   flag_no_nonansi_builtin = iso;
    2026        14442 :   flag_iso = iso;
    2027        14442 :   flag_isoc94 = 0;
    2028        14442 :   flag_isoc99 = 0;
    2029        14442 :   cxx_dialect = cxx98;
    2030        14442 :   lang_hooks.name = "GNU C++98";
    2031        14442 : }
    2032              : 
    2033              : /* Set the C++ 2011 standard (without GNU extensions if ISO).  */
    2034              : static void
    2035         5806 : set_std_cxx11 (int iso)
    2036              : {
    2037         7285 :   cpp_set_lang (parse_in, iso ? CLK_CXX11 : CLK_GNUCXX11);
    2038         5806 :   flag_no_gnu_keywords = iso;
    2039         5806 :   flag_no_nonansi_builtin = iso;
    2040         5806 :   flag_iso = iso;
    2041              :   /* C++11 includes the C99 standard library.  */
    2042         5806 :   flag_isoc94 = 1;
    2043         5806 :   flag_isoc99 = 1;
    2044         5806 :   cxx_dialect = cxx11;
    2045         5806 :   lang_hooks.name = "GNU C++11";
    2046         5806 : }
    2047              : 
    2048              : /* Set the C++ 2014 standard (without GNU extensions if ISO).  */
    2049              : static void
    2050         1348 : set_std_cxx14 (int iso)
    2051              : {
    2052         1643 :   cpp_set_lang (parse_in, iso ? CLK_CXX14 : CLK_GNUCXX14);
    2053         1348 :   flag_no_gnu_keywords = iso;
    2054         1348 :   flag_no_nonansi_builtin = iso;
    2055         1348 :   flag_iso = iso;
    2056              :   /* C++14 includes the C99 standard library.  */
    2057         1348 :   flag_isoc94 = 1;
    2058         1348 :   flag_isoc99 = 1;
    2059         1348 :   cxx_dialect = cxx14;
    2060         1348 :   lang_hooks.name = "GNU C++14";
    2061         1348 : }
    2062              : 
    2063              : /* Set the C++ 2017 standard (without GNU extensions if ISO).  */
    2064              : static void
    2065         4275 : set_std_cxx17 (int iso)
    2066              : {
    2067         5213 :   cpp_set_lang (parse_in, iso ? CLK_CXX17 : CLK_GNUCXX17);
    2068         4275 :   flag_no_gnu_keywords = iso;
    2069         4275 :   flag_no_nonansi_builtin = iso;
    2070         4275 :   flag_iso = iso;
    2071              :   /* C++17 includes the C11 standard library.  */
    2072         4275 :   flag_isoc94 = 1;
    2073         4275 :   flag_isoc99 = 1;
    2074         4275 :   flag_isoc11 = 1;
    2075         4275 :   cxx_dialect = cxx17;
    2076         4275 :   lang_hooks.name = "GNU C++17";
    2077         4275 : }
    2078              : 
    2079              : /* Set the C++ 2020 standard (without GNU extensions if ISO).  */
    2080              : static void
    2081       135437 : set_std_cxx20 (int iso)
    2082              : {
    2083       253937 :   cpp_set_lang (parse_in, iso ? CLK_CXX20 : CLK_GNUCXX20);
    2084       135437 :   flag_no_gnu_keywords = iso;
    2085       135437 :   flag_no_nonansi_builtin = iso;
    2086       135437 :   flag_iso = iso;
    2087              :   /* C++20 includes the C11 standard library.  */
    2088       135437 :   flag_isoc94 = 1;
    2089       135437 :   flag_isoc99 = 1;
    2090       135437 :   flag_isoc11 = 1;
    2091       135437 :   cxx_dialect = cxx20;
    2092       135437 :   lang_hooks.name = "GNU C++20";
    2093       135437 : }
    2094              : 
    2095              : /* Set the C++ 2023 standard (without GNU extensions if ISO).  */
    2096              : static void
    2097         2225 : set_std_cxx23 (int iso)
    2098              : {
    2099         2819 :   cpp_set_lang (parse_in, iso ? CLK_CXX23 : CLK_GNUCXX23);
    2100         2225 :   flag_no_gnu_keywords = iso;
    2101         2225 :   flag_no_nonansi_builtin = iso;
    2102         2225 :   flag_iso = iso;
    2103              :   /* C++23 includes the C11 standard library.  */
    2104         2225 :   flag_isoc94 = 1;
    2105         2225 :   flag_isoc99 = 1;
    2106         2225 :   flag_isoc11 = 1;
    2107         2225 :   cxx_dialect = cxx23;
    2108         2225 :   lang_hooks.name = "GNU C++23";
    2109         2225 : }
    2110              : 
    2111              : /* Set the C++ 2026 standard (without GNU extensions if ISO).  */
    2112              : static void
    2113         1464 : set_std_cxx26 (int iso)
    2114              : {
    2115         1863 :   cpp_set_lang (parse_in, iso ? CLK_CXX26 : CLK_GNUCXX26);
    2116         1464 :   flag_no_gnu_keywords = iso;
    2117         1464 :   flag_no_nonansi_builtin = iso;
    2118         1464 :   flag_iso = iso;
    2119              :   /* C++26 includes the C11 standard library.  */
    2120         1464 :   flag_isoc94 = 1;
    2121         1464 :   flag_isoc99 = 1;
    2122         1464 :   flag_isoc11 = 1;
    2123         1464 :   cxx_dialect = cxx26;
    2124         1464 :   lang_hooks.name = "GNU C++26";
    2125         1464 : }
    2126              : 
    2127              : /* Set the C++ 2029 standard (without GNU extensions if ISO).  */
    2128              : static void
    2129        24421 : set_std_cxx29 (int iso)
    2130              : {
    2131        31569 :   cpp_set_lang (parse_in, iso ? CLK_CXX29 : CLK_GNUCXX29);
    2132        24421 :   flag_no_gnu_keywords = iso;
    2133        24421 :   flag_no_nonansi_builtin = iso;
    2134        24421 :   flag_iso = iso;
    2135              :   /* C++29 includes the C11 standard library.  */
    2136        24421 :   flag_isoc94 = 1;
    2137        24421 :   flag_isoc99 = 1;
    2138        24421 :   flag_isoc11 = 1;
    2139        24421 :   cxx_dialect = cxx29;
    2140        24421 :   lang_hooks.name = "GNU C++29";
    2141        24421 : }
    2142              : 
    2143              : /* Args to -d specify what to dump.  Silently ignore
    2144              :    unrecognized options; they may be aimed at toplev.cc.  */
    2145              : static void
    2146         1638 : handle_OPT_d (const char *arg)
    2147              : {
    2148         1638 :   char c;
    2149              : 
    2150         3276 :   while ((c = *arg++) != '\0')
    2151         1638 :     switch (c)
    2152              :       {
    2153          781 :       case 'M':                 /* Dump macros only.  */
    2154          781 :       case 'N':                 /* Dump names.  */
    2155          781 :       case 'D':                 /* Dump definitions.  */
    2156          781 :       case 'U':                 /* Dump used macros.  */
    2157          781 :         flag_dump_macros = c;
    2158          781 :         break;
    2159              : 
    2160            2 :       case 'I':
    2161            2 :         flag_dump_includes = 1;
    2162            2 :         break;
    2163              :       }
    2164         1638 : }
        

Generated by: LCOV version 2.6-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.