GCC Middle and Back End API Reference
|
Typedefs | |
typedef char * | char_p |
Functions | |
static void | set_Wstrict_aliasing (struct gcc_options *opts, int onoff) |
void | set_struct_debug_option (struct gcc_options *opts, location_t loc, const char *spec) |
void | strip_off_ending () |
int | base_of_path () |
static void | handle_param (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc, const char *carg) |
static void | set_debug_level (enum debug_info_type type, int extended, const char *arg, struct gcc_options *opts, struct gcc_options *opts_set, location_t loc) |
static void | set_fast_math_flags (struct gcc_options *opts, int set) |
static void | decode_d_option (const char *arg, struct gcc_options *opts, location_t loc, diagnostic_context *dc) |
static void | set_unsafe_math_optimizations_flags (struct gcc_options *opts, int set) |
static void | enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, const struct cl_option_handlers *handlers, struct gcc_options *opts, struct gcc_options *opts_set, location_t loc, 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) |
static void | add_comma_separated_to_vector () |
void | init_options_struct () |
static void | maybe_default_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct default_options *default_opt, int level, bool size, bool fast, bool debug, unsigned int lang_mask, const struct cl_option_handlers *handlers, location_t loc, diagnostic_context *dc) |
static void | maybe_default_options (struct gcc_options *opts, struct gcc_options *opts_set, const struct default_options *default_opts, int level, bool size, bool fast, bool debug, unsigned int lang_mask, const struct cl_option_handlers *handlers, location_t loc, diagnostic_context *dc) |
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 | finish_options (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc) |
static void | wrap_help (const char *help, const char *item, unsigned int item_width, unsigned int columns) |
static void | print_filtered_help (unsigned int include_flags, unsigned int exclude_flags, unsigned int any_flags, unsigned int columns, struct gcc_options *opts, unsigned int lang_mask) |
static void | print_specific_help (unsigned int include_flags, unsigned int exclude_flags, unsigned int any_flags, struct gcc_options *opts, unsigned int lang_mask) |
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) |
static void | set_Wstrict_aliasing () |
static void | set_fast_math_flags () |
static void | set_unsafe_math_optimizations_flags () |
bool | fast_math_flags_set_p () |
bool | fast_math_flags_struct_set_p () |
static void | setup_core_dumping () |
char * | option_name (diagnostic_context *context, int option_index, diagnostic_t orig_diag_kind, diagnostic_t diag_kind) |
Variables | |
const char *const | debug_type_names [] |
static const char | undocumented_msg [] = N_("This switch lacks documentation") |
static struct default_options | default_options_table [] |
typedef char* char_p |
|
static |
Add comma-separated strings to a char_p vector.
References vec_check_alloc().
Referenced by common_handle_option().
int base_of_path | ( | ) |
Find the base name of a path, stripping off both directories and a single final extension.
References path.
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 | ||
) |
Handle target- and language-independent options. Return zero to generate an "unknown option" message. Only options that need extra handling need to be listed here; if you simply want DECODED->value assigned to a variable, it happens automatically.
References add_comma_separated_to_vector(), cl_decoded_option::arg, cl_decoded_option::canonical_option_num_elements, cl_lang_count, colorize_init(), control_warning_option(), DBX_DEBUG, diagnostic_context::dc_inhibit_warnings, diagnostic_context::dc_warn_system_headers, decode_d_option(), diagnostic_set_caret_max_width(), DWARF2_DEBUG, enable_warning_as_error(), error_at(), diagnostic_context::fatal_errors, free(), FULL_BUILTIN_STACK_CHECK, GENERIC_STACK_CHECK, handle_param(), lang_names, len, diagnostic_context::max_errors, NO_DEBUG, NO_STACK_CHECK, cl_decoded_option::opt_index, option_flag_var(), diagnostic_context::pedantic_errors, pflags, pp_set_line_maximum_length(), print_specific_help(), diagnostic_context::printer, SDB_DEBUG, set_debug_level(), set_fast_math_flags(), set_param_value(), set_unsafe_math_optimizations_flags(), set_Wstrict_aliasing(), diagnostic_context::show_caret, diagnostic_context::show_column, diagnostic_context::show_option_requested, STATIC_BUILTIN_STACK_CHECK, strip_off_ending(), strlen(), cl_decoded_option::value, VMS_DEBUG, WARN_STRICT_OVERFLOW_CONDITIONAL, diagnostic_context::warning_as_error_requested, warning_at(), and XCOFF_DEBUG.
Referenced by set_default_handlers(), and set_option_handlers().
|
static |
Parse a -d<ARG> command line switch for OPTS, location LOC, diagnostic context DC.
References setup_core_dumping(), and warning_at().
Referenced by common_handle_option().
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().
|
static |
Enable (or disable if VALUE is 0) a warning option ARG (language mask LANG_MASK, option handlers HANDLERS) as an error for option structures OPTS and OPTS_SET, diagnostic context DC (possibly NULL), location LOC. This is used by -Werror=.
References control_warning_option(), error_at(), find_opt(), free(), and strlen().
Referenced by common_handle_option().
bool fast_math_flags_set_p | ( | ) |
Return true iff flags in OPTS are set as if -ffast-math.
bool fast_math_flags_struct_set_p | ( | ) |
Return true iff flags are set as if -ffast-math but using the flags stored in the struct cl_optimization structure.
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().
|
static |
Handle --param NAME=VALUE.
References error_at(), free(), integral_argument(), and set_param_value().
Referenced by common_handle_option().
void init_options_struct | ( | ) |
Initialize OPTS and OPTS_SET before using them in parsing options.
References get_num_compiler_params(), init_param_values(), memset(), and opts_obstack.
Referenced by main(), and toplev_main().
|
static |
If indicated by the optimization level LEVEL (-Os if SIZE is set, -Ofast if FAST is set, -Og if DEBUG is set), apply the option DEFAULT_OPT to OPTS and OPTS_SET, diagnostic context DC, location LOC, with language mask LANG_MASK and option handlers HANDLERS.
References cl_options, cl_option::cl_reject_negative, debug, handle_generated_option(), and option().
Referenced by maybe_default_options().
|
static |
As indicated by the optimization level LEVEL (-Os if SIZE is set, -Ofast if FAST is set), apply the options in array DEFAULT_OPTS to OPTS and OPTS_SET, diagnostic context DC, location LOC, with language mask LANG_MASK and option handlers HANDLERS.
References maybe_default_option().
Referenced by default_options_optimization().
char* option_name | ( | diagnostic_context * | context, |
int | option_index, | ||
diagnostic_t | orig_diag_kind, | ||
diagnostic_t | diag_kind | ||
) |
Return malloced memory for the name of the option OPTION_INDEX which enabled a diagnostic (context CONTEXT), originally of type ORIG_DIAG_KIND but possibly converted to DIAG_KIND by options such as -Werror.
References cl_options, and diagnostic_context::warning_as_error_requested.
Referenced by general_init().
|
static |
Print help for a specific front-end, etc.
References cl_enum_arg::arg, cl_enums, cl_enums_count, cl_lang_count, cl_options, cl_options_count, CLVC_DEFER, CLVC_ENUM, CLVC_STRING, compiler_params, enum_value_to_arg(), cl_option::flags, cl_enum::get, param_info::help, cl_option::help, lang_names, LAST_PARAM, len, cl_option::opt_text, param_info::option, option(), option_enabled(), option_flag_var(), snprintf(), strlen(), undocumented_msg, cl_enum::values, cl_option::var_enum, cl_option::var_type, and wrap_help().
Referenced by print_specific_help().
|
static |
Display help for a specified type of option. The options must have ALL of the INCLUDE_FLAGS set ANY of the flags in the ANY_FLAGS set and NONE of the EXCLUDE_FLAGS set. The current option state is in OPTS; LANG_MASK is used for interpreting enumerated option state.
References cl_lang_count, getenv(), internal_error(), lang_names, and print_filtered_help().
Referenced by common_handle_option().
|
static |
Handle a debug output -g switch for options OPTS (OPTS_SET->x_write_symbols storing whether a debug type was passed explicitly), location LOC. EXTENDED is true or false to support extended output (2 is special and means "-ggdb" was given).
References DBX_DEBUG, debug_type_names, DINFO_LEVEL_NORMAL, DWARF2_DEBUG, error_at(), integral_argument(), NO_DEBUG, type(), and warning_at().
Referenced by common_handle_option().
|
static |
Referenced by common_handle_option().
|
static |
The following routines are useful in setting all the flags that -ffast-math and -fno-fast-math imply.
References set_unsafe_math_optimizations_flags().
void set_struct_debug_option | ( | struct gcc_options * | opts, |
location_t | loc, | ||
const char * | spec | ||
) |
|
static |
Referenced by common_handle_option(), and set_fast_math_flags().
|
static |
When -funsafe-math-optimizations is set the following flags are set as well.
|
static |
@verbatim Command line option handling.
Copyright (C) 2002-2013 Free Software Foundation, Inc. Contributed by Neil Booth.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
Referenced by common_handle_option().
|
static |
Used to set the level of strict aliasing warnings in OPTS, when no level is specified (i.e., when -Wstrict-aliasing, and not -Wstrict-aliasing=level was given). ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified, and 0 otherwise. After calling this function, wstrict_aliasing will be set to the default value of -Wstrict_aliasing=level, currently 3.
|
static |
Arrange to dump core on error for diagnostic context DC. (The regular error message is still printed first, except in the case of abort ().)
References fatal_error(), getrlimit(), and setrlimit().
Referenced by decode_d_option().
void strip_off_ending | ( | ) |
Strip off a legitimate source ending from the input string NAME of length LEN. Rather than having to know the names used by all of our front ends, we strip off an ending of a period followed by up to five characters. (Java uses ".class".)
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().
|
static |
Output ITEM, of length ITEM_WIDTH, in the left column, followed by word-wrapped HELP in a second column.
Referenced by print_filtered_help().
const char* const debug_type_names[] |
Indexed by enum debug_info_type.
Referenced by process_options(), and set_debug_level().
|
static |
Table of options enabled by default at different levels.
Referenced by default_options_optimization().
|
static |
What to print when a switch has no documentation.
Referenced by print_filtered_help().