GCC Middle and Back End API Reference
opts.h File Reference

Go to the source code of this file.

Data Structures

struct  cl_option
struct  cl_option_state
struct  cl_enum_arg
struct  cl_enum
struct  cl_decoded_option
struct  cl_deferred_option
struct  cl_option_handler_func
struct  cl_option_handlers

Enumerations

enum  cl_var_type {
  CLVC_BOOLEAN, CLVC_EQUAL, CLVC_BIT_CLEAR, CLVC_BIT_SET,
  CLVC_STRING, CLVC_ENUM, CLVC_DEFER
}

Functions

char * opts_concat (const char *first,...)
size_t find_opt (const char *input, unsigned int lang_mask)
int integral_argument (const char *arg)
bool enum_value_to_arg (const struct cl_enum_arg *enum_args, const char **argp, int value, unsigned int lang_mask)
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)
void init_options_once (void)
void init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
void decode_cmdline_options_to_array_default_mask (unsigned int argc, const char **argv, struct cl_decoded_option **decoded_options, unsigned int *decoded_options_count)
void set_default_handlers (struct cl_option_handlers *handlers)
void decode_options (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded_options, unsigned int decoded_options_count, location_t loc, diagnostic_context *dc)
int option_enabled (int opt_idx, void *opts)
bool get_option_state (struct gcc_options *, int, struct cl_option_state *)
void set_option (struct gcc_options *opts, struct gcc_options *opts_set, int opt_index, int value, const char *arg, int kind, location_t loc, diagnostic_context *dc)
void * option_flag_var (int opt_index, struct gcc_options *opts)
bool handle_generated_option (struct gcc_options *opts, struct gcc_options *opts_set, size_t opt_index, const char *arg, int value, unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc)
void generate_option (size_t opt_index, const char *arg, int value, unsigned int lang_mask, struct cl_decoded_option *decoded)
void generate_option_input_file (const char *file, struct cl_decoded_option *decoded)
void read_cmdline_option (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded, location_t loc, unsigned int lang_mask, const struct cl_option_handlers *handlers, diagnostic_context *dc)
void control_warning_option (unsigned int opt_index, int kind, bool imply, location_t loc, unsigned int lang_mask, const struct cl_option_handlers *handlers, struct gcc_options *opts, struct gcc_options *opts_set, diagnostic_context *dc)
void print_ignored_options (void)
void handle_common_deferred_options (void)
bool common_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc)
bool target_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc)
void finish_options (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc)
void default_options_optimization (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded_options, unsigned int decoded_options_count, location_t loc, unsigned int lang_mask, const struct cl_option_handlers *handlers, diagnostic_context *dc)
void set_struct_debug_option (struct gcc_options *opts, location_t loc, const char *value)
bool opt_enum_arg_to_value (size_t opt_index, const char *arg, int *value, unsigned int lang_mask)

Variables

struct cl_option cl_options []
const unsigned int cl_options_count
const char *const lang_names []
const unsigned int cl_lang_count
struct cl_enum cl_enums []
const unsigned int cl_enums_count
const char ** in_fnames
unsigned num_in_fnames
struct obstack opts_obstack

Enumeration Type Documentation

Specifies how a switch's VAR_VALUE relates to its FLAG_VAR.   
Enumerator:
CLVC_BOOLEAN 
CLVC_EQUAL 
CLVC_BIT_CLEAR 
CLVC_BIT_SET 
CLVC_STRING 
CLVC_ENUM 
CLVC_DEFER 

Function Documentation

bool common_handle_option ( struct gcc_options *  opts,
struct gcc_options *  opts_set,
const struct cl_decoded_option decoded,
unsigned int  lang_mask,
int  kind,
location_t  loc,
const struct cl_option_handlers handlers,
diagnostic_context dc 
)
void control_warning_option ( unsigned int  opt_index,
int  kind,
bool  imply,
location_t  loc,
unsigned int  lang_mask,
const struct cl_option_handlers handlers,
struct gcc_options *  opts,
struct gcc_options *  opts_set,
diagnostic_context dc 
)
Set a warning option OPT_INDEX (language mask LANG_MASK, option
   handlers HANDLERS) to have diagnostic kind KIND for option
   structures OPTS and OPTS_SET and diagnostic context DC (possibly
   NULL), at location LOC (UNKNOWN_LOCATION for -Werror=).  If IMPLY,
   the warning option in question is implied at this point.  This is
   used by -Werror= and #pragma GCC diagnostic.   

