GCC Middle and Back End API Reference
opts.cc File Reference
#include "config.h"
#include "system.h"
#include "intl.h"
#include "coretypes.h"
#include "opts.h"
#include "tm.h"
#include "flags.h"
#include "diagnostic.h"
#include "opts-diagnostic.h"
#include "insn-attr-common.h"
#include "common/common-target.h"
#include "spellcheck.h"
#include "opt-suggestions.h"
#include "diagnostic-color.h"
#include "diagnostic-format.h"
#include "version.h"
#include "selftest.h"
#include "file-prefix-map.h"
Include dependency graph for opts.cc:

Data Structures

class  option_help_tuple
 
class  string_fragment
 
struct  edit_distance_traits< const string_fragment & >
 

Macros

#define global_options   DO_NOT_USE
 
#define global_options_set   DO_NOT_USE
 
#define MATCH(prefix, string)
 
#define LIVE_PATCHING_OPTION   "-flive-patching=inline-only-static"
 
#define LIVE_PATCHING_OPTION   "-flive-patching=inline-only-static|inline-clone"
 
#define LEFT_COLUMN   27
 
#define SANITIZER_OPT(name, flags, recover, trap)
 
#define ZERO_CALL_USED_REGS_OPT(name, flags)
 

Typedefs

typedef char * char_p
 

Functions

static void set_Wstrict_aliasing (struct gcc_options *opts, int onoff)
 
enum debug_info_type debug_set_to_format (uint32_t debug_info_set)
 
unsigned int debug_set_count (uint32_t w_symbols)
 
const char * debug_set_names (uint32_t w_symbols)
 
bool btf_debuginfo_p ()
 
bool btf_with_core_debuginfo_p ()
 
bool ctf_debuginfo_p ()
 
bool codeview_debuginfo_p ()
 
bool dwarf_debuginfo_p (struct gcc_options *opts)
 
bool dwarf_based_debuginfo_p ()
 
void set_struct_debug_option (struct gcc_options *opts, location_t loc, const char *spec)
 
void strip_off_ending (char *name, int len)
 
int base_of_path (const char *path, const char **base_out)
 
static void set_debug_level (uint32_t dinfo, 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, void(*)(void))
 
static void add_comma_separated_to_vector (void **pvec, const char *arg)
 
void init_opts_obstack (void)
 
void init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
 
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)
 
static void control_options_for_live_patching (struct gcc_options *opts, struct gcc_options *opts_set, enum live_patching_level level, location_t loc)
 
const char * find_sanitizer_argument (struct gcc_options *opts, unsigned int flags)
 
static void report_conflicting_sanitizer_options (struct gcc_options *opts, location_t loc, unsigned int left, unsigned int right)
 
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)
 
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)
 
static void enable_fdo_optimizations (struct gcc_options *opts, struct gcc_options *opts_set, int value)
 
static const char * get_closest_sanitizer_option (const string_fragment &arg, const struct sanitizer_opts_s *opts, enum opt_code code, int value)
 
unsigned int parse_sanitizer_options (const char *p, location_t loc, int scode, unsigned int flags, int value, bool complain)
 
unsigned int parse_no_sanitize_attribute (char *value)
 
unsigned int parse_zero_call_used_regs_options (const char *arg)
 
bool parse_and_check_align_values (const char *flag, const char *name, auto_vec< unsigned > &result_values, bool report_error, location_t loc)
 
static void check_alignment_argument (location_t loc, const char *flag, const char *name, int *opt_flag, const char **opt_str)
 
void parse_and_check_patch_area (const char *arg, bool report_error, HOST_WIDE_INT *patch_area_size, HOST_WIDE_INT *patch_area_start)
 
static void print_help_hardened ()
 
void print_help (struct gcc_options *opts, unsigned int lang_mask, const char *help_option_argument)
 
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 fast_math_flags_set_p (const struct gcc_options *opts)
 
bool fast_math_flags_struct_set_p (struct cl_optimization *opt)
 
static void setup_core_dumping (diagnostic_context *dc)
 
static const char * get_option_html_page (int option_index)
 
label_text get_option_url_suffix (int option_index, unsigned lang_mask)
 
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)
 

Variables

bool flag_canon_prefix_map
 
bool flag_stack_protector_set_by_fhardened_p
 
const char *const debug_type_names []
 
static uint32_t debug_type_masks []
 
static char df_set_names [sizeof "none dwarf-2 vms ctf btf codeview"]
 
static const char undocumented_msg [] = N_("This option lacks documentation.")
 
