diff options
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r-- | gcc/c-opts.c | 202 |
1 files changed, 197 insertions, 5 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 4c0c1fc4423..09859a437c6 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; @@ -222,6 +230,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 +277,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; @@ -348,6 +372,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 +391,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,8 +484,22 @@ 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; @@ -488,6 +537,18 @@ 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 */ + + /* APPLE LOCAL begin constant cfstrings */ + case OPT_Wnonportable_cfstrings: + warn_nonportable_cfstrings = value; + break; + /* APPLE LOCAL end constant cfstrings */ + case OPT_Winit_self: warn_init_self = value; break; @@ -508,6 +569,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 +624,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 +755,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 +796,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 +819,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 +871,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; @@ -784,6 +889,12 @@ c_common_handle_option (size_t scode, const char *arg, int value) flag_const_strings = value; break; + /* APPLE LOCAL begin constant cfstrings */ + case OPT_fconstant_cfstrings: + flag_constant_cfstrings = value; + break; + /* APPLE LOCAL end constant cfstrings */ + case OPT_fconstant_string_class_: constant_string_class_name = arg; break; @@ -836,6 +947,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 +985,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 +1034,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; @@ -936,6 +1068,18 @@ c_common_handle_option (size_t scode, const char *arg, int value) flag_gen_declaration = 1; break; + /* APPLE LOCAL begin -header-mapfile */ + case OPT_header_mapfile: + if (cpp_opts->header_map != NULL) + error ("more than one `-header-mapfile' option specified; " + "only one is allowed"); +#if 0 + else + cpp_opts->header_map = hmap_load_header_map (arg); +#endif + break; + /* APPLE LOCAL end -header-mapfile */ + case OPT_idirafter: add_path (xstrdup (arg), AFTER, 0); break; @@ -1000,6 +1144,11 @@ c_common_handle_option (size_t scode, const char *arg, int value) cpp_opts->warn_endif_labels = 1; break; + /* APPLE LOCAL begin -precomp-trustfile */ + case OPT_precomp_trustfile: + break; + /* APPLE LOCAL end -precomp-trustfile */ + case OPT_print_objc_runtime_info: print_struct_values = 1; break; @@ -1054,6 +1203,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 +1226,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 +1353,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 +1407,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 +1702,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; |