GCC Middle and Back End API Reference
|
#include "rich-location.h"
#include "obstack.h"
Go to the source code of this file.
Data Structures | |
struct | cl_option |
struct | cl_var |
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 |
struct | sanitizer_opts_s |
struct | zero_call_used_regs_opts_s |
struct | switchstr |
Macros | |
#define | CL_PARAMS (1U << 16) /* Fake entry. Used to display --param info with --help. @endverbatim */ |
#define | CL_WARNING (1U << 17) /* Enables an (optional) warning message. @endverbatim */ |
#define | CL_OPTIMIZATION (1U << 18) /* Enables an (optional) optimization. @endverbatim */ |
#define | CL_DRIVER (1U << 19) /* Driver option. @endverbatim */ |
#define | CL_TARGET (1U << 20) /* Target-specific option. @endverbatim */ |
#define | CL_COMMON (1U << 21) /* Language-independent. @endverbatim */ |
#define | CL_MIN_OPTION_CLASS CL_PARAMS |
#define | CL_MAX_OPTION_CLASS CL_COMMON |
#define | CL_JOINED (1U << 22) /* If takes joined argument. @endverbatim */ |
#define | CL_SEPARATE (1U << 23) /* If takes a separate argument. @endverbatim */ |
#define | CL_UNDOCUMENTED (1U << 24) /* Do not output with --help. @endverbatim */ |
#define | CL_NO_DWARF_RECORD (1U << 25) /* Do not add to producer string. @endverbatim */ |
#define | CL_PCH_IGNORE (1U << 26) /* Do compare state for pch. @endverbatim */ |
#define | CL_ENUM_CANONICAL (1 << 0) /* Canonical for this value. @endverbatim */ |
#define | CL_ENUM_DRIVER_ONLY (1 << 1) /* Only accepted in the driver. @endverbatim */ |
#define | CL_ENUM_SET_SHIFT 2 /* Shift for enum set. @endverbatim */ |
#define | CL_ERR_DISABLED (1 << 0) /* Disabled in this configuration. @endverbatim */ |
#define | CL_ERR_MISSING_ARG (1 << 1) /* Argument required but missing. @endverbatim */ |
#define | CL_ERR_WRONG_LANG (1 << 2) /* Option for wrong language. @endverbatim */ |
#define | CL_ERR_UINT_ARG (1 << 3) /* Bad unsigned integer argument. @endverbatim */ |
#define | CL_ERR_INT_RANGE_ARG (1 << 4) /* Bad unsigned integer argument. @endverbatim */ |
#define | CL_ERR_ENUM_ARG (1 << 5) /* Bad enumerated argument. @endverbatim */ |
#define | CL_ERR_NEGATIVE |
#define | CL_ERR_ENUM_SET_ARG (1 << 7) /* Bad argument of enumerated set. @endverbatim */ |
#define | SET_OPTION_IF_UNSET(OPTS, OPTS_SET, OPTION, VALUE) |
#define | OPTION_SET_P(OPTION) |
#define | SWITCH_LIVE (1 << 0) |
#define | SWITCH_FALSE (1 << 1) |
#define | SWITCH_IGNORE (1 << 2) |
#define | SWITCH_IGNORE_PERMANENTLY (1 << 3) |
#define | SWITCH_KEEP_FOR_GCC (1 << 4) |
Enumerations | |
enum | cl_var_type { CLVC_INTEGER , CLVC_EQUAL , CLVC_BIT_CLEAR , CLVC_BIT_SET , CLVC_SIZE , CLVC_STRING , CLVC_ENUM , CLVC_DEFER } |
enum | cl_enum_var_value { CLEV_NORMAL , CLEV_SET , CLEV_BITSET } |
Functions | |
const char * | get_opt_url_suffix (int option_index, unsigned lang_mask) |
char * | opts_concat (const char *first,...) |
size_t | find_opt (const char *input, unsigned int lang_mask) |
HOST_WIDE_INT | integral_argument (const char *arg, int *=NULL, bool=false) |
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 | init_opts_obstack (void) |
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(*target_option_override_hook)(void)) |
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, void(*target_option_override_hook)(void)) |
int | option_enabled (int opt_idx, unsigned lang_mask, 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, size_t opt_index, HOST_WIDE_INT value, const char *arg, int kind, location_t loc, diagnostic_context *dc, HOST_WIDE_INT=0) |
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, HOST_WIDE_INT value, unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, bool generated_p, diagnostic_context *dc) |
void | generate_option (size_t opt_index, const char *arg, HOST_WIDE_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, const char *arg, 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) |
char * | write_langs (unsigned int mask) |
void | print_ignored_options (void) |
void | handle_common_deferred_options (void) |
void | handle_deferred_dump_options (void) |
unsigned int | parse_sanitizer_options (const char *, location_t, int, unsigned int, int, bool) |
unsigned int | parse_no_sanitize_attribute (char *value) |
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(*target_option_override_hook)(void)) |
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(*target_option_override_hook)(void)) |
void | finish_options (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc) |
void | diagnose_options (gcc_options *opts, gcc_options *opts_set, location_t loc) |
void | print_help (struct gcc_options *opts, unsigned int lang_mask, const char *help_option_argument) |
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) |
const char * | get_option_prefix_remapping (const char *p, size_t sz, const char **out_new_prefix) |
void | add_misspelling_candidates (auto_vec< char * > *candidates, const struct cl_option *option, const char *base_option) |
const char * | candidates_list_and_hint (const char *arg, char *&str, const auto_vec< const char * > &candidates) |
bool | parse_and_check_align_values (const char *flag, const char *name, auto_vec< unsigned > &result_values, bool report_error, location_t loc) |
void | parse_and_check_patch_area (const char *arg, bool report_error, HOST_WIDE_INT *patch_area_size, HOST_WIDE_INT *patch_area_start) |
void | parse_options_from_collect_gcc_options (const char *, obstack *, int *) |
void | prepend_xassembler_to_collect_as_options (const char *, obstack *) |
char * | gen_command_line_string (cl_decoded_option *options, unsigned int options_count) |
char * | gen_producer_string (const char *language_string, cl_decoded_option *options, unsigned int options_count) |
label_text | get_option_url_suffix (int option_index, unsigned lang_mask) |
Variables | |
const struct cl_option | cl_options [] |
const unsigned int | cl_options_count |
const char *const | lang_names [] |
const unsigned int | cl_lang_count |
const struct cl_enum | cl_enums [] |
const unsigned int | cl_enums_count |
const char * | opt_fstack_limit_symbol_arg |
int | opt_fstack_limit_register_no |
bool | flag_stack_protector_set_by_fhardened_p |
const char ** | in_fnames |
unsigned | num_in_fnames |
struct obstack | opts_obstack |
const struct sanitizer_opts_s | sanitizer_opts [] |
const struct zero_call_used_regs_opts_s | zero_call_used_regs_opts [] |
vec< const char * > | help_option_arguments |
#define CL_COMMON (1U << 21) /* Language-independent. @endverbatim */ |
#define CL_DRIVER (1U << 19) /* Driver option. @endverbatim */ |
Referenced by append_linker_options(), common_handle_option(), complain_wrong_lang(), driver::decode_argv(), decode_cmdline_option(), do_self_spec(), enum_arg_ok_for_language(), get_options_from_collect_gcc_options(), lto_write_options(), option_ok_for_language(), print_filtered_help(), print_help(), print_specific_help(), process_command(), remapping_prefix_p(), and set_option_handlers().
#define CL_ENUM_CANONICAL (1 << 0) /* Canonical for this value. @endverbatim */ |
Flags for an enumerated option argument.
Referenced by enum_value_to_arg().
#define CL_ENUM_DRIVER_ONLY (1 << 1) /* Only accepted in the driver. @endverbatim */ |
Referenced by enum_arg_ok_for_language().
#define CL_ENUM_SET_SHIFT 2 /* Shift for enum set. @endverbatim */ |
Referenced by cmdline_handle_error(), and decode_cmdline_option().
#define CL_ERR_DISABLED (1 << 0) /* Disabled in this configuration. @endverbatim */ |
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.
Referenced by cmdline_handle_error(), and decode_cmdline_option().
#define CL_ERR_ENUM_ARG (1 << 5) /* Bad enumerated argument. @endverbatim */ |
Referenced by cmdline_handle_error(), control_warning_option(), and decode_cmdline_option().
#define CL_ERR_ENUM_SET_ARG (1 << 7) /* Bad argument of enumerated set. @endverbatim */ |
Referenced by cmdline_handle_error(), and decode_cmdline_option().
#define CL_ERR_INT_RANGE_ARG (1 << 4) /* Bad unsigned integer argument. @endverbatim */ |
Referenced by cmdline_handle_error(), and decode_cmdline_option().
#define CL_ERR_MISSING_ARG (1 << 1) /* Argument required but missing. @endverbatim */ |
Referenced by cmdline_handle_error(), control_warning_option(), and decode_cmdline_option().
#define CL_ERR_NEGATIVE |
Referenced by decode_cmdline_option(), driver_unknown_option_callback(), and unknown_option_callback().
#define CL_ERR_UINT_ARG (1 << 3) /* Bad unsigned integer argument. @endverbatim */ |
Referenced by cmdline_handle_error(), control_warning_option(), and decode_cmdline_option().
#define CL_ERR_WRONG_LANG (1 << 2) /* Option for wrong language. @endverbatim */ |
Referenced by decode_cmdline_option(), generate_option(), prune_options(), and read_cmdline_option().
#define CL_JOINED (1U << 22) /* If takes joined argument. @endverbatim */ |
From here on the bits describe attributes of the options. Before this point the bits have described the class of the option. This distinction is important because --help will not list options which only have these higher bits set.
Referenced by control_warning_option(), decode_cmdline_option(), enable_warning_as_error(), find_opt(), generate_canonical_option(), print_filtered_help(), print_help(), print_specific_help(), prune_options(), and remapping_prefix_p().
#define CL_MAX_OPTION_CLASS CL_COMMON |
Referenced by common_handle_option(), and print_specific_help().
#define CL_MIN_OPTION_CLASS CL_PARAMS |
Referenced by common_handle_option(), and print_specific_help().
#define CL_NO_DWARF_RECORD (1U << 25) /* Do not add to producer string. @endverbatim */ |
Referenced by gen_command_line_string().
#define CL_OPTIMIZATION (1U << 18) /* Enables an (optional) optimization. @endverbatim */ |
Referenced by toplev::main(), print_help(), and print_specific_help().
#define CL_PARAMS (1U << 16) /* Fake entry. Used to display --param info with --help. @endverbatim */ |
Referenced by maybe_default_option(), print_help(), and print_specific_help().
Referenced by option_affects_pch_p().
#define CL_SEPARATE (1U << 23) /* If takes a separate argument. @endverbatim */ |
Referenced by decode_cmdline_option(), generate_canonical_option(), print_help(), and print_specific_help().
#define CL_TARGET (1U << 20) /* Target-specific option. @endverbatim */ |
Referenced by append_compiler_options(), append_linker_options(), option_proposer::build_option_suggestions(), common_handle_option(), decode_cmdline_options_to_array_default_mask(), lto_write_options(), merge_and_complain(), option_affects_pch_p(), option_ok_for_language(), print_filtered_help(), print_help(), print_specific_help(), remapping_prefix_p(), set_default_handlers(), and set_option_handlers().
#define CL_UNDOCUMENTED (1U << 24) /* Do not output with --help. @endverbatim */ |
Referenced by common_handle_option(), print_filtered_help(), print_help(), print_specific_help(), and remapping_prefix_p().
#define CL_WARNING (1U << 17) /* Enables an (optional) warning message. @endverbatim */ |
Referenced by enable_warning_as_error(), lto_write_options(), print_help(), and print_specific_help().
#define OPTION_SET_P | ( | OPTION | ) |
Return true if OPTION is set by user in global options.
Referenced by default_max_noce_ifcvt_seq_cost(), expand_omp_simd(), lto_write_options(), oacc_xform_loop(), omp_max_vf(), process_options(), and sra_get_max_scalarization_size().
#define SET_OPTION_IF_UNSET | ( | OPTS, | |
OPTS_SET, | |||
OPTION, | |||
VALUE ) |
Set OPTION in OPTS to VALUE if the option is not set in OPTS_SET.
Referenced by common_handle_option(), default_options_optimization(), enable_fdo_optimizations(), and finish_options().
#define SWITCH_FALSE (1 << 1) |
Referenced by check_live_switch().
#define SWITCH_IGNORE (1 << 2) |
Referenced by do_self_spec(), do_spec_1(), give_switch(), used_arg_t::operator()(), and set_collect_gcc_options().
#define SWITCH_IGNORE_PERMANENTLY (1 << 3) |
Referenced by check_live_switch(), and do_self_spec().
#define SWITCH_KEEP_FOR_GCC (1 << 4) |
Referenced by do_spec_1(), and set_collect_gcc_options().
#define SWITCH_LIVE (1 << 0) |
Find all the switches given to us and make a vector describing them. The elements of the vector are strings, one per switch given. If a switch uses following arguments, then the `part1' field is the switch itself and the `args' field is a null-terminated vector containing the following arguments. Bits in the `live_cond' field are: SWITCH_LIVE to indicate this switch is true in a conditional spec. SWITCH_FALSE to indicate this switch is overridden by a later switch. SWITCH_IGNORE to indicate this switch should be ignored (used in %<S). SWITCH_IGNORE_PERMANENTLY to indicate this switch should be ignored. SWITCH_KEEP_FOR_GCC to indicate that this switch, otherwise ignored, should be included in COLLECT_GCC_OPTIONS. in all do_spec calls afterwards. Used for %<S from self specs. The `known' field describes whether this is an internal switch. The `validated' field describes whether any spec has looked at this switch; if it remains false at the end of the run, the switch must be meaningless. The `ordering' field is used to temporarily mark switches that have to be kept in a specific order.
Referenced by check_live_switch().
enum cl_enum_var_value |
enum cl_var_type |
Command line option handling. Copyright (C) 2002-2024 Free Software Foundation, Inc. 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/>.
Specifies how a switch's VAR_VALUE relates to its FLAG_VAR.
Enumerator | |
---|---|
CLVC_INTEGER | |
CLVC_EQUAL | |
CLVC_BIT_CLEAR | |
CLVC_BIT_SET | |
CLVC_SIZE | |
CLVC_STRING | |
CLVC_ENUM | |
CLVC_DEFER |
|
extern |
Helper function for gcc.cc's driver::suggest_option, for populating the vec of suggestions for misspelled options. option_map above provides various prefixes for spelling command-line options, which decode_cmdline_option uses to map spellings of options to specific options. We want to do the reverse: to find all the ways that a user could validly spell an option. Given valid OPT_TEXT (with a leading dash) for OPTION, add it and all of its valid variant spellings to CANDIDATES, each without a leading dash. For example, given "-Wabi-tag", the following are added to CANDIDATES: "Wabi-tag" "Wno-abi-tag" "-warn-abi-tag" "-warn-no-abi-tag". The added strings must be freed using free.
References candidates, gcc_assert, i, option_map::negated, option_map::new_prefix, NULL, option_map::opt0, option_map::opt1, option(), and remapping_prefix_p().
Referenced by option_proposer::build_option_suggestions().
|
extern |
Helper function for listing valid choices and hint for misspelled value. CANDIDATES is a vector containing all valid strings, STR is set to a heap allocated string that contains all those strings concatenated, separated by spaces, and the return value is the closest string from those to ARG, or NULL if nothing is close enough. Callers should XDELETEVEC (STR) after using it to avoid memory leaks.
References candidate(), candidates, find_closest_string(), FOR_EACH_VEC_ELT, gcc_assert, and i.
Referenced by check_offload_target_name(), and cmdline_handle_error().
|
extern |
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, BTF_DEBUG, CALLGRAPH_INFO_DYNAMIC_ALLOC, CALLGRAPH_INFO_NAKED, CALLGRAPH_INFO_STACK_USAGE, cl_decoded_option::canonical_option_num_elements, check_alignment_argument(), CL_DRIVER, cl_lang_count, CL_MAX_OPTION_CLASS, CL_MIN_OPTION_CLASS, CL_TARGET, CL_UNDOCUMENTED, CODEVIEW_DEBUG, control_warning_option(), CTF_DEBUG, CTFINFO_LEVEL_NONE, decode_d_option(), DEFAULT_GDB_EXTENSIONS, diagnostic_color_init(), diagnostic_output_format_init(), diagnostic_set_caret_max_width(), diagnostic_urls_init(), DINFO_LEVEL_NORMAL, DWARF2_DEBUG, enable_fdo_optimizations(), enable_warning_as_error(), diagnostic_source_printing_options::enabled, error_at(), EXTRA_DIAGNOSTIC_OUTPUT_fixits_v1, EXTRA_DIAGNOSTIC_OUTPUT_none, flag_canon_prefix_map, free(), FULL_BUILTIN_STACK_CHECK, gcc_assert, gcc_checking_assert, GENERIC_STACK_CHECK, diagnostic_context::get_reference_printer(), handle_OPT_fdiagnostics_add_output_(), handle_OPT_fdiagnostics_set_output_(), help_option_arguments, i, diagnostic_context::m_column_origin, diagnostic_context::m_column_unit, diagnostic_context::m_fatal_errors, diagnostic_context::m_inhibit_warnings, diagnostic_context::m_pedantic_errors, diagnostic_context::m_show_column, diagnostic_context::m_source_printing, diagnostic_context::m_tabstop, diagnostic_context::m_warn_system_headers, diagnostic_source_printing_options::min_margin_width, NO_DEBUG, NO_STACK_CHECK, NULL, cl_decoded_option::opt_index, option_flag_var(), parse_and_check_patch_area(), parse_sanitizer_options(), parse_zero_call_used_regs_options(), pp_set_line_maximum_length(), print_specific_help(), SANITIZE_KERNEL_ADDRESS, SANITIZE_KERNEL_HWADDRESS, SANITIZE_RETURN, SANITIZE_UNDEFINED, SANITIZE_UNDEFINED_NONDEFAULT, SANITIZE_UNREACHABLE, set_debug_level(), diagnostic_context::set_escape_format(), diagnostic_context::set_extra_output_kind(), set_fast_math_flags(), diagnostic_context::set_max_errors(), SET_OPTION_IF_UNSET, diagnostic_context::set_path_format(), diagnostic_context::set_prefixing_rule(), diagnostic_context::set_report_bug(), diagnostic_context::set_show_cwe(), diagnostic_context::set_show_highlight_colors(), diagnostic_context::set_show_option_requested(), diagnostic_context::set_show_path_depths(), diagnostic_context::set_show_rules(), diagnostic_context::set_text_art_charset(), set_unsafe_math_optimizations_flags(), diagnostic_context::set_warning_as_error_requested(), set_Wstrict_aliasing(), diagnostic_source_printing_options::show_event_links_p, diagnostic_source_printing_options::show_labels_p, diagnostic_source_printing_options::show_line_numbers_p, STATIC_BUILTIN_STACK_CHECK, cl_decoded_option::value, VMS_DEBUG, WARN_STRICT_OVERFLOW_CONDITIONAL, and warning_at().
Referenced by set_default_handlers(), and set_option_handlers().
|
extern |
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=). ARG is the argument of the option for joined options, or NULL otherwise. 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_arg, cl_option::alias_target, cl_enums, CL_ERR_ENUM_ARG, CL_ERR_MISSING_ARG, CL_ERR_UINT_ARG, CL_JOINED, cl_options, CLVC_ENUM, CLVC_INTEGER, CLVC_SIZE, cmdline_handle_error(), diagnostic_classify_diagnostic(), enum_arg_to_value(), enum_value_to_arg(), error(), gcc_assert, handle_generated_option(), integral_argument(), NULL, option(), and cl_enum::values.
Referenced by common_handle_option(), and enable_warning_as_error().
|
extern |
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(), i, cl_decoded_option::mask, NULL, cl_decoded_option::opt_index, opts_concat(), cl_decoded_option::orig_option_with_args_text, prune_options(), cl_decoded_option::value, and cl_decoded_option::warn_message.
Referenced by driver::decode_argv(), decode_cmdline_options_to_array_default_mask(), do_self_spec(), and get_options_from_collect_gcc_options().
|
extern |
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 CL_COMMON, CL_TARGET, decode_cmdline_options_to_array(), and initial_lang_mask.
Referenced by toplev::main().
|
extern |
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(), FOR_EACH_VEC_ELT, cl_option_handlers::handlers, help_option_arguments, i, initial_lang_mask, print_help(), read_cmdline_options(), set_default_handlers(), and cl_option_handlers::target_option_override_hook.
Referenced by toplev::main().
|
extern |
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, error_at(), i, integral_argument(), maybe_default_options(), cl_decoded_option::opt_index, SET_OPTION_IF_UNSET, and cl_decoded_option::value.
Referenced by decode_options().
|
extern |
The function diagnoses incompatible combinations for provided options (OPTS and OPTS_SET) at a given LOCation. The function is called both when command line is parsed (after the target optimization hook) and when an optimize/target attribute (or pragma) is used.
References inform(), UI_SJLJ, and UI_TARGET.
Referenced by finish_options(), and process_options().
|
extern |
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, CL_ENUM_CANONICAL, enum_arg_ok_for_language(), cl_option::flags, i, and NULL.
Referenced by control_warning_option(), decode_cmdline_option(), and print_filtered_help().
size_t find_opt | ( | const char * | input, |
unsigned int | lang_mask ) |
Perform a binary search to find which option the command-line INPUT matches. Returns its index in the option array, and OPT_SPECIAL_unknown on failure. This routine is quite subtle. A normal binary search is not good enough because some options can be suffixed with an argument, and multiple sub-matches can occur, e.g. input of "-pedantic" matching the initial substring of "-pedantic-errors". A more complicated example is -gstabs. It should match "-g" with an argument of "stabs". Suppose, however, that the number and list of switches are such that the binary search tests "-gen-decls" before having tested "-g". This doesn't match, and as "-gen-decls" is less than "-gstabs", it will become the lower bound of the binary search range, and "-g" will never be seen. To resolve this issue, 'optc-gen.awk' makes "-gen-decls" point, via the back_chain member, to "-g" so that failed searches that end between "-gen-decls" and the lexicographically subsequent switch know to go back and see if "-g" causes a match (which it does in this example). This search is done in such a way that the longest match for the front end in question wins. If there is no match for the current front end, the longest match for a different front end is returned (or N_OPTS if none) and the caller emits an error message.
References cl_option::back_chain, CL_JOINED, cl_options, cl_options_count, comp, cl_option::flags, cl_option::opt_len, cl_option::opt_text, and remapping_prefix_p().
Referenced by decode_cmdline_option(), and enable_warning_as_error().
|
extern |
After all options at LOC have been read into OPTS and OPTS_SET, finalize settings of those options and diagnose incompatible combinations.
References AUTO_INIT_ZERO, sanitizer_opts_s::can_recover, sanitizer_opts_s::can_trap, codeview_debuginfo_p(), control_options_for_live_patching(), DEFAULT_FLAG_PIE, diagnose_options(), DINFO_LEVEL_NONE, DINFO_LEVEL_NORMAL, dwarf_debuginfo_p(), error_at(), sanitizer_opts_s::flag, flag_stack_protector_set_by_fhardened_p, i, inform(), LIVE_PATCHING_INLINE_ONLY_STATIC, sanitizer_opts_s::name, NO_DEBUG, NULL, opts_concat(), report_conflicting_sanitizer_options(), SANITIZE_ADDRESS, SANITIZE_HWADDRESS, SANITIZE_KERNEL_ADDRESS, SANITIZE_KERNEL_HWADDRESS, SANITIZE_LEAK, SANITIZE_NONNULL_ATTRIBUTE, SANITIZE_NULL, SANITIZE_POINTER_COMPARE, SANITIZE_POINTER_SUBTRACT, SANITIZE_RETURNS_NONNULL_ATTRIBUTE, SANITIZE_THREAD, SANITIZE_UNREACHABLE, SANITIZE_USER_ADDRESS, SANITIZE_USER_HWADDRESS, SANITIZE_VPTR, sanitizer_opts, SET_OPTION_IF_UNSET, sorry(), SPCT_FLAG_STRONG, SR_NONE, UNKNOWN_LOCATION, VECT_COST_MODEL_CHEAP, and warning_at().
Referenced by decode_options(), and lto_input_ts_function_decl_tree_pointers().
|
extern |
Return a heap allocated producer with command line options.
References CL_NO_DWARF_RECORD, cl_options, FOR_EACH_VEC_ELT, gcc_checking_assert, i, and switches.
Referenced by gen_producer_string(), init_asm_output(), and process_options().
|
extern |
Return a heap allocated producer string including command line options.
References free(), gen_command_line_string(), and NULL.
Referenced by init_asm_output().
void generate_option | ( | size_t | opt_index, |
const char * | arg, | ||
HOST_WIDE_INT | value, | ||
unsigned int | lang_mask, | ||
struct cl_decoded_option * | decoded ) |
Fill in *DECODED with an option described by OPT_INDEX, ARG and VALUE for a front end using LANG_MASK. This is used when the compiler generates options internally.
References cl_decoded_option::arg, cl_decoded_option::canonical_option, cl_decoded_option::canonical_option_num_elements, CL_ERR_WRONG_LANG, cl_options, cl_decoded_option::errors, gcc_unreachable, generate_canonical_option(), cl_decoded_option::mask, NULL, cl_decoded_option::opt_index, option(), option_ok_for_language(), opts_concat(), cl_decoded_option::orig_option_with_args_text, cl_decoded_option::value, and cl_decoded_option::warn_message.
Referenced by handle_generated_option().
void generate_option_input_file | ( | const char * | file, |
struct cl_decoded_option * | decoded ) |
Fill in *DECODED with an option for input file FILE.
References cl_decoded_option::arg, cl_decoded_option::canonical_option, cl_decoded_option::canonical_option_num_elements, cl_decoded_option::errors, cl_decoded_option::mask, NULL, cl_decoded_option::opt_index, cl_decoded_option::orig_option_with_args_text, cl_decoded_option::value, and cl_decoded_option::warn_message.
Referenced by decode_cmdline_options_to_array().
|
extern |
Referenced by get_option_url_suffix().
|
extern |
Given buffer P of size SZ, look for a prefix within OPTION_MAP; if found, return the prefix and write the new prefix to *OUT_NEW_PREFIX. Otherwise return nullptr.
References i, option_map::new_prefix, and option_map::opt0.
|
extern |
Fill STATE with the current state of option OPTION in OPTS. Return true if there is some state to store.
References cl_enums, cl_option::cl_host_wide_int, cl_options, CLVC_BIT_CLEAR, CLVC_BIT_SET, CLVC_DEFER, CLVC_ENUM, CLVC_EQUAL, CLVC_INTEGER, CLVC_SIZE, CLVC_STRING, option(), option_enabled(), option_flag_var(), cl_option::var_enum, and cl_enum::var_size.
Referenced by option_affects_pch_p().
|
extern |
Get the url within the documentation for this option, or NULL.
References cl_options, get_opt_url_suffix(), get_option_html_page(), and NULL.
Referenced by gcc_diagnostic_option_manager::make_option_url().
|
extern |
Process common options that have been deferred until after the handlers have been called for all options.
References add_debug_prefix_map(), add_file_prefix_map(), add_new_plugin(), add_profile_prefix_map(), cl_deferred_option::arg, dbg_cnt_process_opt(), decode_reg_name(), disable_pass(), enable_pass(), enable_rtl_dump_file(), error(), fix_register(), flag_canon_prefix_map, FOR_EACH_VEC_ELT, gcc_unreachable, i, NULL, NULL_RTX, opt_fstack_limit_register_no, opt_fstack_limit_symbol_arg, cl_deferred_option::opt_index, opt_info_switch_p(), parse_plugin_arg_opt(), SANITIZE_KERNEL_ADDRESS, set_asan_shadow_offset(), set_random_seed(), set_sanitized_sections(), stack_limit_rtx, cl_deferred_option::value, and vNULL.
Referenced by toplev::main().
|
extern |
Handle deferred dump options.
References cl_deferred_option::arg, gcc::dump_manager::dump_switch_p(), FOR_EACH_VEC_ELT, g, gcc::context::get_dumps(), i, cl_deferred_option::opt_index, and vNULL.
Referenced by toplev::main().
bool handle_generated_option | ( | struct gcc_options * | opts, |
struct gcc_options * | opts_set, | ||
size_t | opt_index, | ||
const char * | arg, | ||
HOST_WIDE_INT | value, | ||
unsigned int | lang_mask, | ||
int | kind, | ||
location_t | loc, | ||
const struct cl_option_handlers * | handlers, | ||
bool | generated_p, | ||
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 cl_decoded_option::arg, generate_option(), handle_option(), cl_decoded_option::opt_index, and cl_decoded_option::value.
Referenced by control_warning_option(), and maybe_default_option().
|
extern |
Initialize global options-related settings at start-up.
References diagnostic_color_init(), diagnostic_urls_init(), diagnostic_context::get_reference_printer(), global_dc, initial_lang_mask, lang_hooks::initialize_diagnostics, lang_hooks::option_lang_mask, pp_show_highlight_colors(), diagnostic_context::refresh_output_sinks(), and diagnostic_context::set_show_highlight_colors().
Referenced by toplev::main().
|
extern |
Initialize OPTS and OPTS_SET before using them in parsing options.
References gcc_assert, and opts_obstack.
Referenced by driver::decode_argv(), lto_input_ts_function_decl_tree_pointers(), and toplev::main().
|
extern |
Initialize opts_obstack.
References gcc_obstack_init, and opts_obstack.
Referenced by driver::decode_argv(), driver_get_configure_time_options(), main(), and toplev::main().
|
extern |
If ARG is a non-negative decimal or hexadecimal integer representable in HOST_WIDE_INT return its value, otherwise return -1. If ERR is not null set *ERR to zero on success or to EINVAL or to the value of errno otherwise.
References end(), errno, HOST_WIDE_INT_M1U, HOST_WIDE_INT_UC, and NULL.
Referenced by control_warning_option(), decode_cmdline_option(), default_options_optimization(), parse_and_check_patch_area(), and set_debug_level().
|
extern |
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(), gcc_assert, option(), and cl_enum::values.
|
extern |
Return 1 if option OPT_IDX is enabled in OPTS, 0 if it is disabled, or -1 if it isn't a simple on-off switch (or if the value is unknown, typically set later in target).
References CL_COMMON, cl_options, CLVC_BIT_CLEAR, CLVC_BIT_SET, CLVC_DEFER, CLVC_ENUM, CLVC_EQUAL, CLVC_INTEGER, CLVC_SIZE, CLVC_STRING, option(), and option_flag_var().
Referenced by get_option_state(), compiler_diagnostic_option_manager::option_enabled_p(), print_filtered_help(), and suggest_attribute().
|
extern |
Return the address of the flag variable for option OPT_INDEX in options structure OPTS, or NULL if there is no flag variable.
References cl_options, NULL, and option().
Referenced by common_handle_option(), get_option_state(), handle_option(), option_affects_pch_p(), option_enabled(), print_filtered_help(), and set_option().
|
extern |
Like libiberty concat, but allocate using opts_obstack.
References ap, end(), and opts_obstack.
Referenced by decode_cmdline_options_to_array(), finish_options(), generate_canonical_option(), and generate_option().
|
extern |
Parse -falign-NAME format for a FLAG value. Return individual parsed integer values into RESULT_VALUES array. If REPORT_ERROR is set, print error message at LOC location.
References end(), error_at(), free(), i, MAX_CODE_ALIGN_VALUE, and NULL.
Referenced by check_alignment_argument(), and parse_N_M().
|
extern |
Parse argument of -fpatchable-function-entry option ARG and store corresponding values to PATCH_AREA_SIZE and PATCH_AREA_START. If REPORT_ERROR is set to true, generate error for a problematic option arguments.
References error(), free(), integral_argument(), NULL, and USHRT_MAX.
Referenced by common_handle_option(), and process_options().
unsigned int parse_no_sanitize_attribute | ( | char * | value | ) |
Parse string values of no_sanitize attribute passed in VALUE. Values are separated with comma.
References sanitizer_opts_s::flag, i, sanitizer_opts_s::name, NULL, SANITIZE_UNDEFINED, SANITIZE_UNDEFINED_NONDEFAULT, sanitizer_opts, and warning().
|
extern |
Parse options in COLLECT_GCC_OPTIONS and push them on ARGV_OBSTACK. Store number of arguments into ARGC_P.
References fatal_error(), input_location, NULL, and startswith().
Referenced by get_options_from_collect_gcc_options(), and prepend_xassembler_to_collect_as_options().
unsigned int parse_sanitizer_options | ( | const char * | p, |
location_t | loc, | ||
int | scode, | ||
unsigned int | flags, | ||
int | value, | ||
bool | complain ) |
Parse comma separated sanitizer suboptions from P for option SCODE, adjust previous FLAGS and return new ones. If COMPLAIN is false, don't issue diagnostics.
References error_at(), sanitizer_opts_s::flag, get_closest_sanitizer_option(), i, sanitizer_opts_s::name, NULL, SANITIZE_ADDRESS, SANITIZE_KERNEL_ADDRESS, SANITIZE_LEAK, SANITIZE_RETURN, SANITIZE_SHADOW_CALL_STACK, SANITIZE_THREAD, SANITIZE_UNDEFINED, SANITIZE_UNDEFINED_NONDEFAULT, SANITIZE_UNREACHABLE, SANITIZE_USER_ADDRESS, SANITIZE_VPTR, and sanitizer_opts.
Referenced by common_handle_option().
|
extern |
Prepend -Xassembler for each option in COLLECT_AS_OPTIONS, and push on O.
References i, obstack, opts_obstack, and parse_options_from_collect_gcc_options().
Referenced by lto_write_options(), and run_gcc().
|
extern |
Print help when OPT__help_ is set.
References a, CL_COMMON, CL_DRIVER, CL_JOINED, cl_lang_count, CL_OPTIMIZATION, CL_PARAMS, CL_SEPARATE, CL_TARGET, CL_UNDOCUMENTED, CL_WARNING, error(), i, lang_names, NULL, pflags, print_help_hardened(), print_specific_help(), and warning().
Referenced by decode_options().
|
extern |
Produce a warning for each option previously buffered.
References ignored_options, inform(), and UNKNOWN_LOCATION.
Referenced by toplev::main().
|
extern |
Handle the switch DECODED (location LOC) for the language indicated by LANG_MASK, using the handlers in *HANDLERS and setting fields in OPTS and OPTS_SET and using diagnostic context DC (if not NULL) for diagnostic options.
References cl_decoded_option::arg, CL_ERR_WRONG_LANG, cl_options, cmdline_handle_error(), error_at(), cl_decoded_option::errors, gcc_assert, handle_option(), cl_decoded_option::opt_index, option(), cl_decoded_option::orig_option_with_args_text, cl_option_handlers::unknown_option_callback, cl_decoded_option::value, cl_decoded_option::warn_message, warning_at(), and cl_option_handlers::wrong_lang_callback.
Referenced by do_self_spec(), process_command(), and read_cmdline_options().
|
extern |
Set *HANDLERS to the default set of option handlers for use in the compilers proper (not the driver).
References CL_COMMON, CL_TARGET, common_handle_option(), complain_wrong_lang(), cl_option_handler_func::handler, cl_option_handlers::handlers, initial_lang_mask, lang_handle_option(), cl_option_handler_func::mask, cl_option_handlers::num_handlers, target_handle_option(), cl_option_handlers::target_option_override_hook, cl_option_handlers::unknown_option_callback, unknown_option_callback(), and cl_option_handlers::wrong_lang_callback.
Referenced by decode_options().
|
extern |
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_options, CLVC_BIT_CLEAR, CLVC_BIT_SET, CLVC_DEFER, CLVC_ENUM, CLVC_EQUAL, CLVC_INTEGER, CLVC_SIZE, CLVC_STRING, diagnostic_classify_diagnostic(), error_at(), cl_enum::get, INT_MAX, NULL, option(), option_flag_var(), and cl_enum::set.
Referenced by handle_option().
|
extern |
|
extern |
Handle a back-end option; arguments and return value as for handle_option.
References gcc_assert, and global_dc.
Referenced by set_default_handlers(), and set_option_handlers().
|
extern |
Return a malloced slash-separated list of languages in MASK.
References lang_names, and MAX.
Referenced by complain_wrong_lang().
|
extern |
|
extern |
Referenced by print_filtered_help().
|
extern |
Referenced by common_handle_option(), complain_wrong_lang(), print_filtered_help(), print_help(), and print_specific_help().
|
extern |
Referenced by append_compiler_options(), append_linker_options(), option_proposer::build_option_suggestions(), cancel_option(), complain_wrong_lang(), control_warning_option(), decode_cmdline_option(), default_pch_valid_p(), driver_wrong_lang_callback(), enable_warning_as_error(), find_opt(), gen_command_line_string(), generate_canonical_option(), generate_option(), get_option_html_page(), get_option_state(), get_option_url_suffix(), handle_option(), lto_write_options(), toplev::main(), compiler_diagnostic_option_manager::make_option_name(), maybe_default_option(), merge_and_complain(), opt_enum_arg_to_value(), option_affects_pch_p(), option_enabled(), option_flag_var(), print_filtered_help(), prune_options(), read_cmdline_option(), and set_option().
|
extern |
|
extern |
Set by finish_options when flag_stack_protector was set only because of -fhardened. Yuck.
Referenced by finish_options(), and process_options().
|
extern |
--help option argument if set.
Referenced by common_handle_option(), and decode_options().
|
extern |
Input file names.
Referenced by add_input_filename().
|
extern |
Referenced by print_filtered_help(), print_help(), print_specific_help(), and write_langs().
|
extern |
The count of input filenames.
Referenced by add_input_filename().
|
extern |
Referenced by handle_common_deferred_options(), and init_emit_regs().
|
extern |
Hold command-line options associated with stack limitation.
Referenced by handle_common_deferred_options(), and init_emit_regs().
|
extern |
Obstack for option strings.
Referenced by decode_cmdline_option(), driver_get_configure_time_options(), driver::finalize(), toplev::finalize(), generate_canonical_option(), init_options_struct(), init_opts_obstack(), opts_concat(), and prepend_xassembler_to_collect_as_options().
const struct sanitizer_opts_s sanitizer_opts[] |
const struct zero_call_used_regs_opts_s zero_call_used_regs_opts[] |