static const char use_diagnosed_msg [] = N_("Uses of this option are diagnosed.")
 
static const struct default_options default_options_table []
 
vec< const char * > help_option_arguments
 
const struct sanitizer_opts_s sanitizer_opts []
 
const struct zero_call_used_regs_opts_s zero_call_used_regs_opts []
 

Macro Definition Documentation

◆ global_options

◆ global_options_set

◆ LEFT_COLUMN

#define LEFT_COLUMN   27

Referenced by print_filtered_help(), and wrap_help().

◆ LIVE_PATCHING_OPTION [1/2]

#define LIVE_PATCHING_OPTION   "-flive-patching=inline-only-static"

◆ LIVE_PATCHING_OPTION [2/2]

#define LIVE_PATCHING_OPTION   "-flive-patching=inline-only-static|inline-clone"

◆ MATCH

#define MATCH ( prefix,
string )
Value:
((strncmp (prefix, string, sizeof prefix - 1) == 0) \
? ((string += sizeof prefix - 1), 1) : 0)
Parse the -femit-struct-debug-detailed option value
and set the flag variables.  

Referenced by set_struct_debug_option().

◆ SANITIZER_OPT

#define SANITIZER_OPT ( name,
flags,
recover,
trap )
Value:
{ #name, flags, sizeof #name - 1, recover, trap }

◆ ZERO_CALL_USED_REGS_OPT

#define ZERO_CALL_USED_REGS_OPT ( name,
flags )
Value:
{ #name, flags }

Typedef Documentation

◆ char_p

typedef char* char_p

Function Documentation

◆ add_comma_separated_to_vector()

static void add_comma_separated_to_vector ( void ** pvec,
const char * arg )
static
Add comma-separated strings to a char_p vector.   

References r, and vec_check_alloc().

Referenced by common_handle_option().

◆ base_of_path()

int base_of_path ( const char * path,
const char ** base_out )
Find the base name of a path, stripping off both directories and
a single final extension.  

References path.

Referenced by matches_main_base(), and read_cmdline_options().

◆ btf_debuginfo_p()

bool btf_debuginfo_p ( )
Return TRUE iff BTF debug info is enabled.   

References BTF_DEBUG.

Referenced by ctf_add_enumerator(), ctf_debug_early_finish(), ctf_debug_finish(), and process_options().

◆ btf_with_core_debuginfo_p()

bool btf_with_core_debuginfo_p ( )
Return TRUE iff BTF with CO-RE debug info is enabled.   

References BTF_WITH_CORE_DEBUG.

Referenced by btf_asm_datasec_entry(), and btf_finish().

◆ check_alignment_argument()

static void check_alignment_argument ( location_t loc,
const char * flag,
const char * name,
int * opt_flag,
const char ** opt_str )
static
Check that alignment value FLAG for -falign-NAME is valid at a given
location LOC. OPT_STR points to the stored -falign-NAME=argument and
OPT_FLAG points to the associated -falign-NAME on/off flag.   

References NULL, and parse_and_check_align_values().

Referenced by common_handle_option().

◆ codeview_debuginfo_p()

bool codeview_debuginfo_p ( )

◆ common_handle_option()

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) )
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().

◆ control_options_for_live_patching()

static void control_options_for_live_patching ( struct gcc_options * opts,
struct gcc_options * opts_set,
enum live_patching_level level,
location_t loc )
static
Control IPA optimizations based on different live patching LEVEL.   

References error_at(), gcc_assert, gcc_unreachable, LIVE_PATCHING_INLINE_CLONE, LIVE_PATCHING_INLINE_ONLY_STATIC, LIVE_PATCHING_NONE, and LIVE_PATCHING_OPTION.

Referenced by finish_options().

◆ ctf_debuginfo_p()

bool ctf_debuginfo_p ( )
Return TRUE iff CTF debug info is enabled.   

References CTF_DEBUG.

Referenced by process_options().

◆ debug_set_count()

unsigned int debug_set_count ( uint32_t w_symbols)
Get the number of debug formats enabled for output.   

References count.

Referenced by debug_set_names(), process_options(), and set_debug_level().

◆ debug_set_names()

const char * debug_set_names ( uint32_t w_symbols)
Get the names of the debug formats enabled for output.   

References debug_set_count(), debug_type_masks, debug_type_names, df_set_names, DINFO_TYPE_MAX, DINFO_TYPE_NONE, gcc_assert, and i.

◆ debug_set_to_format()

