GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "rtl.h"
#include "tree.h"
#include "tree-pass.h"
#include "diagnostic.h"
#include "opts.h"
#include "flags.h"
#include "langhooks.h"
#include "dbgcnt.h"
#include "debug.h"
#include "output.h"
#include "plugin.h"
#include "toplev.h"
#include "context.h"
#include "stringpool.h"
#include "attribs.h"
#include "asan.h"
#include "file-prefix-map.h"
Typedefs | |
typedef const char * | const_char_p |
Functions | |
char * | write_langs (unsigned int mask) |
static void | complain_wrong_lang (const struct cl_decoded_option *decoded, unsigned int lang_mask) |
static void | postpone_unknown_option_warning (const char *opt) |
void | print_ignored_options (void) |
static bool | unknown_option_callback (const struct cl_decoded_option *decoded) |
static bool | lang_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_input_filename (const char *filename) |
static void | read_cmdline_options (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 | init_options_once (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)) |
void | handle_common_deferred_options (void) |
void | handle_deferred_dump_options (void) |
Variables | |
static vec< const_char_p > | ignored_options |
const char ** | in_fnames |
unsigned | num_in_fnames |
static unsigned int | initial_lang_mask |
const char * | opt_fstack_limit_symbol_arg = NULL |
int | opt_fstack_limit_register_no = -1 |
typedef const char* const_char_p |
Command line option handling. Code involving global state that should not be shared with the driver. 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/>.
|
static |
Handle FILENAME from the command line.
References in_fnames, and num_in_fnames.
Referenced by read_cmdline_options().
|
static |
Complain that switch DECODED does not apply to this front end (mask LANG_MASK).
References CL_DRIVER, cl_lang_count, cl_options, lang_hooks::complain_wrong_lang_p, error(), free(), gcc_unreachable, NULL, cl_decoded_option::opt_index, option(), cl_decoded_option::orig_option_with_args_text, warning(), and write_langs().
Referenced by set_default_handlers().
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 CL_COMMON, CL_TARGET, 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, | ||
void(* | target_option_override_hook )(void) ) |
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().
void handle_common_deferred_options | ( | void | ) |
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().
void handle_deferred_dump_options | ( | void | ) |
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().
void init_options_once | ( | void | ) |
Initialize global options-related settings at start-up.
References diagnostic_color_init(), diagnostic_urls_init(), global_dc, initial_lang_mask, lang_hooks::initialize_diagnostics, diagnostic_context::m_printer, lang_hooks::option_lang_mask, pp_show_highlight_colors(), and diagnostic_context::set_show_highlight_colors().
Referenced by toplev::main().
|
static |
Handle a front-end option; arguments and return value as for handle_option.
References cl_decoded_option::arg, cl_decoded_option::canonical_option_num_elements, gcc_assert, global_dc, global_options, global_options_set, lang_hooks::handle_option, cl_decoded_option::opt_index, and cl_decoded_option::value.
Referenced by set_default_handlers().
|
static |
Buffer the unknown option described by the string OPT. Currently, we only complain about unknown -Wno-* options if they may have prevented a diagnostic. Otherwise, we just ignore them. Note that if we do complain, it is only as a warning, not an error; passing the compiler an unrecognized -Wno-* option should never change whether the compilation succeeds or fails.
References ignored_options.
Referenced by unknown_option_callback().
void print_ignored_options | ( | void | ) |
Produce a warning for each option previously buffered.
References ignored_options, inform(), and UNKNOWN_LOCATION.
Referenced by toplev::main().
|
static |
Handle the vector of command line options (located at LOC), storing the results of processing DECODED_OPTIONS and DECODED_OPTIONS_COUNT in OPTS and OPTS_SET and using DC for diagnostic state. LANG_MASK contains has a single bit set representing the current language. HANDLERS describes what functions to call for the options.
References add_input_filename(), cl_decoded_option::arg, base_of_path(), gcc_assert, global_options, global_options_set, i, NULL, and read_cmdline_option().
Referenced by decode_options().
void set_default_handlers | ( | struct cl_option_handlers * | handlers, |
void(* | target_option_override_hook )(void) ) |
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().
|
static |
Handle an unknown option DECODED, returning true if an error should be given.
References cl_decoded_option::arg, CL_ERR_NEGATIVE, cl_decoded_option::errors, and postpone_unknown_option_warning().
Referenced by set_default_handlers().
char * write_langs | ( | unsigned int | mask | ) |
Return a malloced slash-separated list of languages in MASK.
References lang_names, and MAX.
Referenced by complain_wrong_lang().
|
static |
Referenced by postpone_unknown_option_warning(), and print_ignored_options().
const char** in_fnames |
Input file names.
Referenced by add_input_filename().
|
static |
Language mask determined at initialization.
Referenced by decode_cmdline_options_to_array_default_mask(), decode_options(), init_options_once(), and set_default_handlers().
unsigned num_in_fnames |
The count of input filenames.
Referenced by add_input_filename().
int opt_fstack_limit_register_no = -1 |
Referenced by handle_common_deferred_options(), and init_emit_regs().
const char* opt_fstack_limit_symbol_arg = NULL |
Hold command-line options associated with stack limitation.
Referenced by handle_common_deferred_options(), and init_emit_regs().