1 /* C/ObjC/C++ command line option handling.
2 Copyright (C) 2002-2014 Free Software Foundation, Inc.
3 Contributed by Neil Booth.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
27 #include "c-upc-low.h"
29 #include "c-upc-pts.h"
32 #include "langhooks.h"
33 #include "diagnostic.h"
34 #include "tree-diagnostic.h" /* for virt_loc_aware_diagnostic_finalizer */
36 #include "cppdefault.h"
38 #include "debug.h" /* For debug_hooks. */
41 #include "plugin.h" /* For PLUGIN_INCLUDE_FILE event. */
44 #include "tm.h" /* For BYTES_BIG_ENDIAN,
45 DOLLARS_IN_IDENTIFIERS,
46 STDC_0_IN_SYSTEM_HEADERS,
47 TARGET_FLT_EVAL_METHOD_NON_DEFAULT and
49 #include "tm_p.h" /* For C_COMMON_OVERRIDE_OPTIONS. */
52 #ifndef DOLLARS_IN_IDENTIFIERS
53 # define DOLLARS_IN_IDENTIFIERS true
56 #ifndef TARGET_SYSTEM_ROOT
57 # define TARGET_SYSTEM_ROOT NULL
61 #define TARGET_OPTF(ARG)
65 cpp_options
*cpp_opts
;
68 static const char *this_input_filename
;
70 /* Filename and stream for preprocessed output. */
71 static const char *out_fname
;
72 static FILE *out_stream
;
74 /* Append dependencies to deps_file. */
75 static bool deps_append
;
77 /* If dependency switches (-MF etc.) have been given. */
78 static bool deps_seen
;
83 /* Dependency output file. */
84 static const char *deps_file
;
86 /* The prefix given by -iprefix, if any. */
87 static const char *iprefix
;
89 /* The multilib directory given by -imultilib, if any. */
90 static const char *imultilib
;
92 /* The system root, if any. Overridden by -isysroot. */
93 static const char *sysroot
= TARGET_SYSTEM_ROOT
;
95 /* Zero disables all standard directories for headers. */
96 static bool std_inc
= true;
98 /* Zero disables the C++-specific standard directories for headers. */
99 static bool std_cxx_inc
= true;
101 /* If the quote chain has been split by -I-. */
102 static bool quote_chain_split
;
104 /* Number of deferred options. */
105 static size_t deferred_count
;
107 /* Number of deferred options scanned for -include. */
108 static size_t include_cursor
;
110 /* Dump files/flags to use during parsing. */
111 static FILE *original_dump_file
= NULL
;
112 static int original_dump_flags
;
113 static FILE *class_dump_file
= NULL
;
114 static int class_dump_flags
;
116 /* Whether any standard preincluded header has been preincluded. */
117 static bool done_preinclude
;
119 static void handle_OPT_d (const char *);
120 static void set_std_cxx98 (int);
121 static void set_std_cxx11 (int);
122 static void set_std_cxx14 (int);
123 static void set_std_cxx1z (int);
124 static void set_std_c89 (int, int);
125 static void set_std_c99 (int);
126 static void set_std_c11 (int);
127 static void check_deps_environment_vars (void);
128 static void handle_deferred_opts (void);
129 static void sanitize_cpp_opts (void);
130 static void add_prefixed_path (const char *, size_t);
131 static void push_command_line_include (void);
132 static void cb_file_change (cpp_reader
*, const struct line_map
*);
133 static void cb_dir_change (cpp_reader
*, const char *);
134 static void c_finish_options (void);
136 #ifndef STDC_0_IN_SYSTEM_HEADERS
137 #define STDC_0_IN_SYSTEM_HEADERS 0
140 /* Holds switches parsed by c_common_handle_option (), but whose
141 handling is deferred to c_common_post_options (). */
142 static void defer_opt (enum opt_code
, const char *);
143 static struct deferred_opt
150 extern const unsigned int
151 c_family_lang_mask
= (CL_C
| CL_CXX
| CL_ObjC
| CL_ObjCXX
);
153 /* Defer option CODE with argument ARG. */
155 defer_opt (enum opt_code code
, const char *arg
)
157 deferred_opts
[deferred_count
].code
= code
;
158 deferred_opts
[deferred_count
].arg
= arg
;
162 /* Return language mask for option parsing. */
164 c_common_option_lang_mask (void)
166 static const unsigned int lang_flags
[] = {CL_C
, CL_ObjC
, CL_CXX
, CL_ObjCXX
};
167 return lang_flags
[c_language
];
170 /* Diagnostic finalizer for C/C++/Objective-C/Objective-C++. */
172 c_diagnostic_finalizer (diagnostic_context
*context
,
173 diagnostic_info
*diagnostic
)
175 diagnostic_show_locus (context
, diagnostic
);
176 /* By default print macro expansion contexts in the diagnostic
177 finalizer -- for tokens resulting from macro expansion. */
178 virt_loc_aware_diagnostic_finalizer (context
, diagnostic
);
179 pp_destroy_prefix (context
->printer
);
180 pp_newline_and_flush (context
->printer
);
183 /* Common diagnostics initialization. */
185 c_common_initialize_diagnostics (diagnostic_context
*context
)
187 /* This is conditionalized only because that is the way the front
188 ends used to do it. Maybe this should be unconditional? */
189 if (c_dialect_cxx ())
191 /* By default wrap lines at 80 characters. Is getenv
192 ("COLUMNS") preferable? */
193 diagnostic_line_cutoff (context
) = 80;
194 /* By default, emit location information once for every
195 diagnostic message. */
196 diagnostic_prefixing_rule (context
) = DIAGNOSTICS_SHOW_PREFIX_ONCE
;
198 diagnostic_finalizer (context
) = c_diagnostic_finalizer
;
199 context
->opt_permissive
= OPT_fpermissive
;
202 /* Whether options from all C-family languages should be accepted
204 static bool accept_all_c_family_options
= false;
206 /* Return whether to complain about a wrong-language option. */
208 c_common_complain_wrong_lang_p (const struct cl_option
*option
)
210 if (accept_all_c_family_options
211 && (option
->flags
& c_family_lang_mask
))
217 /* Initialize options structure OPTS. */
219 c_common_init_options_struct (struct gcc_options
*opts
)
221 opts
->x_flag_exceptions
= c_dialect_cxx ();
222 opts
->x_warn_pointer_arith
= c_dialect_cxx ();
223 opts
->x_warn_write_strings
= c_dialect_cxx ();
224 opts
->x_flag_warn_unused_result
= true;
226 /* By default, C99-like requirements for complex multiply and divide. */
227 opts
->x_flag_complex_method
= 2;
230 /* Initialize UPC-specific options. */
234 struct cl_option_handlers handlers
;
236 /* UPC is based upon the C99 dialect. Assert it here.
237 * We'll let the user override these options as he/she
238 * sees fit. For example, -traditional will disable
239 * prototype checking. */
240 set_std_c99 ( 0 /* iso=0 */ );
242 /* The consensus of the UPC community seems to be that
243 arithmetic on (void *) pointers and sizeof (void)
244 are compilation errors. Enable this warning-as-error
246 warn_pointer_arith
= 1;
247 set_default_handlers (&handlers
);
248 control_warning_option (OPT_Wpointer_arith
, (int) DK_ERROR
, true,
249 UNKNOWN_LOCATION
, CL_C
,
250 &handlers
, &global_options
, &global_options_set
,
253 #ifdef ENABLE_UPC_DWARF2_SUPPORT
254 /* Some targets support UPC's DWARF2 extensions by default. */
255 use_upc_dwarf2_extensions
= 1;
257 use_upc_dwarf2_extensions
= 0;
261 flag_upc_threads
= 0;
262 flag_upc_pthreads
= 0;
263 /* By default, don't map UPC threads to POSIX threads. */
264 flag_upc_pthreads
= 0;
265 upc_pthreads_model
= upc_pthreads_no_model
;
266 /* By default, GASP profiling is off. */
267 flag_upc_instrument
= 0;
268 flag_upc_instrument_functions
= 0;
269 /* By default, optimization level > 0 defines shared access routines
270 inlining, otherwise use the user specified flag for unconditional
271 enable/disable of inlining (0 - disable, 1 - enable). */
272 flag_upc_inline_lib
= -1;
273 /* Disable section anchors. The presence of an unshared equivalent of the
274 shared variables causes a double definition of the symbol names in the
276 flag_section_anchors
= 0;
279 /* Common initialization before calling option handlers. */
281 c_common_init_options (unsigned int decoded_options_count
,
282 struct cl_decoded_option
*decoded_options
)
285 struct cpp_callbacks
*cb
;
287 parse_in
= cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX
: CLK_GNUC89
,
288 ident_hash
, line_table
);
289 cb
= cpp_get_callbacks (parse_in
);
290 cb
->error
= c_cpp_error
;
292 cpp_opts
= cpp_get_options (parse_in
);
293 cpp_opts
->dollars_in_ident
= DOLLARS_IN_IDENTIFIERS
;
294 cpp_opts
->objc
= c_dialect_objc ();
296 /* Reset to avoid warnings on internal definitions. We set it just
297 before passing on command-line options to cpplib. */
298 cpp_opts
->warn_dollars
= 0;
300 deferred_opts
= XNEWVEC (struct deferred_opt
, decoded_options_count
);
302 if (c_language
== clk_c
)
304 for (i
= 1; i
< decoded_options_count
; i
++)
306 /* If preprocessing assembly language, accept any of the C-family
307 front end options since the driver may pass them through. */
308 if (decoded_options
[i
].opt_index
== OPT_lang_asm
)
310 accept_all_c_family_options
= true;
313 /* If compiling UPC, initialize appropriate default options. */
314 if (decoded_options
[i
].opt_index
== OPT_fupc
)
323 /* Process UPC specific command line switches */
326 upc_handle_option (const enum opt_code code
, const char *arg
, const int value
)
331 error ("%s is supported only when -fupc is also present", arg
);
342 case OPT_dwarf_2_upc
:
343 use_upc_dwarf2_extensions
= value
;
346 if ((value
== 1) && (flag_upc_inline_lib
== 1))
347 error ("-fupc-debug is incompatible with -fupc-inline-lib");
348 flag_upc_debug
= value
;
350 case OPT_fupc_inline_lib
:
351 if ((value
== 1) && (flag_upc_instrument
== 1))
352 error ("-fupc-inline-lib is incompatible with -fupc-instrument");
353 if ((value
== 1) && (flag_upc_debug
== 1))
354 error ("-fupc-inline-lib is incompatible with -fupc-debug");
355 flag_upc_inline_lib
= value
;
357 case OPT_fupc_instrument
:
358 if ((value
== 1) && (flag_upc_inline_lib
== 1))
359 error ("-fupc-instrument is incompatible with -fupc-inline-lib");
360 flag_upc_instrument
= value
;
362 case OPT_fupc_instrument_functions
:
363 if ((value
== 1) && (flag_upc_inline_lib
== 1))
365 ("-fupc-instrument-functions is incompatible "
366 "with -fupc-inline-lib");
367 flag_upc_instrument
= value
;
368 flag_upc_instrument_functions
= value
;
370 case OPT_fupc_pthreads_model_tls
:
371 flag_upc_pthreads
= 1;
372 upc_pthreads_model
= upc_pthreads_tls_model
;
374 case OPT_fupc_threads_
:
376 int num_threads
= value
;
377 if (num_threads
> UPC_MAX_THREADS
)
379 error ("THREADS value exceeds UPC implementation limit of %d",
383 flag_upc_threads
= num_threads
;
390 /* Handle switch SCODE with argument ARG. VALUE is true, unless no-
391 form of an -f or -W option was given. Returns false if the switch was
392 invalid, true if valid. Use HANDLERS in recursive handle_option calls. */
394 c_common_handle_option (size_t scode
, const char *arg
, int value
,
395 int kind
, location_t loc
,
396 const struct cl_option_handlers
*handlers
)
398 const struct cl_option
*option
= &cl_options
[scode
];
399 enum opt_code code
= (enum opt_code
) scode
;
402 /* Prevent resetting the language standard to a C dialect when the driver
403 has already determined that we're looking at assembler input. */
404 bool preprocessing_asm_p
= (cpp_get_options (parse_in
)->lang
== CLK_ASM
);
409 if (cl_options
[code
].flags
& c_family_lang_mask
)
411 if ((option
->flags
& CL_TARGET
)
412 && ! targetcm
.handle_c_option (scode
, arg
, value
))
419 case OPT__output_pch_
:
424 defer_opt (code
, arg
);
428 cpp_opts
->discard_comments
= 0;
432 cpp_opts
->discard_comments
= 0;
433 cpp_opts
->discard_comments_in_macro_exp
= 0;
437 defer_opt (code
, arg
);
441 cpp_opts
->print_include_names
= 1;
445 TARGET_OPTF (xstrdup (arg
));
449 if (strcmp (arg
, "-"))
450 add_path (xstrdup (arg
), BRACKET
, 0, true);
453 if (quote_chain_split
)
454 error ("-I- specified twice");
455 quote_chain_split
= true;
456 split_quote_chain ();
457 inform (input_location
, "obsolete option -I- used, please use -iquote instead");
463 /* When doing dependencies with -M or -MM, suppress normal
464 preprocessed output, but still do -dM etc. as software
465 depends on this. Preprocessed output does occur if -MD, -MMD
466 or environment var dependency generation is used. */
467 cpp_opts
->deps
.style
= (code
== OPT_M
? DEPS_SYSTEM
: DEPS_USER
);
473 cpp_opts
->deps
.style
= (code
== OPT_MD
? DEPS_SYSTEM
: DEPS_USER
);
474 cpp_opts
->deps
.need_preprocessor_output
= true;
485 cpp_opts
->deps
.missing_files
= true;
490 cpp_opts
->deps
.phony_targets
= true;
496 defer_opt (code
, arg
);
500 flag_no_line_commands
= 1;
504 defer_opt (code
, arg
);
508 /* ??? Don't add new options here. Use LangEnabledBy in c.opt. */
510 cpp_opts
->warn_num_sign_change
= value
;
513 case OPT_Wc___compat
:
514 cpp_opts
->warn_cxx_operator_names
= value
;
518 cpp_opts
->cpp_warn_long_long
= value
;
521 case OPT_Wnormalized_
:
522 /* FIXME: Move all this to c.opt. */
523 if (kind
== DK_ERROR
)
526 inform (input_location
, "-Werror=normalized=: set -Wnormalized=nfc");
527 cpp_opts
->warn_normalize
= normalized_C
;
531 if (!value
|| (arg
&& strcasecmp (arg
, "none") == 0))
532 cpp_opts
->warn_normalize
= normalized_none
;
533 else if (!arg
|| strcasecmp (arg
, "nfkc") == 0)
534 cpp_opts
->warn_normalize
= normalized_KC
;
535 else if (strcasecmp (arg
, "id") == 0)
536 cpp_opts
->warn_normalize
= normalized_identifier_C
;
537 else if (strcasecmp (arg
, "nfc") == 0)
538 cpp_opts
->warn_normalize
= normalized_C
;
540 error ("argument %qs to %<-Wnormalized%> not recognized", arg
);
544 case OPT_Wtraditional
:
545 cpp_opts
->cpp_warn_traditional
= value
;
548 case OPT_Wunknown_pragmas
:
549 /* Set to greater than 1, so that even unknown pragmas in
550 system headers will be warned about. */
551 /* ??? There is no way to handle this automatically for now. */
552 warn_unknown_pragmas
= value
* 2;
556 if (!c_dialect_cxx ())
557 set_std_c89 (false, true);
559 set_std_cxx98 (true);
570 warning (0, "%<-Wabi=1%> is not supported, using =2");
573 flag_abi_compat_version
= value
;
576 case OPT_fcanonical_system_headers
:
577 cpp_opts
->canonical_system_headers
= value
;
580 case OPT_fcond_mismatch
:
581 if (!c_dialect_cxx ())
583 flag_cond_mismatch
= value
;
586 warning (0, "switch %qs is no longer supported", option
->opt_text
);
593 disable_builtin_function (arg
);
596 case OPT_fdirectives_only
:
597 cpp_opts
->directives_only
= value
;
600 case OPT_fdollars_in_identifiers
:
601 cpp_opts
->dollars_in_ident
= value
;
604 case OPT_ffreestanding
:
606 /* Fall through.... */
609 flag_no_builtin
= !value
;
612 case OPT_fconstant_string_class_
:
613 constant_string_class_name
= arg
;
616 case OPT_fextended_identifiers
:
617 cpp_opts
->extended_identifiers
= value
;
620 case OPT_foperator_names
:
621 cpp_opts
->operator_names
= value
;
625 cpp_opts
->restore_pch_deps
= value
;
628 case OPT_fpch_preprocess
:
629 flag_pch_preprocess
= value
;
632 case OPT_fpermissive
:
633 flag_permissive
= value
;
634 global_dc
->permissive
= value
;
637 case OPT_fpreprocessed
:
638 cpp_opts
->preprocessed
= value
;
645 case OPT_ftrack_macro_expansion
:
650 case OPT_ftrack_macro_expansion_
:
651 if (arg
&& *arg
!= '\0')
652 cpp_opts
->track_macro_expansion
= value
;
654 cpp_opts
->track_macro_expansion
= 2;
658 flag_use_repository
= value
;
660 flag_implicit_templates
= 0;
664 /* It is documented that we silently ignore silly values. */
665 if (value
>= 1 && value
<= 100)
666 cpp_opts
->tabstop
= value
;
669 case OPT_fexec_charset_
:
670 cpp_opts
->narrow_charset
= arg
;
673 case OPT_fwide_exec_charset_
:
674 cpp_opts
->wide_charset
= arg
;
677 case OPT_finput_charset_
:
678 cpp_opts
->input_charset
= arg
;
681 case OPT_ftemplate_depth_
:
682 max_tinst_depth
= value
;
685 case OPT_fvisibility_inlines_hidden
:
686 visibility_options
.inlines_hidden
= value
;
689 case OPT_femit_struct_debug_baseonly
:
690 set_struct_debug_option (&global_options
, loc
, "base");
693 case OPT_femit_struct_debug_reduced
:
694 set_struct_debug_option (&global_options
, loc
,
695 "dir:ord:sys,dir:gen:any,ind:base");
698 case OPT_femit_struct_debug_detailed_
:
699 set_struct_debug_option (&global_options
, loc
, arg
);
702 case OPT_fext_numeric_literals
:
703 cpp_opts
->ext_numeric_literals
= value
;
707 case OPT_dwarf_2_upc
:
709 case OPT_fupc_inline_lib
:
710 case OPT_fupc_instrument
:
711 case OPT_fupc_instrument_functions
:
712 case OPT_fupc_pthreads_model_tls
:
713 case OPT_fupc_threads_
:
714 result
= upc_handle_option (code
, arg
, value
);
718 add_path (xstrdup (arg
), AFTER
, 0, true);
723 defer_opt (code
, arg
);
735 add_path (xstrdup (arg
), QUOTE
, 0, true);
743 add_path (xstrdup (arg
), SYSTEM
, 0, true);
746 case OPT_iwithprefix
:
747 add_prefixed_path (arg
, SYSTEM
);
750 case OPT_iwithprefixbefore
:
751 add_prefixed_path (arg
, BRACKET
);
755 cpp_set_lang (parse_in
, CLK_ASM
);
756 cpp_opts
->dollars_in_ident
= false;
771 error ("output filename specified twice");
774 /* We need to handle the -Wpedantic switch here, rather than in
775 c_common_post_options, so that a subsequent -Wno-endif-labels
776 is not overridden. */
778 cpp_opts
->cpp_pedantic
= 1;
779 cpp_opts
->warn_endif_labels
= 1;
782 case OPT_print_objc_runtime_info
:
783 print_struct_values
= 1;
791 case OPT_std_gnu__98
:
792 if (!preprocessing_asm_p
)
793 set_std_cxx98 (code
== OPT_std_c__98
/* ISO */);
797 case OPT_std_gnu__11
:
798 if (!preprocessing_asm_p
)
800 set_std_cxx11 (code
== OPT_std_c__11
/* ISO */);
801 if (code
== OPT_std_c__11
)
802 cpp_opts
->ext_numeric_literals
= 0;
807 case OPT_std_gnu__14
:
808 if (!preprocessing_asm_p
)
810 set_std_cxx14 (code
== OPT_std_c__14
/* ISO */);
811 if (code
== OPT_std_c__14
)
812 cpp_opts
->ext_numeric_literals
= 0;
817 case OPT_std_gnu__1z
:
818 if (!preprocessing_asm_p
)
820 set_std_cxx1z (code
== OPT_std_c__1z
/* ISO */);
821 if (code
== OPT_std_c__1z
)
822 cpp_opts
->ext_numeric_literals
= 0;
827 case OPT_std_iso9899_199409
:
828 if (!preprocessing_asm_p
)
829 set_std_c89 (code
== OPT_std_iso9899_199409
/* c94 */, true /* ISO */);
833 if (!preprocessing_asm_p
)
834 set_std_c89 (false /* c94 */, false /* ISO */);
838 if (!preprocessing_asm_p
)
839 set_std_c99 (true /* ISO */);
843 if (!preprocessing_asm_p
)
844 set_std_c99 (false /* ISO */);
848 if (!preprocessing_asm_p
)
849 set_std_c11 (true /* ISO */);
853 if (!preprocessing_asm_p
)
854 set_std_c11 (false /* ISO */);
858 cpp_opts
->trigraphs
= 1;
861 case OPT_traditional_cpp
:
862 cpp_opts
->traditional
= 1;
877 C_handle_option_auto (&global_options
, &global_options_set
,
879 c_family_lang_mask
, kind
,
880 loc
, handlers
, global_dc
);
884 ObjC_handle_option_auto (&global_options
, &global_options_set
,
886 c_family_lang_mask
, kind
,
887 loc
, handlers
, global_dc
);
891 CXX_handle_option_auto (&global_options
, &global_options_set
,
893 c_family_lang_mask
, kind
,
894 loc
, handlers
, global_dc
);
898 ObjCXX_handle_option_auto (&global_options
, &global_options_set
,
900 c_family_lang_mask
, kind
,
901 loc
, handlers
, global_dc
);
908 cpp_handle_option_auto (&global_options
, scode
, cpp_opts
);
912 /* Default implementation of TARGET_HANDLE_C_OPTION. */
915 default_handle_c_option (size_t code ATTRIBUTE_UNUSED
,
916 const char *arg ATTRIBUTE_UNUSED
,
917 int value ATTRIBUTE_UNUSED
)
922 /* Post-switch processing. */
924 c_common_post_options (const char **pfilename
)
926 struct cpp_callbacks
*cb
;
928 /* Canonicalize the input and output filenames. */
929 if (in_fnames
== NULL
)
931 in_fnames
= XNEWVEC (const char *, 1);
934 else if (strcmp (in_fnames
[0], "-") == 0)
937 if (out_fname
== NULL
|| !strcmp (out_fname
, "-"))
940 if (cpp_opts
->deps
.style
== DEPS_NONE
)
941 check_deps_environment_vars ();
943 handle_deferred_opts ();
945 sanitize_cpp_opts ();
947 register_include_chains (parse_in
, sysroot
, iprefix
, imultilib
,
948 std_inc
, std_cxx_inc
&& c_dialect_cxx (), verbose
);
950 #ifdef C_COMMON_OVERRIDE_OPTIONS
951 /* Some machines may reject certain combinations of C
952 language-specific options. */
953 C_COMMON_OVERRIDE_OPTIONS
;
956 /* Excess precision other than "fast" requires front-end
958 if (c_dialect_cxx ())
960 if (flag_excess_precision_cmdline
== EXCESS_PRECISION_STANDARD
961 && TARGET_FLT_EVAL_METHOD_NON_DEFAULT
)
962 sorry ("-fexcess-precision=standard for C++");
963 flag_excess_precision_cmdline
= EXCESS_PRECISION_FAST
;
965 else if (flag_excess_precision_cmdline
== EXCESS_PRECISION_DEFAULT
)
966 flag_excess_precision_cmdline
= (flag_iso
967 ? EXCESS_PRECISION_STANDARD
968 : EXCESS_PRECISION_FAST
);
970 /* ISO C restricts floating-point expression contraction to within
971 source-language expressions (-ffp-contract=on, currently an alias
972 for -ffp-contract=off). */
975 && (global_options_set
.x_flag_fp_contract_mode
976 == (enum fp_contract_mode
) 0)
977 && flag_unsafe_math_optimizations
== 0)
978 flag_fp_contract_mode
= FP_CONTRACT_OFF
;
980 /* By default we use C99 inline semantics in GNU99 or C99 mode. C99
981 inline semantics are not supported in GNU89 or C89 mode. */
982 if (flag_gnu89_inline
== -1)
983 flag_gnu89_inline
= !flag_isoc99
;
984 else if (!flag_gnu89_inline
&& !flag_isoc99
)
985 error ("-fno-gnu89-inline is only supported in GNU99 or C99 mode");
987 /* Default to ObjC sjlj exception handling if NeXT runtime. */
988 if (flag_objc_sjlj_exceptions
< 0)
989 flag_objc_sjlj_exceptions
= flag_next_runtime
;
990 if (flag_objc_exceptions
&& !flag_objc_sjlj_exceptions
)
993 /* If -ffreestanding, -fno-hosted or -fno-builtin then disable
994 pattern recognition. */
995 if (!global_options_set
.x_flag_tree_loop_distribute_patterns
997 flag_tree_loop_distribute_patterns
= 0;
999 /* -Woverlength-strings is off by default, but is enabled by -Wpedantic.
1000 It is never enabled in C++, as the minimum limit is not normative
1001 in that standard. */
1002 if (c_dialect_cxx ())
1003 warn_overlength_strings
= 0;
1005 /* Wmain is enabled by default in C++ but not in C. */
1006 /* Wmain is disabled by default for -ffreestanding (!flag_hosted),
1007 even if -Wall or -Wpedantic was given (warn_main will be 2 if set
1008 by -Wall, 1 if set by -Wmain). */
1009 if (warn_main
== -1)
1010 warn_main
= (c_dialect_cxx () && flag_hosted
) ? 1 : 0;
1011 else if (warn_main
== 2)
1012 warn_main
= flag_hosted
? 1 : 0;
1014 /* In C, -Wall and -Wc++-compat enable -Wenum-compare; if it has not
1015 yet been set, it is disabled by default. In C++, it is enabled
1017 if (warn_enum_compare
== -1)
1018 warn_enum_compare
= c_dialect_cxx () ? 1 : 0;
1020 /* -Wpacked-bitfield-compat is on by default for the C languages. The
1021 warning is issued in stor-layout.c which is not part of the front-end so
1022 we need to selectively turn it on here. */
1023 if (warn_packed_bitfield_compat
== -1)
1024 warn_packed_bitfield_compat
= 1;
1026 /* Special format checking options don't work without -Wformat; warn if
1030 warning (OPT_Wformat_y2k
,
1031 "-Wformat-y2k ignored without -Wformat");
1032 warning (OPT_Wformat_extra_args
,
1033 "-Wformat-extra-args ignored without -Wformat");
1034 warning (OPT_Wformat_zero_length
,
1035 "-Wformat-zero-length ignored without -Wformat");
1036 warning (OPT_Wformat_nonliteral
,
1037 "-Wformat-nonliteral ignored without -Wformat");
1038 warning (OPT_Wformat_contains_nul
,
1039 "-Wformat-contains-nul ignored without -Wformat");
1040 warning (OPT_Wformat_security
,
1041 "-Wformat-security ignored without -Wformat");
1044 /* -Wimplicit-function-declaration is enabled by default for C99. */
1045 if (warn_implicit_function_declaration
== -1)
1046 warn_implicit_function_declaration
= flag_isoc99
;
1048 /* Declone C++ 'structors if -Os. */
1049 if (flag_declone_ctor_dtor
== -1)
1050 flag_declone_ctor_dtor
= optimize_size
;
1052 if (flag_abi_compat_version
== 1)
1054 warning (0, "%<-fabi-compat-version=1%> is not supported, using =2");
1055 flag_abi_compat_version
= 2;
1057 else if (flag_abi_compat_version
== -1)
1059 /* Generate compatibility aliases for ABI v2 (3.4-4.9) by default. */
1060 flag_abi_compat_version
= (flag_abi_version
== 0 ? 2 : 0);
1062 /* But don't warn about backward compatibility unless explicitly
1063 requested with -Wabi=n. */
1064 if (flag_abi_version
== 0)
1068 if (cxx_dialect
>= cxx11
)
1070 /* If we're allowing C++0x constructs, don't warn about C++98
1071 identifiers which are keywords in C++0x. */
1072 warn_cxx0x_compat
= 0;
1074 if (warn_narrowing
== -1)
1077 else if (warn_narrowing
== -1)
1080 if (flag_extern_tls_init
)
1082 #if !defined (ASM_OUTPUT_DEF) || !SUPPORTS_WEAK
1083 /* Lazy TLS initialization for a variable in another TU requires
1084 alias and weak reference support. */
1085 if (flag_extern_tls_init
> 0)
1086 sorry ("external TLS initialization functions not supported "
1088 flag_extern_tls_init
= 0;
1090 flag_extern_tls_init
= 1;
1094 if (flag_preprocess_only
)
1096 /* Open the output now. We must do so even if flag_no_output is
1097 on, because there may be other output than from the actual
1098 preprocessing (e.g. from -dM). */
1099 if (out_fname
[0] == '\0')
1100 out_stream
= stdout
;
1102 out_stream
= fopen (out_fname
, "w");
1104 if (out_stream
== NULL
)
1106 fatal_error ("opening output file %s: %m", out_fname
);
1110 if (num_in_fnames
> 1)
1111 error ("too many filenames given. Type %s --help for usage",
1114 init_pp_output (out_stream
);
1120 /* When writing a PCH file, avoid reading some other PCH file,
1121 because the default address space slot then can't be used
1122 for the output PCH file. */
1125 c_common_no_more_pch ();
1126 /* Only -g0 and -gdwarf* are supported with PCH, for other
1127 debug formats we warn here and refuse to load any PCH files. */
1128 if (write_symbols
!= NO_DEBUG
&& write_symbols
!= DWARF2_DEBUG
)
1129 warning (OPT_Wdeprecated
,
1130 "the \"%s\" debug format cannot be used with "
1131 "pre-compiled headers", debug_type_names
[write_symbols
]);
1133 else if (write_symbols
!= NO_DEBUG
&& write_symbols
!= DWARF2_DEBUG
)
1134 c_common_no_more_pch ();
1136 /* Yuk. WTF is this? I do know ObjC relies on it somewhere. */
1137 input_location
= UNKNOWN_LOCATION
;
1140 cb
= cpp_get_callbacks (parse_in
);
1141 cb
->file_change
= cb_file_change
;
1142 cb
->dir_change
= cb_dir_change
;
1143 cpp_post_options (parse_in
);
1144 init_global_opts_from_cpp (&global_options
, cpp_get_options (parse_in
));
1146 input_location
= UNKNOWN_LOCATION
;
1148 *pfilename
= this_input_filename
1149 = cpp_read_main_file (parse_in
, in_fnames
[0]);
1150 /* Don't do any compilation or preprocessing if there is no input file. */
1151 if (this_input_filename
== NULL
)
1157 if (flag_working_directory
1158 && flag_preprocess_only
&& !flag_no_line_commands
)
1159 pp_dir_change (parse_in
, get_src_pwd ());
1161 /* Disable LTO output when outputting a precompiled header. */
1162 if (pch_file
&& flag_lto
)
1165 flag_generate_lto
= 0;
1168 return flag_preprocess_only
;
1171 /* Front end initialization common to C, ObjC and C++. */
1173 c_common_init (void)
1175 /* Set up preprocessor arithmetic. Must be done after call to
1176 c_common_nodes_and_builtins for type nodes to be good. */
1177 cpp_opts
->precision
= TYPE_PRECISION (intmax_type_node
);
1178 cpp_opts
->char_precision
= TYPE_PRECISION (char_type_node
);
1179 cpp_opts
->int_precision
= TYPE_PRECISION (integer_type_node
);
1180 cpp_opts
->wchar_precision
= TYPE_PRECISION (wchar_type_node
);
1181 cpp_opts
->unsigned_wchar
= TYPE_UNSIGNED (wchar_type_node
);
1182 cpp_opts
->bytes_big_endian
= BYTES_BIG_ENDIAN
;
1184 /* This can't happen until after wchar_precision and bytes_big_endian
1186 cpp_init_iconv (parse_in
);
1191 fputs ("Compiler executable checksum: ", stderr
);
1192 for (i
= 0; i
< 16; i
++)
1193 fprintf (stderr
, "%02x", executable_checksum
[i
]);
1194 putc ('\n', stderr
);
1197 /* Has to wait until now so that cpplib has its hash table. */
1200 if (flag_preprocess_only
)
1202 c_finish_options ();
1203 preprocess_file (parse_in
);
1210 /* Initialize the integrated preprocessor after debug output has been
1211 initialized; loop over each input file. */
1213 c_common_parse_file (void)
1220 c_finish_options ();
1221 /* Open the dump files to use for the original and class dump output
1222 here, to be used during parsing for the current file. */
1223 original_dump_file
= dump_begin (TDI_original
, &original_dump_flags
);
1224 class_dump_file
= dump_begin (TDI_class
, &class_dump_flags
);
1228 /* Generate UPC global initialization code, if required. */
1230 upc_write_global_declarations ();
1232 /* And end the main input file, if the debug writer wants it */
1233 if (debug_hooks
->start_end_main_source_file
)
1234 (*debug_hooks
->end_source_file
) (0);
1235 if (++i
>= num_in_fnames
)
1237 cpp_undef_all (parse_in
);
1238 cpp_clear_file_cache (parse_in
);
1240 = cpp_read_main_file (parse_in
, in_fnames
[i
]);
1241 if (original_dump_file
)
1243 dump_end (TDI_original
, original_dump_file
);
1244 original_dump_file
= NULL
;
1246 if (class_dump_file
)
1248 dump_end (TDI_class
, class_dump_file
);
1249 class_dump_file
= NULL
;
1251 /* If an input file is missing, abandon further compilation.
1252 cpplib has issued a diagnostic. */
1253 if (!this_input_filename
)
1258 /* Returns the appropriate dump file for PHASE to dump with FLAGS. */
1260 get_dump_info (int phase
, int *flags
)
1262 gcc_assert (phase
== TDI_original
|| phase
== TDI_class
);
1263 if (phase
== TDI_original
)
1265 *flags
= original_dump_flags
;
1266 return original_dump_file
;
1270 *flags
= class_dump_flags
;
1271 return class_dump_file
;
1275 /* Common finish hook for the C, ObjC and C++ front ends. */
1277 c_common_finish (void)
1279 FILE *deps_stream
= NULL
;
1281 /* Don't write the deps file if there are errors. */
1282 if (cpp_opts
->deps
.style
!= DEPS_NONE
&& !seen_error ())
1284 /* If -M or -MM was seen without -MF, default output to the
1287 deps_stream
= out_stream
;
1290 deps_stream
= fopen (deps_file
, deps_append
? "a": "w");
1292 fatal_error ("opening dependency file %s: %m", deps_file
);
1296 /* For performance, avoid tearing down cpplib's internal structures
1297 with cpp_destroy (). */
1298 cpp_finish (parse_in
, deps_stream
);
1300 if (deps_stream
&& deps_stream
!= out_stream
1301 && (ferror (deps_stream
) || fclose (deps_stream
)))
1302 fatal_error ("closing dependency file %s: %m", deps_file
);
1304 if (out_stream
&& (ferror (out_stream
) || fclose (out_stream
)))
1305 fatal_error ("when writing output to %s: %m", out_fname
);
1308 /* Either of two environment variables can specify output of
1309 dependencies. Their value is either "OUTPUT_FILE" or "OUTPUT_FILE
1310 DEPS_TARGET", where OUTPUT_FILE is the file to write deps info to
1311 and DEPS_TARGET is the target to mention in the deps. They also
1312 result in dependency information being appended to the output file
1313 rather than overwriting it, and like Sun's compiler
1314 SUNPRO_DEPENDENCIES suppresses the dependency on the main file. */
1316 check_deps_environment_vars (void)
1320 spec
= getenv ("DEPENDENCIES_OUTPUT");
1322 cpp_opts
->deps
.style
= DEPS_USER
;
1325 spec
= getenv ("SUNPRO_DEPENDENCIES");
1328 cpp_opts
->deps
.style
= DEPS_SYSTEM
;
1329 cpp_opts
->deps
.ignore_main_file
= true;
1335 /* Find the space before the DEPS_TARGET, if there is one. */
1336 char *s
= strchr (spec
, ' ');
1339 /* Let the caller perform MAKE quoting. */
1340 defer_opt (OPT_MT
, s
+ 1);
1344 /* Command line -MF overrides environment variables and default. */
1353 /* Handle deferred command line switches. */
1355 handle_deferred_opts (void)
1360 /* Avoid allocating the deps buffer if we don't need it.
1361 (This flag may be true without there having been -MT or -MQ
1362 options, but we'll still need the deps buffer.) */
1366 deps
= cpp_get_deps (parse_in
);
1368 for (i
= 0; i
< deferred_count
; i
++)
1370 struct deferred_opt
*opt
= &deferred_opts
[i
];
1372 if (opt
->code
== OPT_MT
|| opt
->code
== OPT_MQ
)
1373 deps_add_target (deps
, opt
->arg
, opt
->code
== OPT_MQ
);
1377 /* These settings are appropriate for GCC, but not necessarily so for
1378 cpplib as a library. */
1380 sanitize_cpp_opts (void)
1382 /* If we don't know what style of dependencies to output, complain
1383 if any other dependency switches have been given. */
1384 if (deps_seen
&& cpp_opts
->deps
.style
== DEPS_NONE
)
1385 error ("to generate dependencies you must specify either -M or -MM");
1387 /* -dM and dependencies suppress normal output; do it here so that
1388 the last -d[MDN] switch overrides earlier ones. */
1389 if (flag_dump_macros
== 'M')
1392 /* By default, -fdirectives-only implies -dD. This allows subsequent phases
1393 to perform proper macro expansion. */
1394 if (cpp_opts
->directives_only
&& !cpp_opts
->preprocessed
&& !flag_dump_macros
)
1395 flag_dump_macros
= 'D';
1397 /* Disable -dD, -dN and -dI if normal output is suppressed. Allow
1398 -dM since at least glibc relies on -M -dM to work. */
1399 /* Also, flag_no_output implies flag_no_line_commands, always. */
1402 if (flag_dump_macros
!= 'M')
1403 flag_dump_macros
= 0;
1404 flag_dump_includes
= 0;
1405 flag_no_line_commands
= 1;
1407 else if (cpp_opts
->deps
.missing_files
)
1408 error ("-MG may only be used with -M or -MM");
1410 cpp_opts
->unsigned_char
= !flag_signed_char
;
1411 cpp_opts
->stdc_0_in_system_headers
= STDC_0_IN_SYSTEM_HEADERS
;
1412 cpp_opts
->cpp_warn_c90_c99_compat
= warn_c90_c99_compat
;
1414 /* Wlong-long is disabled by default. It is enabled by:
1415 [-Wpedantic | -Wtraditional] -std=[gnu|c]++98 ; or
1416 [-Wpedantic | -Wtraditional] -std=non-c99 ; or
1417 -Wc90-c99-compat, if specified.
1419 Either -Wlong-long or -Wno-long-long override any other settings. */
1420 if (warn_long_long
== -1 && warn_c90_c99_compat
!= -1)
1421 warn_long_long
= warn_c90_c99_compat
;
1422 else if (warn_long_long
== -1)
1423 warn_long_long
= ((pedantic
|| warn_traditional
)
1424 && (c_dialect_cxx () ? cxx_dialect
== cxx98
: !flag_isoc99
));
1425 cpp_opts
->cpp_warn_long_long
= warn_long_long
;
1427 /* If we're generating preprocessor output, emit current directory
1428 if explicitly requested or if debugging information is enabled.
1429 ??? Maybe we should only do it for debugging formats that
1430 actually output the current directory? */
1431 if (flag_working_directory
== -1)
1432 flag_working_directory
= (debug_info_level
!= DINFO_LEVEL_NONE
);
1434 if (cpp_opts
->directives_only
)
1436 if (cpp_warn_unused_macros
)
1437 error ("-fdirectives-only is incompatible with -Wunused_macros");
1438 if (cpp_opts
->traditional
)
1439 error ("-fdirectives-only is incompatible with -traditional");
1443 /* Add include path with a prefix at the front of its name. */
1445 add_prefixed_path (const char *suffix
, size_t chain
)
1449 size_t prefix_len
, suffix_len
;
1451 suffix_len
= strlen (suffix
);
1452 prefix
= iprefix
? iprefix
: cpp_GCC_INCLUDE_DIR
;
1453 prefix_len
= iprefix
? strlen (iprefix
) : cpp_GCC_INCLUDE_DIR_len
;
1455 path
= (char *) xmalloc (prefix_len
+ suffix_len
+ 1);
1456 memcpy (path
, prefix
, prefix_len
);
1457 memcpy (path
+ prefix_len
, suffix
, suffix_len
);
1458 path
[prefix_len
+ suffix_len
] = '\0';
1460 add_path (path
, chain
, 0, false);
1463 /* Handle -D, -U, -A, -imacros, and the first -include. */
1465 c_finish_options (void)
1467 if (!cpp_opts
->preprocessed
)
1471 cb_file_change (parse_in
,
1472 linemap_add (line_table
, LC_RENAME
, 0,
1473 _("<built-in>"), 0));
1474 /* Make sure all of the builtins about to be declared have
1475 BUILTINS_LOCATION has their source_location. */
1476 source_location builtins_loc
= BUILTINS_LOCATION
;
1477 cpp_force_token_locations (parse_in
, &builtins_loc
);
1479 cpp_init_builtins (parse_in
, flag_hosted
);
1480 c_cpp_builtins (parse_in
);
1482 cpp_stop_forcing_token_locations (parse_in
);
1484 /* We're about to send user input to cpplib, so make it warn for
1485 things that we previously (when we sent it internal definitions)
1486 told it to not warn.
1488 C99 permits implementation-defined characters in identifiers.
1489 The documented meaning of -std= is to turn off extensions that
1490 conflict with the specified standard, and since a strictly
1491 conforming program cannot contain a '$', we do not condition
1492 their acceptance on the -std= setting. */
1493 cpp_opts
->warn_dollars
= (cpp_opts
->cpp_pedantic
&& !cpp_opts
->c99
);
1495 cb_file_change (parse_in
,
1496 linemap_add (line_table
, LC_RENAME
, 0,
1497 _("<command-line>"), 0));
1499 for (i
= 0; i
< deferred_count
; i
++)
1501 struct deferred_opt
*opt
= &deferred_opts
[i
];
1503 if (opt
->code
== OPT_D
)
1504 cpp_define (parse_in
, opt
->arg
);
1505 else if (opt
->code
== OPT_U
)
1506 cpp_undef (parse_in
, opt
->arg
);
1507 else if (opt
->code
== OPT_A
)
1509 if (opt
->arg
[0] == '-')
1510 cpp_unassert (parse_in
, opt
->arg
+ 1);
1512 cpp_assert (parse_in
, opt
->arg
);
1516 /* Start the main input file, if the debug writer wants it. */
1517 if (debug_hooks
->start_end_main_source_file
1518 && !flag_preprocess_only
)
1519 (*debug_hooks
->start_source_file
) (0, this_input_filename
);
1521 /* Handle -imacros after -D and -U. */
1522 for (i
= 0; i
< deferred_count
; i
++)
1524 struct deferred_opt
*opt
= &deferred_opts
[i
];
1526 if (opt
->code
== OPT_imacros
1527 && cpp_push_include (parse_in
, opt
->arg
))
1529 /* Disable push_command_line_include callback for now. */
1530 include_cursor
= deferred_count
+ 1;
1531 cpp_scan_nooutput (parse_in
);
1537 if (cpp_opts
->directives_only
)
1538 cpp_init_special_builtins (parse_in
);
1540 /* Start the main input file, if the debug writer wants it. */
1541 if (debug_hooks
->start_end_main_source_file
1542 && !flag_preprocess_only
)
1543 (*debug_hooks
->start_source_file
) (0, this_input_filename
);
1547 push_command_line_include ();
1550 /* Give CPP the next file given by -include, if any. */
1552 push_command_line_include (void)
1554 /* This can happen if disabled by -imacros for example.
1555 Punt so that we don't set "<command-line>" as the filename for
1557 if (include_cursor
> deferred_count
)
1560 if (!done_preinclude
)
1562 done_preinclude
= true;
1563 if (flag_hosted
&& std_inc
&& !cpp_opts
->preprocessed
)
1565 const char *preinc
= targetcm
.c_preinclude ();
1566 if (preinc
&& cpp_push_default_include (parse_in
, preinc
))
1571 pch_cpp_save_state ();
1573 while (include_cursor
< deferred_count
)
1575 struct deferred_opt
*opt
= &deferred_opts
[include_cursor
++];
1577 if (!cpp_opts
->preprocessed
&& opt
->code
== OPT_include
1578 && cpp_push_include (parse_in
, opt
->arg
))
1582 if (include_cursor
== deferred_count
)
1585 /* -Wunused-macros should only warn about macros defined hereafter. */
1586 cpp_opts
->warn_unused_macros
= cpp_warn_unused_macros
;
1587 /* Restore the line map from <command line>. */
1588 if (!cpp_opts
->preprocessed
)
1589 cpp_change_file (parse_in
, LC_RENAME
, this_input_filename
);
1591 /* Set this here so the client can change the option if it wishes,
1592 and after stacking the main file so we don't trace the main file. */
1593 line_table
->trace_includes
= cpp_opts
->print_include_names
;
1597 /* File change callback. Has to handle -include files. */
1599 cb_file_change (cpp_reader
* ARG_UNUSED (pfile
),
1600 const struct line_map
*new_map
)
1602 if (flag_preprocess_only
)
1603 pp_file_change (new_map
);
1605 fe_file_change (new_map
);
1608 && (new_map
->reason
== LC_ENTER
|| new_map
->reason
== LC_RENAME
))
1610 /* Signal to plugins that a file is included. This could happen
1611 several times with the same file path, e.g. because of
1612 several '#include' or '#line' directives... */
1613 invoke_plugin_callbacks
1614 (PLUGIN_INCLUDE_FILE
,
1615 const_cast<char*> (ORDINARY_MAP_FILE_NAME (new_map
)));
1618 if (new_map
== 0 || (new_map
->reason
== LC_LEAVE
&& MAIN_FILE_P (new_map
)))
1620 pch_cpp_save_state ();
1621 push_command_line_include ();
1626 cb_dir_change (cpp_reader
* ARG_UNUSED (pfile
), const char *dir
)
1628 if (!set_src_pwd (dir
))
1629 warning (0, "too late for # directive to set debug directory");
1632 /* Set the C 89 standard (with 1994 amendments if C94, without GNU
1633 extensions if ISO). There is no concept of gnu94. */
1635 set_std_c89 (int c94
, int iso
)
1637 cpp_set_lang (parse_in
, c94
? CLK_STDC94
: iso
? CLK_STDC89
: CLK_GNUC89
);
1640 flag_no_gnu_keywords
= iso
;
1641 flag_no_nonansi_builtin
= iso
;
1647 /* Set the C 99 standard (without GNU extensions if ISO). */
1649 set_std_c99 (int iso
)
1651 cpp_set_lang (parse_in
, iso
? CLK_STDC99
: CLK_GNUC99
);
1653 flag_no_nonansi_builtin
= iso
;
1660 /* Set the C 11 standard (without GNU extensions if ISO). */
1662 set_std_c11 (int iso
)
1664 cpp_set_lang (parse_in
, iso
? CLK_STDC11
: CLK_GNUC11
);
1666 flag_no_nonansi_builtin
= iso
;
1673 /* Set the C++ 98 standard (without GNU extensions if ISO). */
1675 set_std_cxx98 (int iso
)
1677 cpp_set_lang (parse_in
, iso
? CLK_CXX98
: CLK_GNUCXX
);
1678 flag_no_gnu_keywords
= iso
;
1679 flag_no_nonansi_builtin
= iso
;
1681 cxx_dialect
= cxx98
;
1684 /* Set the C++ 2011 standard (without GNU extensions if ISO). */
1686 set_std_cxx11 (int iso
)
1688 cpp_set_lang (parse_in
, iso
? CLK_CXX11
: CLK_GNUCXX11
);
1689 flag_no_gnu_keywords
= iso
;
1690 flag_no_nonansi_builtin
= iso
;
1692 /* C++11 includes the C99 standard library. */
1695 cxx_dialect
= cxx11
;
1698 /* Set the C++ 2014 draft standard (without GNU extensions if ISO). */
1700 set_std_cxx14 (int iso
)
1702 cpp_set_lang (parse_in
, iso
? CLK_CXX14
: CLK_GNUCXX14
);
1703 flag_no_gnu_keywords
= iso
;
1704 flag_no_nonansi_builtin
= iso
;
1706 /* C++11 includes the C99 standard library. */
1709 cxx_dialect
= cxx14
;
1712 /* Set the C++ 201z draft standard (without GNU extensions if ISO). */
1714 set_std_cxx1z (int iso
)
1716 cpp_set_lang (parse_in
, iso
? CLK_CXX1Z
: CLK_GNUCXX1Z
);
1717 flag_no_gnu_keywords
= iso
;
1718 flag_no_nonansi_builtin
= iso
;
1720 /* C++11 includes the C99 standard library. */
1724 cxx_dialect
= cxx1z
;
1727 /* Args to -d specify what to dump. Silently ignore
1728 unrecognized options; they may be aimed at toplev.c. */
1730 handle_OPT_d (const char *arg
)
1734 while ((c
= *arg
++) != '\0')
1737 case 'M': /* Dump macros only. */
1738 case 'N': /* Dump names. */
1739 case 'D': /* Dump definitions. */
1740 case 'U': /* Dump used macros. */
1741 flag_dump_macros
= c
;
1745 flag_dump_includes
= 1;