enum debug_info_type debug_set_to_format ( uint32_t debug_info_set)
Get enum debug_info_type of the specified debug format, for error messages.
Can be used only for individual debug format types.   

References DINFO_TYPE_MAX, DINFO_TYPE_NONE, exact_log2(), and gcc_assert.

Referenced by process_options(), and set_debug_level().

◆ decode_d_option()

static void decode_d_option ( const char * arg,
struct gcc_options * opts,
location_t loc,
diagnostic_context * dc )
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().

◆ default_options_optimization()

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, 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().

◆ diagnose_options()

void diagnose_options ( gcc_options * opts,
gcc_options * opts_set,
location_t loc )
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().

◆ dwarf_based_debuginfo_p()

bool dwarf_based_debuginfo_p ( )
Return true iff the debug info format is to be generated based on DWARF
DIEs (like CTF and BTF debug info formats).   

References BTF_DEBUG, CODEVIEW_DEBUG, and CTF_DEBUG.

Referenced by dwarf2_debug_info_emitted_p(), and dwarf2out_do_frame().

◆ dwarf_debuginfo_p()

bool dwarf_debuginfo_p ( struct gcc_options * opts)

◆ enable_fdo_optimizations()

static void enable_fdo_optimizations ( struct gcc_options * opts,
struct gcc_options * opts_set,
int value )
static
Enable FDO-related flags.   

References SET_OPTION_IF_UNSET, and VECT_COST_MODEL_DYNAMIC.

Referenced by common_handle_option().

◆ enable_warning_as_error()

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 )
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 CL_JOINED, cl_options, CL_WARNING, control_warning_option(), error_at(), find_opt(), free(), NULL, cl_option::opt_len, and option_proposer::suggest_option().

Referenced by common_handle_option().

◆ fast_math_flags_set_p()

bool fast_math_flags_set_p ( const struct gcc_options * opts)
Return true iff flags in OPTS are set as if -ffast-math.   

References EXCESS_PRECISION_FAST.

Referenced by define_builtin_macros_for_compilation_flags().

◆ fast_math_flags_struct_set_p()

bool fast_math_flags_struct_set_p ( struct cl_optimization * opt)
Return true iff flags are set as if -ffast-math but using the flags stored
in the struct cl_optimization structure.   

◆ find_sanitizer_argument()

const char * find_sanitizer_argument ( struct gcc_options * opts,
unsigned int flags )
Return the string name describing a sanitizer argument which has been
provided on the command line and has set this particular flag.   

References sanitizer_opts_s::flag, i, sanitizer_opts_s::name, NULL, and sanitizer_opts.

Referenced by report_conflicting_sanitizer_options().

◆ finish_options()

◆ gen_command_line_string()

char * gen_command_line_string ( cl_decoded_option * options,
unsigned int options_count )
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().

◆ gen_producer_string()

char * gen_producer_string ( const char * language_string,
cl_decoded_option * options,
unsigned int options_count )
Return a heap allocated producer string including command line options.   

References free(), gen_command_line_string(), and NULL.

Referenced by init_asm_output().

◆ get_closest_sanitizer_option()

static const char * get_closest_sanitizer_option ( const string_fragment & arg,
const struct sanitizer_opts_s * opts,
enum opt_code code,
int value )
static
Given ARG, an unrecognized sanitizer option, return the best
matching sanitizer option, or NULL if there isn't one.
OPTS is array of candidate sanitizer options.
CODE is OPT_fsanitize_, OPT_fsanitize_recover_ or OPT_fsanitize_trap_.
VALUE is non-zero for the regular form of the option, zero
for the "no-" form (e.g. "-fno-sanitize-recover=").   

References best_match< GOAL_TYPE, CANDIDATE_TYPE >::consider(), best_match< GOAL_TYPE, CANDIDATE_TYPE >::get_best_meaningful_candidate(), i, sanitizer_opts_s::name, and NULL.

Referenced by parse_sanitizer_options().

◆ get_option_html_page()

static const char * get_option_html_page ( int option_index)
static
Get the page within the documentation for this option.   

References cl_options, and cl_option::flags.

Referenced by get_option_url_suffix().

◆ get_option_url_suffix()

label_text get_option_url_suffix ( int option_index,
unsigned lang_mask )
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().

◆ init_options_struct()

void init_options_struct ( struct gcc_options * opts,
struct gcc_options * opts_set )
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().

◆ init_opts_obstack()

void init_opts_obstack ( void )
Initialize opts_obstack.   

References gcc_obstack_init, and opts_obstack.

