diff options
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r-- | gcc/c-opts.c | 179 |
1 files changed, 174 insertions, 5 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 4c0c1fc4423..f907eda8033 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -58,6 +58,10 @@ static cpp_options *cpp_opts; /* Input filename. */ static const char *this_input_filename; +/* APPLE LOCAL begin read-from-stdin */ +static const char *stdin_filename; +/* APPLE LOCAL end read-from-stdin */ + /* Filename and stream for preprocessed output. */ static const char *out_fname; static FILE *out_stream; @@ -83,6 +87,10 @@ static const char *sysroot = TARGET_SYSTEM_ROOT; /* Zero disables all standard directories for headers. */ static bool std_inc = true; +/* APPLE LOCAL begin Symbol Separation */ +const char *dbg_dir; +/* APPLE LOCAL end Symbol Separation */ + /* Zero disables the C++-specific standard directories for headers. */ static bool std_cxx_inc = true; @@ -162,6 +170,7 @@ c_common_missing_argument (const char *opt, size_t code) case OPT_idirafter: case OPT_isysroot: case OPT_isystem: + case OPT_iquote: error ("missing path after \"%s\"", opt); break; @@ -222,6 +231,13 @@ c_common_init_options (unsigned int argc, const char **argv ATTRIBUTE_UNUSED) before passing on command-line options to cpplib. */ cpp_opts->warn_dollars = 0; +#ifdef WARN_FOUR_CHAR_CONSTANTS + /* APPLE LOCAL begin -Wfour-char-constants */ + /* Warn about 4-char constants everywhere except on Macs. */ + cpp_opts->warn_four_char_constants = WARN_FOUR_CHAR_CONSTANTS; + /* APPLE LOCAL end -Wfour-char-constants */ +#endif + flag_const_strings = c_dialect_cxx (); flag_exceptions = c_dialect_cxx (); warn_pointer_arith = c_dialect_cxx (); @@ -262,9 +278,18 @@ c_common_handle_option (size_t scode, const char *arg, int value) break; case OPT__output_pch_: + /* APPLE LOCAL Symbol Separation */ + cpp_opts->making_pch = value; pch_file = arg; break; + /* APPLE LOCAL begin Symbol Separation */ + case OPT_fsave_repository_: + dbg_dir = arg; + cpp_opts->making_ss = value; + break; + /* APPLE LOCAL end Symbol Separation */ + case OPT_A: defer_opt (code, arg); break; @@ -303,6 +328,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) error ("-I- specified twice"); quote_chain_split = true; split_quote_chain (); + inform ("obsolete option -I- used, please use -iquote instead"); } break; @@ -348,6 +374,12 @@ c_common_handle_option (size_t scode, const char *arg, int value) flag_no_line_commands = 1; break; + /* APPLE LOCAL begin -Wno-#warnings */ + case OPT_W_warnings: + cpp_opts->no_pound_warnings = !value; + break; + /* APPLE LOCAL end -Wno-#warnings */ + case OPT_fworking_directory: flag_working_directory = value; break; @@ -361,12 +393,17 @@ c_common_handle_option (size_t scode, const char *arg, int value) break; case OPT_Wall: + /* APPLE LOCAL -Wmost */ + case OPT_Wmost: set_Wunused (value); set_Wformat (value); set_Wimplicit (value); warn_char_subscripts = value; warn_missing_braces = value; - warn_parentheses = value; + /* APPLE LOCAL begin -Wmost dpatel */ + if (code != OPT_Wmost) + warn_parentheses = value; + /* APPLE LOCAL end -Wmost dpatel */ warn_return_type = value; warn_sequence_point = value; /* Was C only. */ if (c_dialect_cxx ()) @@ -449,9 +486,23 @@ c_common_handle_option (size_t scode, const char *arg, int value) break; case OPT_Werror: - cpp_opts->warnings_are_errors = value; + /* APPLE LOCAL begin -Werror 2002-21-01 dpatel */ + if (getenv ("QA_DISABLE_WERROR")) + { + warning ("-Werror ignored because QA_DISABLE_WERROR is set."); + warning ("Warnings will not be treated as errors."); + } + else + cpp_opts->warnings_are_errors = value; + /* APPLE LOCAL end -Werror 2002-21-01 dpatel */ break; + /* APPLE LOCAL begin -Wextra-tokens */ + case OPT_Wextra_tokens: + cpp_opts->warn_extra_tokens = value; + break; + /* APPLE LOCAL end -Wextra-tokens */ + case OPT_Werror_implicit_function_declaration: mesg_implicit_function_declaration = 2; break; @@ -488,6 +539,12 @@ c_common_handle_option (size_t scode, const char *arg, int value) warn_format_zero_length = value; break; + /* APPLE LOCAL begin -Wfour-char-constants */ + case OPT_Wfour_char_constants: + cpp_opts->warn_four_char_constants = value; + break; + /* APPLE LOCAL end -Wfour-char-constants */ + case OPT_Winit_self: warn_init_self = value; break; @@ -508,6 +565,18 @@ c_common_handle_option (size_t scode, const char *arg, int value) /* Silently ignore for now. */ break; + /* APPLE LOCAL begin -Wlong-double */ + case OPT_Wlong_double: + warn_long_double = value; + break; + /* APPLE LOCAL end -Wlong-double */ + + /* APPLE LOCAL begin Symbol Separation */ + case OPT_Winvalid_sr: + cpp_opts->warn_invalid_sr = value; + break; + /* APPLE LOCAL end Symbol Separation */ + case OPT_Winvalid_offsetof: warn_invalid_offsetof = value; break; @@ -551,6 +620,12 @@ c_common_handle_option (size_t scode, const char *arg, int value) warn_nested_externs = value; break; + /* APPLE LOCAL begin -Wnewline-eof */ + case OPT_Wnewline_eof: + cpp_opts->warn_newline_at_eof = value; + break; + /* APPLE LOCAL end -Wnewline-eof */ + case OPT_Wnon_template_friend: warn_nontemplate_friend = value; break; @@ -676,6 +751,11 @@ c_common_handle_option (size_t scode, const char *arg, int value) set_std_cxx98 (true); break; + /* APPLE LOCAL begin fat builds */ + case OPT_arch: + break; + /* APPLE LOCAL end fat builds */ + case OPT_d: handle_OPT_d (arg); break; @@ -712,6 +792,14 @@ c_common_handle_option (size_t scode, const char *arg, int value) flag_access_control = value; break; + /* APPLE LOCAL begin -fapple-kext */ + case OPT_fapple_kext: + flag_apple_kext = value; + flag_indirect_virtual_calls = 1; + flag_terminated_vtables = 1; + break; + /* APPLE LOCAL end -fapple-kext */ + case OPT_fasm: flag_no_asm = !value; break; @@ -727,6 +815,13 @@ c_common_handle_option (size_t scode, const char *arg, int value) disable_builtin_function (arg); break; + /* BEGIN APPLE LOCAL disable_typechecking_for_spec_flag */ + case OPT_fdisable_typechecking_for_spec: + disable_typechecking_for_spec_flag = value; + break; + /* END APPLE LOCAL disable_typechecking_for_spec_flag */ + + case OPT_fdollars_in_identifiers: cpp_opts->dollars_in_ident = value; break; @@ -772,6 +867,12 @@ c_common_handle_option (size_t scode, const char *arg, int value) flag_signed_char = !value; break; + /* APPLE LOCAL begin structor decloning */ + case OPT_fclone_structors: + flag_clone_structors = value; + break; + /* APPLE LOCAL end structor decloning */ + case OPT_fcheck_new: flag_check_new = value; break; @@ -836,6 +937,12 @@ c_common_handle_option (size_t scode, const char *arg, int value) flag_implicit_templates = value; break; + /* APPLE LOCAL begin -findirect-virtual-calls */ + case OPT_findirect_virtual_calls: + flag_indirect_virtual_calls = value; + break; + /* APPLE LOCAL end -findirect-virtual-calls */ + case OPT_fms_extensions: flag_ms_extensions = value; break; @@ -868,12 +975,21 @@ c_common_handle_option (size_t scode, const char *arg, int value) cpp_opts->restore_pch_deps = value; break; + /* APPLE LOCAL BEGIN pch distcc mrs */ + case OPT_fpch_preprocess: + flag_pch_preprocess = value; + cpp_opts->pch_preprocess = value; + break; + /* APPLE LOCAL END pch distcc mrs */ + case OPT_fpermissive: flag_permissive = value; break; case OPT_fpreprocessed: cpp_opts->preprocessed = value; + /* APPLE LOCAL private extern Radar 2872481 ilr */ + flag_preprocessed = value; break; case OPT_freplace_objc_classes: @@ -908,6 +1024,12 @@ c_common_handle_option (size_t scode, const char *arg, int value) cpp_opts->narrow_charset = arg; break; + /* APPLE LOCAL begin -fterminated-vtables */ + case OPT_fterminated_vtables: + flag_terminated_vtables = value; + break; + /* APPLE LOCAL end -fterminated-vtables */ + case OPT_fwide_exec_charset_: cpp_opts->wide_charset = arg; break; @@ -949,6 +1071,10 @@ c_common_handle_option (size_t scode, const char *arg, int value) iprefix = arg; break; + case OPT_iquote: + add_path (xstrdup (arg), QUOTE, 0); + break; + case OPT_isysroot: sysroot = arg; break; @@ -1054,6 +1180,13 @@ c_common_handle_option (size_t scode, const char *arg, int value) case OPT_v: verbose = true; break; + + /* APPLE LOCAL begin -fast, -fastf, -fastcp option */ + case OPT_fast: + case OPT_fastcp: + case OPT_fastf: + break; + /* APPLE LOCAL end -fast, -fastf, -fastcp option */ } return result; @@ -1070,6 +1203,10 @@ c_common_post_options (const char **pfilename) { in_fnames = xmalloc (sizeof (in_fnames[0])); in_fnames[0] = ""; + /* APPLE LOCAL begin read-from-stdin */ + if (stdin_filename != NULL) + set_stdin_option(parse_in, stdin_filename); + /* APPLE LOCAL end read-from-stdin */ } else if (strcmp (in_fnames[0], "-") == 0) in_fnames[0] = ""; @@ -1193,6 +1330,18 @@ c_common_init (void) if (flag_preprocess_only) { + /* APPLE LOCAL BEGIN pch distcc mrs */ + if (flag_pch_preprocess) + { + struct cpp_callbacks *cb; + cb = cpp_get_callbacks (parse_in); + + /* In this case, we want the pch file to be read in. */ + cb->valid_pch = c_common_valid_pch; + cb->read_pch = c_common_read_pch; + } + /* APPLE LOCAL END pch distcc mrs */ + finish_options (); preprocess_file (parse_in); return false; @@ -1235,13 +1384,29 @@ c_common_parse_file (int set_yydebug ATTRIBUTE_UNUSED) } finish_options (); if (file_index == 0) - pch_init(); + /* APPLE LOCAL begin Symbol Separation */ + { + pch_init(); + + /* Initialize Symbol Sepration. Create .cinfo file and save + current cpp state. */ + dbg_dir = cpp_symbol_separation_init (parse_in, dbg_dir, + input_filename); + if (dbg_dir) + (*debug_hooks->start_symbol_repository) + /* MERGE FIXME: This used to have 'lineno' rather than '0', + but that variable no longer exists and was almost certainly + wrong to use in the first place. */ + (0, input_filename, cpp_get_stabs_checksum ()); + } + /* APPLE LOCAL end Symbol Separation */ c_parse_file (); file_index++; } while (file_index < num_in_fnames); - finish_file (); + /* APPLE LOCAL Objective-C++ */ + (*lang_hooks.finish_file) (); } /* Common finish hook for the C, ObjC and C++ front ends. */ @@ -1514,7 +1679,11 @@ cb_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir) static void set_std_c89 (int c94, int iso) { - cpp_set_lang (parse_in, c94 ? CLK_STDC94: iso ? CLK_STDC89: CLK_GNUC89); + /* APPLE LOCAL begin 3191171 */ + /* Do not override CLK_ASM if set */ + if (cpp_opts->lang != CLK_ASM) + /* APPLE LOCAL end 3191171 */ + cpp_set_lang (parse_in, c94 ? CLK_STDC94: iso ? CLK_STDC89: CLK_GNUC89); flag_iso = iso; flag_no_asm = iso; flag_no_gnu_keywords = iso; |