diff options
author | Joseph Myers <joseph@codesourcery.com> | 2010-11-26 23:18:28 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-11-26 23:18:28 +0000 |
commit | e6d4b9841c35629de91c36ba40ed247fef749037 (patch) | |
tree | 36e9808ac190cda7d402aca282c7bbe11cbf8b71 /gcc/opts.h | |
parent | 8a1ffe230e5f07f6eef4bd30088f4245783109ec (diff) | |
download | gcc-e6d4b9841c35629de91c36ba40ed247fef749037.zip gcc-e6d4b9841c35629de91c36ba40ed247fef749037.tar.gz gcc-e6d4b9841c35629de91c36ba40ed247fef749037.tar.bz2 |
options.texi (Enum, EnumValue): Document new record types.
* doc/options.texi (Enum, EnumValue): Document new record types.
(Enum): Document new option flag.
* opt-functions.awk
* optc-gen.awk: Handle enumerated option arguments.
* opth-gen.awk: Handle enumerated option arguments.
* opts-common.c (enum_arg_ok_for_language, enum_arg_to_value,
enum_value_to_arg): New.
(decode_cmdline_option): Handle enumerated arguments.
(read_cmdline_option): Handle CL_ERR_ENUM_ARG.
(set_option, option_enabled, get_option_state): Handle CLVC_ENUM.
* opts.c (print_filtered_help, print_specific_help): Take
lang_mask arguments.
(print_filtered_help): Handle printing values of enumerated
options. Print possible arguments for enumerated options.
(print_specific_help): Update call to print_filtered_help.
(common_handle_option): Update calls to print_specific_help. Use
value rather than arg for OPT_fdiagnostics_show_location_. Don't
handle OPT_ffp_contract_, OPT_fexcess_precision_,
OPT_fvisibility_, OPT_ftls_model_, OPT_fira_algorithm_ or
OPT_fira_region_ here.
* opts.h (enum cl_var_type): Add CLVC_ENUM.
(struct cl_option): Add var_enum.
(CL_ENUM_CANONICAL, CL_ENUM_DRIVER_ONLY, struct cl_enum_arg,
struct cl_enum, cl_enums, cl_enums_count): New.
(CL_ERR_ENUM_ARG): Define.
(CL_ERR_NEGATIVE): Update value.
(enum_value_to_arg): Declare.
* common.opt (flag_ira_algorithm, flag_ira_region,
flag_fp_contract_mode, flag_excess_precision_cmdline,
default_visibility, flag_tls_default): Remove Variable entries.
(help_enum_printed): New Variable.
(fdiagnostics-show-location=): Use Enum. Add associated
SourceInclude, Enum and EnumValue entries.
(fexcess-precision=, ffp-contract=, fira-algorithm=, fira-region=,
ftls-model=, fvisibility=): Use Enum, Var and Init. Add
associated Enum and EnumValue entries.
po:
* exgettext: Handle UnknownError.
From-SVN: r167190
Diffstat (limited to 'gcc/opts.h')
-rw-r--r-- | gcc/opts.h | 57 |
1 files changed, 56 insertions, 1 deletions
@@ -42,6 +42,10 @@ enum cl_var_type { argument. */ CLVC_STRING, + /* The switch takes an enumerated argument (VAR_ENUM says what + enumeration) and FLAG_VAR points to that argument. */ + CLVC_ENUM, + /* The switch should be stored in the VEC pointed to by FLAG_VAR for later processing. */ CLVC_DEFER @@ -61,6 +65,7 @@ struct cl_option int neg_index; unsigned int flags; unsigned short flag_var_offset; + unsigned short var_enum; enum cl_var_type var_type; int var_value; }; @@ -111,6 +116,52 @@ extern const unsigned int cl_lang_count; #define CL_UINTEGER (1 << 29) /* Argument is an integer >=0. */ #define CL_UNDOCUMENTED (1 << 30) /* Do not output with --help. */ +/* Flags for an enumerated option argument. */ +#define CL_ENUM_CANONICAL (1 << 0) /* Canonical for this value. */ +#define CL_ENUM_DRIVER_ONLY (1 << 1) /* Only accepted in the driver. */ + +/* Structure describing an enumerated option argument. */ + +struct cl_enum_arg +{ + /* The argument text, or NULL at the end of the array. */ + const char *arg; + + /* The corresponding integer value. */ + int value; + + /* Flags associated with this argument. */ + unsigned int flags; +}; + +/* Structure describing an enumerated set of option arguments. */ + +struct cl_enum +{ + /* Help text, or NULL if the values should not be listed in --help + output. */ + const char *help; + + /* Error message for unknown arguments, or NULL to use a generic + error. */ + const char *unknown_error; + + /* Array of possible values. */ + const struct cl_enum_arg *values; + + /* The size of the type used to store a value. */ + size_t var_size; + + /* Function to set a variable of this type. */ + void (*set) (void *var, int value); + + /* Function to get the value of a variable of this type. */ + int (*get) (const void *var); +}; + +extern const struct cl_enum cl_enums[]; +extern const unsigned int cl_enums_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 OPT_SPECIAL_unknown is used for that. */ @@ -119,7 +170,8 @@ extern const unsigned int cl_lang_count; #define CL_ERR_MISSING_ARG (1 << 1) /* Argument required but missing. */ #define CL_ERR_WRONG_LANG (1 << 2) /* Option for wrong language. */ #define CL_ERR_UINT_ARG (1 << 3) /* Bad unsigned integer argument. */ -#define CL_ERR_NEGATIVE (1 << 4) /* Negative form of option +#define CL_ERR_ENUM_ARG (1 << 4) /* Bad enumerated argument. */ +#define CL_ERR_NEGATIVE (1 << 5) /* Negative form of option not permitted (together with OPT_SPECIAL_unknown). */ @@ -230,6 +282,9 @@ extern unsigned num_in_fnames; size_t find_opt (const char *input, int lang_mask); extern int integral_argument (const char *arg); +extern bool enum_value_to_arg (const struct cl_enum_arg *enum_args, + const char **argp, int value, + unsigned int lang_mask); extern void decode_cmdline_options_to_array (unsigned int argc, const char **argv, unsigned int lang_mask, |