Referenced by driver::decode_argv(), driver_get_configure_time_options(), main(), and toplev::main().

◆ maybe_default_option()

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
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_PARAMS, debug, gcc_assert, gcc_unreachable, handle_generated_option(), NULL, and option().

Referenced by maybe_default_options().

◆ maybe_default_options()

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 )
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 debug, i, and maybe_default_option().

Referenced by default_options_optimization().

◆ parse_and_check_align_values()

bool parse_and_check_align_values ( const char * flag,
const char * name,
auto_vec< unsigned > & result_values,
bool report_error,
location_t loc )
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().

◆ parse_and_check_patch_area()

void parse_and_check_patch_area ( const char * arg,
bool report_error,
HOST_WIDE_INT * patch_area_size,
HOST_WIDE_INT * patch_area_start )
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().

◆ parse_no_sanitize_attribute()

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().

◆ parse_sanitizer_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().

◆ parse_zero_call_used_regs_options()

unsigned int parse_zero_call_used_regs_options ( const char * arg)
Parse -fzero-call-used-regs suboptions from ARG, return the FLAGS.   

References error(), zero_call_used_regs_opts_s::flag, i, zero_call_used_regs_opts_s::name, NULL, and zero_call_used_regs_opts.

Referenced by common_handle_option().

◆ print_filtered_help()

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

◆ print_help()

void print_help ( struct gcc_options * opts,
unsigned int lang_mask,
const char * help_option_argument )

◆ print_help_hardened()

static void print_help_hardened ( )
static
Print options enabled by -fhardened.  Keep this in sync with the manual!   

Referenced by print_help().

◆ print_specific_help()

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 )
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_COMMON, CL_DRIVER, CL_JOINED, cl_lang_count, CL_MAX_OPTION_CLASS, CL_MIN_OPTION_CLASS, CL_OPTIMIZATION, CL_PARAMS, CL_SEPARATE, CL_TARGET, CL_UNDOCUMENTED, CL_WARNING, gcc_assert, get_terminal_width(), i, INT_MAX, internal_error(), lang_names, NULL, and print_filtered_help().

Referenced by common_handle_option(), and print_help().

◆ report_conflicting_sanitizer_options()

static void report_conflicting_sanitizer_options ( struct gcc_options * opts,
location_t loc,
unsigned int left,
unsigned int right )
static
Report an error to the user about sanitizer options they have requested
which have set conflicting flags.

LEFT and RIGHT indicate sanitizer flags which conflict with each other, this
function reports an error if both have been set in OPTS->x_flag_sanitize and
ensures the error identifies the requested command line options that have
set these flags.   

References error_at(), find_sanitizer_argument(), and gcc_assert.

Referenced by finish_options().

◆ set_debug_level()

static void set_debug_level ( uint32_t dinfo,
int extended,
const char * arg,
struct gcc_options * opts,
struct gcc_options * opts_set,
location_t loc )
static
Handle a debug output -g switch for options OPTS
(OPTS_SET->x_write_symbols storing whether a debug format was passed
explicitly), location LOC.  EXTENDED is true or false to support
extended output (2 is special and means "-ggdb" was given).   

References BTF_DEBUG, CODEVIEW_DEBUG, CTF_DEBUG, CTFINFO_LEVEL_NORMAL, debug_set_count(), debug_set_to_format(), debug_type_names, DINFO_LEVEL_NORMAL, DWARF2_DEBUG, error_at(), gcc_assert, integral_argument(), NO_DEBUG, and warning_at().

Referenced by common_handle_option().

◆ set_fast_math_flags()

static void set_fast_math_flags ( struct gcc_options * opts,
int set )
static
The following routines are useful in setting all the flags that
-ffast-math and -fno-fast-math imply.   

References EXCESS_PRECISION_DEFAULT, EXCESS_PRECISION_FAST, and set_unsafe_math_optimizations_flags().

Referenced by common_handle_option().

◆ set_struct_debug_option()

◆ set_unsafe_math_optimizations_flags()

static void set_unsafe_math_optimizations_flags ( struct gcc_options * opts,
int set )
static
When -funsafe-math-optimizations is set the following
flags are set as well.   

Referenced by common_handle_option(), and set_fast_math_flags().

◆ set_Wstrict_aliasing()

static void set_Wstrict_aliasing ( struct gcc_options * opts,
int onoff )
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.   

References gcc_assert.

Referenced by common_handle_option().

◆ setup_core_dumping()