References cl_option::alias_target, cl_options, CLVC_BOOLEAN, diagnostic_classify_diagnostic(), and handle_generated_option().

Referenced by common_handle_option(), and enable_warning_as_error().

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 
)
Decode command-line options (ARGC and ARGV being the arguments of
   main) into an array, setting *DECODED_OPTIONS to a pointer to that
   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
   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.   

References cl_decoded_option::arg, cl_decoded_option::canonical_option, cl_decoded_option::canonical_option_num_elements, decode_cmdline_option(), cl_decoded_option::errors, generate_option_input_file(), cl_decoded_option::opt_index, cl_decoded_option::orig_option_with_args_text, prune_options(), cl_decoded_option::value, and cl_decoded_option::warn_message.

Referenced by decode_cmdline_options_to_array_default_mask(), do_self_spec(), get_options_from_collect_gcc_options(), and main().

void decode_cmdline_options_to_array_default_mask ( unsigned int  argc,
const char **  argv,
struct cl_decoded_option **  decoded_options,
unsigned int *  decoded_options_count 
)
Decode command-line options to an array, like
   decode_cmdline_options_to_array and with the same arguments but
   using the default lang_mask.   

References decode_cmdline_options_to_array(), and initial_lang_mask.

Referenced by toplev_main().

void decode_options ( struct gcc_options *  opts,
struct gcc_options *  opts_set,
struct cl_decoded_option decoded_options,
unsigned int  decoded_options_count,
location_t  loc,
diagnostic_context dc 
)
Parse command line options and set default flag values.  Do minimal
   options processing.  The decoded options are in *DECODED_OPTIONS
   and *DECODED_OPTIONS_COUNT; settings go in OPTS, OPTS_SET and DC;
   the options are located at LOC.   

References default_options_optimization(), finish_options(), initial_lang_mask, read_cmdline_options(), and set_default_handlers().

Referenced by toplev_main().

void default_options_optimization ( struct gcc_options *  opts,
struct gcc_options *  opts_set,
struct cl_decoded_option decoded_options,
unsigned int  decoded_options_count,
location_t  loc,
unsigned int  lang_mask,
const struct cl_option_handlers handlers,
diagnostic_context dc 
)
Default the options in OPTS and OPTS_SET based on the optimization
   settings in DECODED_OPTIONS and DECODED_OPTIONS_COUNT.   

References cl_decoded_option::arg, default_options_table, default_param_value(), error_at(), integral_argument(), maybe_default_options(), maybe_set_param_value(), and cl_decoded_option::opt_index.

Referenced by decode_options().

bool enum_value_to_arg ( const struct cl_enum_arg enum_args,
const char **  argp,
int  value,
unsigned int  lang_mask 
)
Look of VALUE in ENUM_ARGS for language LANG_MASK and store the
   corresponding string in *ARGP, returning true if the found string
   was marked as canonical, false otherwise.  If VALUE is not found
   (which may be the case for uninitialized values if the relevant
   option has not been passed), set *ARGP to NULL and return
   false.   

References cl_enum_arg::arg, enum_arg_ok_for_language(), and cl_option::flags.

Referenced by decode_cmdline_option(), and print_filtered_help().

size_t find_opt ( const char *  input,
unsigned int  lang_mask 
)
void finish_options ( struct gcc_options *  opts,
struct gcc_options *  opts_set,
location_t  loc 
)
After all options at LOC have been read into OPTS and OPTS_SET,
   finalize settings of those options and diagnose incompatible
   combinations.   

References base_of_path(), error_at(), inform(), maybe_set_param_value(), memcpy(), opts_concat(), opts_obstack, sorry(), strlen(), UI_SJLJ, and UI_TARGET.

