aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-06-20 22:02:46 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2010-06-20 22:02:46 +0100
commit6e2f19568ad7378a11073048ffb2372045dc665a (patch)
tree2c4f1fab67e1d031a842bdda5d4777aed748b3b5 /gcc/opts.h
parent1d63e3de09ef2a47b63f29db8da5289404cec4d1 (diff)
downloadgcc-6e2f19568ad7378a11073048ffb2372045dc665a.zip
gcc-6e2f19568ad7378a11073048ffb2372045dc665a.tar.gz
gcc-6e2f19568ad7378a11073048ffb2372045dc665a.tar.bz2
re PR other/32998 (-frecord-gcc-switches issues)
PR other/32998 * opth-gen.awk: Generate definitions of OPT_SPECIAL_unknown, OPT_SPECIAL_program_name and OPT_SPECIAL_input_file. * opts-common.c (find_opt): Return OPT_SPECIAL_unknown on failure. (decode_cmdline_option): Update for this return value. Set orig_option_with_args_text field. Set arg field for unknown options. Make static. (decode_cmdline_options_to_array): New. (prune_options): Update handling of find_opt return value. * opts.c (read_cmdline_option): Take decoded option. Return void. (read_cmdline_options): Take decoded options. (decode_options): Add parameters for decoded options. Use decode_cmdline_options_to_array. Use decoded options for -O scan. Use integral_argument for -O parameters. Update call to read_cmdline_options. (enable_warning_as_error): Update handling of find_opt return value. * opts.h: Update comment on unknown options. (struct cl_decoded_option): Update comments on opt_index and arg. Add orig_option_with_args_text. (decode_cmdline_option): Remove. (decode_cmdline_options_to_array): Declare. (decode_options): Update prototype. * toplev.c (save_argv): Remove. (save_decoded_options, save_decoded_options_count): New. (read_integral_parameter): Remove. (print_switch_values): Use decoded options. (toplev_main): Don't set save_argv. Update call to decode_options. * toplev.h (read_integral_parameter): Remove. * varasm.c (elf_record_gcc_switches): Don't handle holding back names. c-family: * c-common.c (parse_optimize_options): Update call to decode_options. fortran: * options.c (gfc_handle_option): Don't handle N_OPTS. testsuite: * gcc.dg/opts-2.c: New test. From-SVN: r161053
Diffstat (limited to 'gcc/opts.h')
-rw-r--r--gcc/opts.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/gcc/opts.h b/gcc/opts.h
index c50cbca..554bb23 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -92,7 +92,7 @@ extern const unsigned int cl_lang_count;
/* Possible ways in which a command-line option may be erroneous.
These do not include not being known at all; an option index of
- cl_options_count is used for that. */
+ OPT_SPECIAL_unknown is used for that. */
#define CL_ERR_DISABLED (1 << 0) /* Disabled in this configuration. */
#define CL_ERR_MISSING_ARG (1 << 1) /* Argument required but missing. */
@@ -103,12 +103,20 @@ extern const unsigned int cl_lang_count;
struct cl_decoded_option
{
- /* The index of this option, or cl_options_count if not known. */
+ /* The index of this option, or an OPT_SPECIAL_* value for
+ non-options and unknown options. */
size_t opt_index;
- /* The string argument, or NULL if none. */
+ /* The string argument, or NULL if none. For OPT_SPECIAL_* cases,
+ the option or non-option command-line argument. */
const char *arg;
+ /* The original text of option plus arguments, with separate argv
+ elements concatenated into one string with spaces separating
+ them. This is for such uses as diagnostics and
+ -frecord-gcc-switches. */
+ const char *orig_option_with_args_text;
+
/* For a boolean option, 1 for the true case and 0 for the "no-"
case. For an unsigned integer option, the value of the
argument. 1 in all other cases. */
@@ -128,11 +136,15 @@ extern unsigned num_in_fnames;
size_t find_opt (const char *input, int lang_mask);
extern int integral_argument (const char *arg);
-extern unsigned int decode_cmdline_option (const char **argv,
- unsigned int lang_mask,
- struct cl_decoded_option *decoded);
+extern void decode_cmdline_options_to_array (unsigned int argc,
+ const char **argv,
+ unsigned int lang_mask,
+ struct cl_decoded_option **decoded_options,
+ unsigned int *decoded_options_count);
extern void prune_options (int *argcp, char ***argvp);
-extern void decode_options (unsigned int argc, const char **argv);
+extern void decode_options (unsigned int argc, const char **argv,
+ struct cl_decoded_option **decoded_options,
+ unsigned int *decoded_options_count);
extern int option_enabled (int opt_idx);
extern bool get_option_state (int, struct cl_option_state *);
extern void set_option (int opt_index, int value, const char *arg, int);