From 603349bf3ddd56a90ad8091a41038f0c38eb4838 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 16 Aug 2010 11:15:15 +0100 Subject: common.opt: Add driver options. * common.opt: Add driver options. (auxbase, auxbase-strip, quiet, version): Mark RejectDriver. * doc/options.texi (Driver, RejectDriver): Document. * gcc.c (pass_exit_codes, print_search_dirs, print_file_name, print_prog_name, print_multi_directory, print_sysroot, print_multi_os_directory, print_multi_lib, print_sysroot_headers_suffix, report_times, combine_flag, use_pipes, wrapper_string): Remove. (save_switch, driver_unknown_option_callback, driver_wrong_lang_callback, driver_post_handling_callback, driver_handle_option): New. (spec_lang, last_language_n_infiles): Make file-scope static instead of local to process_command. (process_command): Use decode_cmdline_options_to_array and read_cmdline_option for option processing. Compute have_c in prescan of decoded options. * opt-functions.awk (switch_flags): Handle Driver and RejectDriver. (var_type, var_type_struct): Handle Separate options as generating const char * variables. * opts-common.c (decode_cmdline_option): Expect CL_COMMON and CL_TARGET to be passed by caller if required. (decode_cmdline_options_to_array): Update comment. * opts.c (complain_wrong_lang): Handle options only valid for the driver. (decode_options): Update call to decode_cmdline_options_to_array. (print_filtered_help): Ignore driver-only options. (print_specific_help): Ignore CL_DRIVER. (common_handle_option): Don't call print_specific_help for CL_DRIVER. * opts.h (CL_DRIVER, CL_REJECT_DRIVER): Define. (CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_TARGET, CL_COMMON): Update values. c-family: * c.opt (MDX, MMDX, lang-asm): Mark RejectDriver. fortran: * lang.opt (MDX, MMDX): Mark RejectDriver. java: * lang.opt (MD_, MMD_, version): Mark RejectDriver. From-SVN: r163279 --- gcc/opts-common.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'gcc/opts-common.c') diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 6125dfa..f7c1040 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -128,8 +128,9 @@ integral_argument (const char *arg) } /* Decode the switch beginning at ARGV for the language indicated by - LANG_MASK, into the structure *DECODED. Returns the number of - switches consumed. */ + LANG_MASK (including CL_COMMON and CL_TARGET if applicable), into + the structure *DECODED. Returns the number of switches + consumed. */ static unsigned int decode_cmdline_option (const char **argv, unsigned int lang_mask, @@ -147,7 +148,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, opt = argv[0]; - opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET); + opt_index = find_opt (opt + 1, lang_mask); if (opt_index == OPT_SPECIAL_unknown && (opt[1] == 'W' || opt[1] == 'f' || opt[1] == 'm') && opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-') @@ -161,7 +162,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, memcpy (dup + 2, opt + 5, len - 2 + 1); opt = dup; value = 0; - opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET); + opt_index = find_opt (opt + 1, lang_mask); } if (opt_index == OPT_SPECIAL_unknown) @@ -218,11 +219,11 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, } /* Check if this is a switch for a different front end. */ - if (!(option->flags & (lang_mask | CL_COMMON | CL_TARGET))) + if (!(option->flags & lang_mask)) errors |= CL_ERR_WRONG_LANG; else if ((option->flags & CL_TARGET) - && (option->flags & CL_LANG_ALL) - && !(option->flags & lang_mask)) + && (option->flags & (CL_LANG_ALL | CL_DRIVER)) + && !(option->flags & (lang_mask & ~CL_COMMON & ~CL_TARGET))) /* Complain for target flag language mismatches if any languages are specified. */ errors |= CL_ERR_WRONG_LANG; @@ -301,8 +302,9 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, array and *DECODED_OPTIONS_COUNT to the number of entries in the array. The first entry in the array is always one for the program name (OPT_SPECIAL_program_name). LANG_MASK indicates the language - applicable for decoding. Do not produce any diagnostics or set - state outside of these variables. */ + flags applicable for decoding (including CL_COMMON and CL_TARGET if + those options should be considered applicable). Do not produce any + diagnostics or set state outside of these variables. */ void decode_cmdline_options_to_array (unsigned int argc, const char **argv, -- cgit v1.1