static void setup_core_dumping ( diagnostic_context * dc)
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 diagnostic_abort_on_error(), fatal_error(), and input_location.

Referenced by decode_d_option().

◆ strip_off_ending()

void strip_off_ending ( char * name,
int len )
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 fource characters.  (C++ uses ".cpp".)   

References i.

Referenced by get_plugin_base_name(), and init_asm_output().

◆ target_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,
void(* target_option_override_hook )(void) )
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().

◆ wrap_help()

static void wrap_help ( const char * help,
const char * item,
unsigned int item_width,
unsigned int columns )
static
Output ITEM, of length ITEM_WIDTH, in the left column,
followed by word-wrapped HELP in a second column.   

References i, LEFT_COLUMN, and MAX.

Referenced by print_filtered_help().

Variable Documentation

◆ debug_type_masks

uint32_t debug_type_masks[]
static
Initial value:
=
{
}
#define BTF_DEBUG
Definition flag-types.h:45
#define NO_DEBUG
Definition flag-types.h:37
#define VMS_DEBUG
Definition flag-types.h:41
#define CODEVIEW_DEBUG
Definition flag-types.h:47
#define DWARF2_DEBUG
Definition flag-types.h:39
#define CTF_DEBUG
Definition flag-types.h:43
Bitmasks of fundamental debug info formats indexed by enum
debug_info_type.   

Referenced by debug_set_names().

◆ debug_type_names

const char* const debug_type_names[]
Initial value:
=
{
"none", "dwarf-2", "vms", "ctf", "btf", "codeview"
}
Names of fundamental debug info formats indexed by enum
debug_info_type.   

Referenced by debug_set_names(), process_options(), and set_debug_level().

◆ default_options_table

const struct default_options default_options_table[]
static
Table of options enabled by default at different levels.
Please keep this list sorted by level and alphabetized within
each level; this makes it easier to keep the documentation
in sync.   

Referenced by default_options_optimization().

◆ df_set_names

char df_set_names[sizeof "none dwarf-2 vms ctf btf codeview"]
static
Names of the set of debug formats requested by user.  Updated and accessed
via debug_set_names.   

Referenced by debug_set_names().

◆ flag_canon_prefix_map

bool flag_canon_prefix_map
Command line option handling.
   Copyright (C) 2002-2024 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/>.   
In this file all option sets are explicit.   
Set by -fcanon-prefix-map.   

Referenced by add_prefix_map(), common_handle_option(), and handle_common_deferred_options().

◆ flag_stack_protector_set_by_fhardened_p

bool flag_stack_protector_set_by_fhardened_p
Set by finish_options when flag_stack_protector was set only because of
-fhardened.  Yuck.   

Referenced by finish_options(), and process_options().

◆ help_option_arguments

vec<const char *> help_option_arguments
--help option argument if set.   

Referenced by common_handle_option(), and decode_options().

◆ sanitizer_opts

◆ undocumented_msg

const char undocumented_msg[] = N_("This option lacks documentation.")
static
What to print when a switch has no documentation.   

Referenced by print_filtered_help().

◆ use_diagnosed_msg

const char use_diagnosed_msg[] = N_("Uses of this option are diagnosed.")
static

Referenced by print_filtered_help().

◆ zero_call_used_regs_opts

const struct zero_call_used_regs_opts_s zero_call_used_regs_opts[]
Initial value:
=
{
#define ZERO_CALL_USED_REGS_OPT(name, flags) \
{NULL, 0U}
}
const unsigned int LEAFY_GPR_ARG
Definition flag-types.h:370
const unsigned int SKIP
Definition flag-types.h:356
const unsigned int USED_ARG
Definition flag-types.h:364
const unsigned int LEAFY_GPR
Definition flag-types.h:371
const unsigned int USED_GPR_ARG
Definition flag-types.h:362
const unsigned int ALL
Definition flag-types.h:369
const unsigned int ALL_GPR_ARG
Definition flag-types.h:366
const unsigned int LEAFY
Definition flag-types.h:373
const unsigned int ALL_GPR
Definition flag-types.h:367
const unsigned int ALL_ARG
Definition flag-types.h:368
const unsigned int LEAFY_ARG
Definition flag-types.h:372
const unsigned int USED
Definition flag-types.h:365
const unsigned int USED_GPR
Definition flag-types.h:363
#define ZERO_CALL_USED_REGS_OPT(name, flags)
#define NULL
Definition system.h:50
-fzero-call-used-regs= suboptions.   

Referenced by default_zero_call_used_regs(), and parse_zero_call_used_regs_options().