参照元†
- FIXME: これは何?
- GCC のコンパイラ本体(cc1 コマンド)の main 関数
返り値†
/* Entry point of cc1, cc1plus, jc1, f771, etc.
Exit code is FATAL_EXIT_CODE if can't open files or if there were
any errors, or SUCCESS_EXIT_CODE if compilation succeeded.
It is not safe to call this function more than once. */
int
toplev::main (int argc, char **argv)
{
/* Parsing and gimplification sometimes need quite large stack.
Increase stack size limits if possible. */
stack_limit_increase (64 * 1024 * 1024);
expandargv (&argc, &argv);
/* Initialization of GCC's environment, and diagnostics. */
general_init (argv[0], m_init_signals);
/* One-off initialization of options that does not need to be
repeated when options are added for particular functions. */
init_options_once ();
init_opts_obstack ();
/* Initialize global options structures; this must be repeated for
each structure used for parsing options. */
init_options_struct (&global_options, &global_options_set);
lang_hooks.init_options_struct (&global_options);
/* Convert the options to an array. */
decode_cmdline_options_to_array_default_mask (argc,
CONST_CAST2 (const char **,
char **, argv),
&save_decoded_options,
&save_decoded_options_count);
/* Perform language-specific options initialization. */
lang_hooks.init_options (save_decoded_options_count, save_decoded_options);
/* Parse the options and do minimal processing; basically just
enough to default flags appropriately. */
decode_options (&global_options, &global_options_set,
save_decoded_options, save_decoded_options_count,
UNKNOWN_LOCATION, global_dc,
targetm.target_option.override);
handle_common_deferred_options ();
init_local_tick ();
initialize_plugins ();
if (version_flag)
print_version (stderr, "", true);
if (help_flag)
print_plugins_help (stderr, "");
/* Exit early if we can (e.g. -help). */
if (!exit_after_options)
{
if (m_use_TV_TOTAL)
start_timevars ();
do_compile ();
}
if (warningcount || errorcount || werrorcount)
print_ignored_options ();
if (flag_self_test)
run_self_tests ();
/* Invoke registered plugin callbacks if any. Some plugins could
emit some diagnostics here. */
invoke_plugin_callbacks (PLUGIN_FINISH, NULL);
if (flag_diagnostics_generate_patch)
{
gcc_assert (global_dc->edit_context_ptr);
pretty_printer pp;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
global_dc->edit_context_ptr->print_diff (&pp, true);
pp_flush (&pp);
}
diagnostic_finish (global_dc);
finalize_plugins ();
after_memory_report = true;
if (seen_error () || werrorcount)
return (FATAL_EXIT_CODE);
return (SUCCESS_EXIT_CODE);
}
コメント†