X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fc-family%2Fc-opts.c;h=f2a7971781d3f00f709d37ac7435277ce25891a5;hb=923e06eee99402adb06f547d2731c482c52e3f40;hp=0d75615c79280b1de9ce263aefa050adb7bff25a;hpb=abf6a6177a213072a1de6bbec0045276b77c64e1;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 0d75615c792..f2a7971781d 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1,5 +1,5 @@ /* C/ObjC/C++ command line option handling. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Neil Booth. @@ -36,7 +36,13 @@ along with GCC; see the file COPYING3. If not see #include "opts.h" #include "options.h" #include "mkdeps.h" -#include "target.h" /* For gcc_targetcm. */ +#include "c-target.h" +#include "tm.h" /* For BYTES_BIG_ENDIAN, + DOLLARS_IN_IDENTIFIERS, + STDC_0_IN_SYSTEM_HEADERS, + TARGET_FLT_EVAL_METHOD_NON_DEFAULT and + TARGET_OPTF. */ +#include "tm_p.h" /* For C_COMMON_OVERRIDE_OPTIONS. */ #ifndef DOLLARS_IN_IDENTIFIERS # define DOLLARS_IN_IDENTIFIERS true @@ -104,10 +110,10 @@ static size_t include_cursor; static void handle_OPT_d (const char *); static void set_std_cxx98 (int); -static void set_std_cxx0x (int); +static void set_std_cxx11 (int); static void set_std_c89 (int, int); static void set_std_c99 (int); -static void set_std_c1x (int); +static void set_std_c11 (int); static void check_deps_environment_vars (void); static void handle_deferred_opts (void); static void sanitize_cpp_opts (void); @@ -115,7 +121,7 @@ static void add_prefixed_path (const char *, size_t); static void push_command_line_include (void); static void cb_file_change (cpp_reader *, const struct line_map *); static void cb_dir_change (cpp_reader *, const char *); -static void finish_options (void); +static void c_finish_options (void); #ifndef STDC_0_IN_SYSTEM_HEADERS #define STDC_0_IN_SYSTEM_HEADERS 0 @@ -131,62 +137,9 @@ static struct deferred_opt } *deferred_opts; -static const unsigned int +extern const unsigned int c_family_lang_mask = (CL_C | CL_CXX | CL_ObjC | CL_ObjCXX); -/* Complain that switch CODE expects an argument but none was - provided. OPT was the command-line option. Return FALSE to get - the default message in opts.c, TRUE if we provide a specialized - one. */ -bool -c_common_missing_argument (const char *opt, size_t code) -{ - switch (code) - { - default: - /* Pick up the default message. */ - return false; - - case OPT_fconstant_string_class_: - error ("no class name specified with %qs", opt); - break; - - case OPT_A: - error ("assertion missing after %qs", opt); - break; - - case OPT_D: - case OPT_U: - error ("macro name missing after %qs", opt); - break; - - case OPT_F: - case OPT_I: - case OPT_idirafter: - case OPT_isysroot: - case OPT_isystem: - case OPT_iquote: - error ("missing path after %qs", opt); - break; - - case OPT_MF: - case OPT_MD: - case OPT_MMD: - case OPT_include: - case OPT_imacros: - case OPT_o: - error ("missing filename after %qs", opt); - break; - - case OPT_MQ: - case OPT_MT: - error ("missing makefile target after %qs", opt); - break; - } - - return true; -} - /* Defer option CODE with argument ARG. */ static void defer_opt (enum opt_code code, const char *arg) @@ -196,114 +149,69 @@ defer_opt (enum opt_code code, const char *arg) deferred_count++; } -/* -Werror= may set a warning option to enable a warning that is emitted - by the preprocessor. Set any corresponding flag in cpp_opts. */ - -static void -warning_as_error_callback (int option_index) -{ - switch (option_index) - { - default: - /* Ignore options not associated with the preprocessor. */ - break; - - case OPT_Wdeprecated: - cpp_opts->warn_deprecated = 1; - break; - - case OPT_Wcomment: - case OPT_Wcomments: - cpp_opts->warn_comments = 1; - break; - - case OPT_Wtrigraphs: - cpp_opts->warn_trigraphs = 1; - break; - - case OPT_Wmultichar: - cpp_opts->warn_multichar = 1; - break; - - case OPT_Wtraditional: - cpp_opts->warn_traditional = 1; - break; - - case OPT_Wlong_long: - cpp_opts->warn_long_long = 1; - break; - - case OPT_Wendif_labels: - cpp_opts->warn_endif_labels = 1; - break; - - case OPT_Wvariadic_macros: - /* Set the local flag that is used later to update cpp_opts. */ - warn_variadic_macros = 1; - break; - - case OPT_Wbuiltin_macro_redefined: - cpp_opts->warn_builtin_macro_redefined = 1; - break; - - case OPT_Wundef: - cpp_opts->warn_undef = 1; - break; - - case OPT_Wunused_macros: - /* Set the local flag that is used later to update cpp_opts. */ - warn_unused_macros = 1; - break; - - case OPT_Wc___compat: - /* Add warnings in the same way as c_common_handle_option below. */ - if (warn_enum_compare == -1) - warn_enum_compare = 1; - if (warn_jump_misses_init == -1) - warn_jump_misses_init = 1; - cpp_opts->warn_cxx_operator_names = 1; - break; - - case OPT_Wnormalized_: - inform (input_location, "-Werror=normalized=: Set -Wnormalized=nfc"); - cpp_opts->warn_normalize = normalized_C; - break; - - case OPT_Winvalid_pch: - cpp_opts->warn_invalid_pch = 1; - break; - - case OPT_Wcpp: - /* Handled by standard diagnostics using the option's associated - boolean variable. */ - break; - } -} - -/* Common initialization before parsing options. */ +/* Return language mask for option parsing. */ unsigned int -c_common_init_options (unsigned int argc, const char **argv) +c_common_option_lang_mask (void) { static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX}; - unsigned int i, result; - struct cpp_callbacks *cb; - /* Register callback for warnings enabled by -Werror=. */ - register_warning_as_error_callback (warning_as_error_callback); + return lang_flags[c_language]; +} +/* Common diagnostics initialization. */ +void +c_common_initialize_diagnostics (diagnostic_context *context) +{ /* This is conditionalized only because that is the way the front ends used to do it. Maybe this should be unconditional? */ if (c_dialect_cxx ()) { /* By default wrap lines at 80 characters. Is getenv ("COLUMNS") preferable? */ - diagnostic_line_cutoff (global_dc) = 80; + diagnostic_line_cutoff (context) = 80; /* By default, emit location information once for every diagnostic message. */ - diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE; + diagnostic_prefixing_rule (context) = DIAGNOSTICS_SHOW_PREFIX_ONCE; } - global_dc->opt_permissive = OPT_fpermissive; + context->opt_permissive = OPT_fpermissive; +} + +/* Whether options from all C-family languages should be accepted + quietly. */ +static bool accept_all_c_family_options = false; + +/* Return whether to complain about a wrong-language option. */ +bool +c_common_complain_wrong_lang_p (const struct cl_option *option) +{ + if (accept_all_c_family_options + && (option->flags & c_family_lang_mask)) + return false; + + return true; +} + +/* Initialize options structure OPTS. */ +void +c_common_init_options_struct (struct gcc_options *opts) +{ + opts->x_flag_exceptions = c_dialect_cxx (); + opts->x_warn_pointer_arith = c_dialect_cxx (); + opts->x_warn_write_strings = c_dialect_cxx (); + opts->x_flag_warn_unused_result = true; + + /* By default, C99-like requirements for complex multiply and divide. */ + opts->x_flag_complex_method = 2; +} + +/* Common initialization before calling option handlers. */ +void +c_common_init_options (unsigned int decoded_options_count, + struct cl_decoded_option *decoded_options) +{ + unsigned int i; + struct cpp_callbacks *cb; parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX: CLK_GNUC89, ident_hash, line_table); @@ -318,44 +226,32 @@ c_common_init_options (unsigned int argc, const char **argv) before passing on command-line options to cpplib. */ cpp_opts->warn_dollars = 0; - flag_exceptions = c_dialect_cxx (); - warn_pointer_arith = c_dialect_cxx (); - warn_write_strings = c_dialect_cxx(); - flag_warn_unused_result = true; - - /* By default, C99-like requirements for complex multiply and divide. */ - flag_complex_method = 2; - - deferred_opts = XNEWVEC (struct deferred_opt, argc); - - result = lang_flags[c_language]; + deferred_opts = XNEWVEC (struct deferred_opt, decoded_options_count); if (c_language == clk_c) { /* If preprocessing assembly language, accept any of the C-family front end options since the driver may pass them through. */ - for (i = 1; i < argc; i++) - if (! strcmp (argv[i], "-lang-asm")) + for (i = 1; i < decoded_options_count; i++) + if (decoded_options[i].opt_index == OPT_lang_asm) { - result |= CL_C | CL_ObjC | CL_CXX | CL_ObjCXX; + accept_all_c_family_options = true; break; } } - - return result; } /* Handle switch SCODE with argument ARG. VALUE is true, unless no- - form of an -f or -W option was given. Returns 0 if the switch was - invalid, a negative number to prevent language-independent - processing in toplev.c (a hack necessary for the short-term). */ -int + form of an -f or -W option was given. Returns false if the switch was + invalid, true if valid. Use HANDLERS in recursive handle_option calls. */ +bool c_common_handle_option (size_t scode, const char *arg, int value, - int kind) + int kind, location_t loc, + const struct cl_option_handlers *handlers) { const struct cl_option *option = &cl_options[scode]; enum opt_code code = (enum opt_code) scode; - int result = 1; + bool result = true; /* Prevent resetting the language standard to a C dialect when the driver has already determined that we're looking at assembler input. */ @@ -368,10 +264,10 @@ c_common_handle_option (size_t scode, const char *arg, int value, { if ((option->flags & CL_TARGET) && ! targetcm.handle_c_option (scode, arg, value)) - result = 0; + result = false; break; } - result = 0; + result = false; break; case OPT__output_pch_: @@ -465,7 +361,10 @@ c_common_handle_option (size_t scode, const char *arg, int value, case OPT_Wall: warn_unused = value; set_Wformat (value); - handle_option (OPT_Wimplicit, value, NULL, c_family_lang_mask, kind); + handle_generated_option (&global_options, &global_options_set, + OPT_Wimplicit, NULL, value, + c_family_lang_mask, kind, loc, + handlers, global_dc); warn_char_subscripts = value; warn_missing_braces = value; warn_parentheses = value; @@ -473,7 +372,7 @@ c_common_handle_option (size_t scode, const char *arg, int value, warn_sequence_point = value; /* Was C only. */ warn_switch = value; if (warn_strict_aliasing == -1) - set_Wstrict_aliasing (value); + set_Wstrict_aliasing (&global_options, value); warn_address = value; if (warn_strict_overflow == -1) warn_strict_overflow = value; @@ -485,6 +384,7 @@ c_common_handle_option (size_t scode, const char *arg, int value, warn_unknown_pragmas = value; warn_uninitialized = value; + warn_maybe_uninitialized = value; if (!c_dialect_cxx ()) { @@ -505,6 +405,8 @@ c_common_handle_option (size_t scode, const char *arg, int value, warn_sign_compare = value; warn_reorder = value; warn_cxx0x_compat = value; + warn_delnonvdtor = value; + warn_narrowing = value; } cpp_opts->warn_trigraphs = value; @@ -520,7 +422,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, break; case OPT_Wcomment: - case OPT_Wcomments: cpp_opts->warn_comments = value; break; @@ -536,24 +437,18 @@ c_common_handle_option (size_t scode, const char *arg, int value, cpp_opts->warn_cxx_operator_names = value; break; + case OPT_Wc__0x_compat: + warn_narrowing = value; + break; + case OPT_Wdeprecated: - cpp_opts->warn_deprecated = value; + cpp_opts->cpp_warn_deprecated = value; break; case OPT_Wendif_labels: cpp_opts->warn_endif_labels = value; break; - case OPT_Werror: - global_dc->warning_as_error_requested = value; - break; - - case OPT_Werror_implicit_function_declaration: - /* For backward compatibility, this is the same as - -Werror=implicit-function-declaration. */ - enable_warning_as_error ("implicit-function-declaration", value, CL_C | CL_ObjC); - break; - case OPT_Wformat: set_Wformat (value); break; @@ -565,21 +460,25 @@ c_common_handle_option (size_t scode, const char *arg, int value, case OPT_Wimplicit: gcc_assert (value == 0 || value == 1); if (warn_implicit_int == -1) - handle_option (OPT_Wimplicit_int, value, NULL, - c_family_lang_mask, kind); + handle_generated_option (&global_options, &global_options_set, + OPT_Wimplicit_int, NULL, value, + c_family_lang_mask, kind, loc, handlers, + global_dc); if (warn_implicit_function_declaration == -1) - handle_option (OPT_Wimplicit_function_declaration, value, NULL, - c_family_lang_mask, kind); - break; - - case OPT_Wimport: - /* Silently ignore for now. */ + handle_generated_option (&global_options, &global_options_set, + OPT_Wimplicit_function_declaration, NULL, + value, c_family_lang_mask, kind, loc, + handlers, global_dc); break; case OPT_Winvalid_pch: cpp_opts->warn_invalid_pch = value; break; + case OPT_Wlong_long: + cpp_opts->cpp_warn_long_long = value; + break; + case OPT_Wmissing_include_dirs: cpp_opts->warn_missing_include_dirs = value; break; @@ -589,24 +488,33 @@ c_common_handle_option (size_t scode, const char *arg, int value, break; case OPT_Wnormalized_: - if (!value || (arg && strcasecmp (arg, "none") == 0)) - cpp_opts->warn_normalize = normalized_none; - else if (!arg || strcasecmp (arg, "nfkc") == 0) - cpp_opts->warn_normalize = normalized_KC; - else if (strcasecmp (arg, "id") == 0) - cpp_opts->warn_normalize = normalized_identifier_C; - else if (strcasecmp (arg, "nfc") == 0) - cpp_opts->warn_normalize = normalized_C; + if (kind == DK_ERROR) + { + gcc_assert (!arg); + inform (input_location, "-Werror=normalized=: set -Wnormalized=nfc"); + cpp_opts->warn_normalize = normalized_C; + } else - error ("argument %qs to %<-Wnormalized%> not recognized", arg); - break; + { + if (!value || (arg && strcasecmp (arg, "none") == 0)) + cpp_opts->warn_normalize = normalized_none; + else if (!arg || strcasecmp (arg, "nfkc") == 0) + cpp_opts->warn_normalize = normalized_KC; + else if (strcasecmp (arg, "id") == 0) + cpp_opts->warn_normalize = normalized_identifier_C; + else if (strcasecmp (arg, "nfc") == 0) + cpp_opts->warn_normalize = normalized_C; + else + error ("argument %qs to %<-Wnormalized%> not recognized", arg); + break; + } case OPT_Wreturn_type: warn_return_type = value; break; case OPT_Wtraditional: - cpp_opts->warn_traditional = value; + cpp_opts->cpp_warn_traditional = value; break; case OPT_Wtrigraphs: @@ -658,31 +566,12 @@ c_common_handle_option (size_t scode, const char *arg, int value, flag_cond_mismatch = value; break; } - /* Fall through. */ - - case OPT_fall_virtual: - case OPT_falt_external_templates: - case OPT_fenum_int_equiv: - case OPT_fexternal_templates: - case OPT_fguiding_decls: - case OPT_fhonor_std: - case OPT_fhuge_objects: - case OPT_flabels_ok: - case OPT_fname_mangling_version_: - case OPT_fnew_abi: - case OPT_fnonnull_objects: - case OPT_fsquangle: - case OPT_fstrict_prototype: - case OPT_fthis_is_variable: - case OPT_fvtable_thunks: - case OPT_fxref: - case OPT_fvtable_gc: warning (0, "switch %qs is no longer supported", option->opt_text); break; case OPT_fbuiltin_: if (value) - result = 0; + result = false; else disable_builtin_function (arg); break; @@ -707,35 +596,14 @@ c_common_handle_option (size_t scode, const char *arg, int value, constant_string_class_name = arg; break; - case OPT_fdefault_inline: - /* Ignore. */ - break; - case OPT_fextended_identifiers: cpp_opts->extended_identifiers = value; break; - case OPT_fgnu_runtime: - flag_next_runtime = !value; - break; - - case OPT_fhandle_exceptions: - warning (0, "-fhandle-exceptions has been renamed -fexceptions (and is now on by default)"); - flag_exceptions = value; - break; - - case OPT_fnext_runtime: - flag_next_runtime = value; - break; - case OPT_foperator_names: cpp_opts->operator_names = value; break; - case OPT_foptional_diags: - /* Ignore. */ - break; - case OPT_fpch_deps: cpp_opts->restore_pch_deps = value; break; @@ -753,6 +621,22 @@ c_common_handle_option (size_t scode, const char *arg, int value, cpp_opts->preprocessed = value; break; + case OPT_fdebug_cpp: + cpp_opts->debug = 1; + break; + + case OPT_ftrack_macro_expansion: + if (value) + value = 2; + /* Fall Through. */ + + case OPT_ftrack_macro_expansion_: + if (arg && *arg != '\0') + cpp_opts->track_macro_expansion = value; + else + cpp_opts->track_macro_expansion = 2; + break; + case OPT_frepo: flag_use_repository = value; if (value) @@ -778,8 +662,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, break; case OPT_ftemplate_depth_: - /* Kept for backwards compatibility. */ - case OPT_ftemplate_depth_eq: max_tinst_depth = value; break; @@ -788,15 +670,16 @@ c_common_handle_option (size_t scode, const char *arg, int value, break; case OPT_femit_struct_debug_baseonly: - set_struct_debug_option ("base"); + set_struct_debug_option (&global_options, loc, "base"); break; case OPT_femit_struct_debug_reduced: - set_struct_debug_option ("dir:ord:sys,dir:gen:any,ind:base"); + set_struct_debug_option (&global_options, loc, + "dir:ord:sys,dir:gen:any,ind:base"); break; case OPT_femit_struct_debug_detailed_: - set_struct_debug_option (arg); + set_struct_debug_option (&global_options, loc, arg); break; case OPT_idirafter: @@ -841,10 +724,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, cpp_opts->dollars_in_ident = false; break; - case OPT_lang_objc: - cpp_opts->objc = 1; - break; - case OPT_nostdinc: std_inc = false; break; @@ -865,7 +744,7 @@ c_common_handle_option (size_t scode, const char *arg, int value, is not overridden. */ case OPT_pedantic_errors: case OPT_pedantic: - cpp_opts->pedantic = 1; + cpp_opts->cpp_pedantic = 1; cpp_opts->warn_endif_labels = 1; if (warn_pointer_sign == -1) warn_pointer_sign = 1; @@ -879,11 +758,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, print_struct_values = 1; break; - case OPT_print_pch_checksum: - c_common_print_pch_checksum (stdout); - exit_after_options = true; - break; - case OPT_remap: cpp_opts->remap = 1; break; @@ -894,48 +768,41 @@ c_common_handle_option (size_t scode, const char *arg, int value, set_std_cxx98 (code == OPT_std_c__98 /* ISO */); break; - case OPT_std_c__0x: - case OPT_std_gnu__0x: + case OPT_std_c__11: + case OPT_std_gnu__11: if (!preprocessing_asm_p) - set_std_cxx0x (code == OPT_std_c__0x /* ISO */); + set_std_cxx11 (code == OPT_std_c__11 /* ISO */); break; - case OPT_std_c89: case OPT_std_c90: - case OPT_std_iso9899_1990: case OPT_std_iso9899_199409: if (!preprocessing_asm_p) set_std_c89 (code == OPT_std_iso9899_199409 /* c94 */, true /* ISO */); break; - case OPT_std_gnu89: case OPT_std_gnu90: if (!preprocessing_asm_p) set_std_c89 (false /* c94 */, false /* ISO */); break; case OPT_std_c99: - case OPT_std_c9x: - case OPT_std_iso9899_1999: - case OPT_std_iso9899_199x: if (!preprocessing_asm_p) set_std_c99 (true /* ISO */); break; case OPT_std_gnu99: - case OPT_std_gnu9x: if (!preprocessing_asm_p) set_std_c99 (false /* ISO */); break; - case OPT_std_c1x: + case OPT_std_c11: if (!preprocessing_asm_p) - set_std_c1x (true /* ISO */); + set_std_c11 (true /* ISO */); break; - case OPT_std_gnu1x: + case OPT_std_gnu11: if (!preprocessing_asm_p) - set_std_c1x (false /* ISO */); + set_std_c11 (false /* ISO */); break; case OPT_trigraphs: @@ -958,6 +825,16 @@ c_common_handle_option (size_t scode, const char *arg, int value, return result; } +/* Default implementation of TARGET_HANDLE_C_OPTION. */ + +bool +default_handle_c_option (size_t code ATTRIBUTE_UNUSED, + const char *arg ATTRIBUTE_UNUSED, + int value ATTRIBUTE_UNUSED) +{ + return false; +} + /* Post-switch processing. */ bool c_common_post_options (const char **pfilename) @@ -1113,10 +990,17 @@ c_common_post_options (const char **pfilename) if (warn_implicit_function_declaration == -1) warn_implicit_function_declaration = flag_isoc99; - /* If we're allowing C++0x constructs, don't warn about C++0x - compatibility problems. */ if (cxx_dialect == cxx0x) - warn_cxx0x_compat = 0; + { + /* If we're allowing C++0x constructs, don't warn about C++98 + identifiers which are keywords in C++0x. */ + warn_cxx0x_compat = 0; + + if (warn_narrowing == -1) + warn_narrowing = 1; + } + else if (warn_narrowing == -1) + warn_narrowing = 0; if (flag_preprocess_only) { @@ -1144,6 +1028,12 @@ c_common_post_options (const char **pfilename) { init_c_lex (); + /* When writing a PCH file, avoid reading some other PCH file, + because the default address space slot then can't be used + for the output PCH file. */ + if (pch_file) + c_common_no_more_pch (); + /* Yuk. WTF is this? I do know ObjC relies on it somewhere. */ input_location = UNKNOWN_LOCATION; } @@ -1168,6 +1058,13 @@ c_common_post_options (const char **pfilename) && flag_preprocess_only && !flag_no_line_commands) pp_dir_change (parse_in, get_src_pwd ()); + /* Disable LTO output when outputting a precompiled header. */ + if (pch_file && flag_lto) + { + flag_lto = 0; + flag_generate_lto = 0; + } + return flag_preprocess_only; } @@ -1196,7 +1093,7 @@ c_common_init (void) if (flag_preprocess_only) { - finish_options (); + c_finish_options (); preprocess_file (parse_in); return false; } @@ -1207,39 +1104,17 @@ c_common_init (void) /* Initialize the integrated preprocessor after debug output has been initialized; loop over each input file. */ void -c_common_parse_file (int set_yydebug) +c_common_parse_file (void) { unsigned int i; - if (set_yydebug) - switch (c_language) - { - case clk_c: - warning(0, "The C parser does not support -dy, option ignored"); - break; - case clk_objc: - warning(0, - "The Objective-C parser does not support -dy, option ignored"); - break; - case clk_cxx: - warning(0, "The C++ parser does not support -dy, option ignored"); - break; - case clk_objcxx: - warning(0, - "The Objective-C++ parser does not support -dy, option ignored"); - break; - default: - gcc_unreachable (); - } - i = 0; for (;;) { - finish_options (); + c_finish_options (); pch_init (); push_file_scope (); c_parse_file (); - finish_file (); pop_file_scope (); /* And end the main input file, if the debug writer wants it */ if (debug_hooks->start_end_main_source_file) @@ -1302,12 +1177,12 @@ check_deps_environment_vars (void) { char *spec; - GET_ENVIRONMENT (spec, "DEPENDENCIES_OUTPUT"); + spec = getenv ("DEPENDENCIES_OUTPUT"); if (spec) cpp_opts->deps.style = DEPS_USER; else { - GET_ENVIRONMENT (spec, "SUNPRO_DEPENDENCIES"); + spec = getenv ("SUNPRO_DEPENDENCIES"); if (spec) { cpp_opts->deps.style = DEPS_SYSTEM; @@ -1403,7 +1278,7 @@ sanitize_cpp_opts (void) if (warn_long_long == -1) warn_long_long = ((pedantic || warn_traditional) && (c_dialect_cxx () ? cxx_dialect == cxx98 : !flag_isoc99)); - cpp_opts->warn_long_long = warn_long_long; + cpp_opts->cpp_warn_long_long = warn_long_long; /* Similarly with -Wno-variadic-macros. No check for c99 here, since this also turns off warnings about GCCs extension. */ @@ -1448,18 +1323,23 @@ add_prefixed_path (const char *suffix, size_t chain) /* Handle -D, -U, -A, -imacros, and the first -include. */ static void -finish_options (void) +c_finish_options (void) { if (!cpp_opts->preprocessed) { size_t i; - cb_file_change (parse_in, - linemap_add (line_table, LC_RENAME, 0, - _(""), 0)); + { + /* Make sure all of the builtins about to be declared have + BUILTINS_LOCATION has their source_location. */ + source_location builtins_loc = BUILTINS_LOCATION; + cpp_force_token_locations (parse_in, &builtins_loc); + + cpp_init_builtins (parse_in, flag_hosted); + c_cpp_builtins (parse_in); - cpp_init_builtins (parse_in, flag_hosted); - c_cpp_builtins (parse_in); + cpp_stop_forcing_token_locations (parse_in); + } /* We're about to send user input to cpplib, so make it warn for things that we previously (when we sent it internal definitions) @@ -1470,7 +1350,7 @@ finish_options (void) conflict with the specified standard, and since a strictly conforming program cannot contain a '$', we do not condition their acceptance on the -std= setting. */ - cpp_opts->warn_dollars = (cpp_opts->pedantic && !cpp_opts->c99); + cpp_opts->warn_dollars = (cpp_opts->cpp_pedantic && !cpp_opts->c99); cb_file_change (parse_in, linemap_add (line_table, LC_RENAME, 0, @@ -1588,7 +1468,7 @@ set_std_c89 (int c94, int iso) flag_no_nonansi_builtin = iso; flag_isoc94 = c94; flag_isoc99 = 0; - flag_isoc1x = 0; + flag_isoc11 = 0; } /* Set the C 99 standard (without GNU extensions if ISO). */ @@ -1599,20 +1479,20 @@ set_std_c99 (int iso) flag_no_asm = iso; flag_no_nonansi_builtin = iso; flag_iso = iso; - flag_isoc1x = 0; + flag_isoc11 = 0; flag_isoc99 = 1; flag_isoc94 = 1; } -/* Set the C 1X standard draft (without GNU extensions if ISO). */ +/* Set the C 11 standard (without GNU extensions if ISO). */ static void -set_std_c1x (int iso) +set_std_c11 (int iso) { - cpp_set_lang (parse_in, iso ? CLK_STDC1X: CLK_GNUC1X); + cpp_set_lang (parse_in, iso ? CLK_STDC11: CLK_GNUC11); flag_no_asm = iso; flag_no_nonansi_builtin = iso; flag_iso = iso; - flag_isoc1x = 1; + flag_isoc11 = 1; flag_isoc99 = 1; flag_isoc94 = 1; } @@ -1628,15 +1508,18 @@ set_std_cxx98 (int iso) cxx_dialect = cxx98; } -/* Set the C++ 0x working draft "standard" (without GNU extensions if ISO). */ +/* Set the C++ 2011 standard (without GNU extensions if ISO). */ static void -set_std_cxx0x (int iso) +set_std_cxx11 (int iso) { - cpp_set_lang (parse_in, iso ? CLK_CXX0X: CLK_GNUCXX0X); + cpp_set_lang (parse_in, iso ? CLK_CXX11: CLK_GNUCXX11); flag_no_gnu_keywords = iso; flag_no_nonansi_builtin = iso; flag_iso = iso; - cxx_dialect = cxx0x; + /* C++11 includes the C99 standard library. */ + flag_isoc94 = 1; + flag_isoc99 = 1; + cxx_dialect = cxx11; } /* Args to -d specify what to dump. Silently ignore