Referenced by decode_options().

void generate_option ( size_t  opt_index,
const char *  arg,
int  value,
unsigned int  lang_mask,
struct cl_decoded_option decoded 
)
bool get_option_state ( struct gcc_options *  opts,
int  option,
struct cl_option_state state 
)
bool handle_generated_option ( struct gcc_options *  opts,
struct gcc_options *  opts_set,
size_t  opt_index,
const char *  arg,
int  value,
unsigned int  lang_mask,
int  kind,
location_t  loc,
const struct cl_option_handlers handlers,
diagnostic_context dc 
)
Like handle_option, but OPT_INDEX, ARG and VALUE describe the
   option instead of DECODED.  This is used for callbacks when one
   option implies another instead of an option being decoded from the
   command line.   

References generate_option(), and handle_option().

Referenced by control_warning_option(), and maybe_default_option().

void init_options_once ( void  )
Initialize global options-related settings at start-up.   

References global_dc, initial_lang_mask, lang_hooks::initialize_diagnostics, and lang_hooks::option_lang_mask.

Referenced by toplev_main().

void init_options_struct ( struct gcc_options *  opts,
struct gcc_options *  opts_set 
)
int integral_argument ( const char *  arg)
bool opt_enum_arg_to_value ( size_t  opt_index,
const char *  arg,
int *  value,
unsigned int  lang_mask 
)
Look up ARG in the enum used by option OPT_INDEX for language
   LANG_MASK, returning true and storing the value in *VALUE if found,
   and returning false without modifying *VALUE if not found.   

References cl_enums, cl_options, CLVC_ENUM, enum_arg_to_value(), option(), cl_enum::values, cl_option::var_enum, and cl_option::var_type.

int option_enabled ( int  opt_idx,
void *  opts 
)
void* option_flag_var ( int  opt_index,
struct gcc_options *  opts 
)
char* opts_concat ( const char *  first,
  ... 
)
void print_ignored_options ( void  )
Produce a warning for each option previously buffered.   

References warning_at().

Referenced by toplev_main().

void read_cmdline_option ( struct gcc_options *  opts,
struct gcc_options *  opts_set,
struct cl_decoded_option decoded,
location_t  loc,
unsigned int  lang_mask,
const struct cl_option_handlers handlers,
diagnostic_context dc 
)
void set_default_handlers ( struct cl_option_handlers handlers)
void set_option ( struct gcc_options *  opts,
struct gcc_options *  opts_set,
int  opt_index,
int  value,
const char *  arg,
int  kind,
location_t  loc,
diagnostic_context dc 
)
Set any field in OPTS, and OPTS_SET if not NULL, for option
   OPT_INDEX according to VALUE and ARG, diagnostic kind KIND,
   location LOC, using diagnostic context DC if not NULL for
   diagnostic classification.   

References cl_enums, cl_option::cl_host_wide_int, cl_options, CLVC_BIT_CLEAR, CLVC_BIT_SET, CLVC_BOOLEAN, CLVC_DEFER, CLVC_ENUM, CLVC_EQUAL, CLVC_STRING, diagnostic_classify_diagnostic(), HOST_WIDE_INT, option(), option_flag_var(), cl_enum::set, cl_option::var_enum, cl_option::var_type, and cl_option::var_value.

Referenced by handle_option().

bool target_handle_option ( struct gcc_options *  opts,
struct gcc_options *  opts_set,
const struct cl_decoded_option decoded,
unsigned int  lang_mask,
int  kind,
location_t  loc,
const struct cl_option_handlers handlers,
diagnostic_context dc 
)
Handle a back-end option; arguments and return value as for
   handle_option.   

References global_dc.

Referenced by set_default_handlers(), and set_option_handlers().


Variable Documentation

const unsigned int cl_enums_count

Referenced by print_filtered_help().

const unsigned int cl_lang_count
const char** in_fnames
Input file names.   

Referenced by add_input_filename().

const char* const lang_names[]
unsigned num_in_fnames
The count of input filenames.   

Referenced by add_input_filename().

struct obstack opts_obstack