summaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-08 21:12:26 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-08 21:12:26 +0000
commit03bde6017ce5581fcb73761fa8c5210ee12631aa (patch)
tree6dbda9aef13aa04d7c15b46cb0bda16747482b8d /gcc/toplev.c
parent0d409008b0302a0de479fbe32900561a70bd37d5 (diff)
downloadgcc-03bde6017ce5581fcb73761fa8c5210ee12631aa.tar.gz
* c-common.h (c_common_init, c_common_post_options): Update.
* c-objc-common.c (c_objc_common_init): Update for new prototype. * c-opts.c (saved_lineno): New. (c_common_post_options, c_common_init): Update prototypes, move call to cpp_read_main_file from latter to former. * c-tree.h (c_ojbc_common_init): Update. * langhooks-def.h (lhd_post_options): New. (LANG_HOOKS_INIT, LANG_HOOKS_POST_OPTIONS): Update. * langhooks.c (lhd_post_options): New. * langhooks.h (struct lang_hooks): Update post_options and init hooks. * toplev.c (no_backend): New. (process_options): Call post_options hook and set main_input_filename and input_filename here. (lang_dependent_init, do_compile): post_options hook moved to process_options. * objc/objc-act.c (objc_init): Update prototype. * objc/objc-act.h (objc_init): Update prototype. ada: * misc.c (gnat_init): Update for new prototype. cp: * cp-tree.h (cxx_init): Update prototype. * lex.c (cxx_init): Similarly. f: * com.c (ffe_init): Update prototype; move code to ffe_post_options. (ffe_post_options): New. java: * lang.c (java_init): Update prototype, move code to java_post_options. (java_post_options): Similarly. treelang: * tree1.c (in_fname): Fix type. (treelang_init): Update prototype and use of in_fname. * treelang.h (in_fname): Fix type. * treetree.c (tree_code_if_start, tree_code_if_else, tree_code_if_end, tree_code_create_function_prototype, tree_code_create_function_initial, tree_code_create_funciton_wrapup, tree_code_create_variable, tree_code_output_expression_statement) : Fix prototypes and use of filenames. * treetree.h: Similarly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64001 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 9d6899d808a..7d7b3464f0e 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -104,7 +104,7 @@ extern void reg_alloc PARAMS ((void));
static void general_init PARAMS ((char *));
static void parse_options_and_default_flags PARAMS ((int, char **));
-static void do_compile PARAMS ((int));
+static void do_compile PARAMS ((void));
static void process_options PARAMS ((void));
static void backend_init PARAMS ((void));
static int lang_dependent_init PARAMS ((const char *));
@@ -135,6 +135,9 @@ static void print_switch_values PARAMS ((FILE *, int, int, const char *,
/* Nonzero to dump debug info whilst parsing (-dy option). */
static int set_yydebug;
+/* True if we don't need a backend (e.g. preprocessing only). */
+static bool no_backend;
+
/* Length of line when printing switch values. */
#define MAX_LINE 75
@@ -5169,6 +5172,13 @@ parse_options_and_default_flags (argc, argv)
static void
process_options ()
{
+ /* Allow the front end to perform consistency checks and do further
+ initialization based on the command line options. This hook also
+ sets the original filename if appropriate (e.g. foo.i -> foo.c)
+ so we can correctly initialize debug output. */
+ no_backend = (*lang_hooks.post_options) (&filename);
+ main_input_filename = input_filename = filename;
+
#ifdef OVERRIDE_OPTIONS
/* Some machines may reject certain combinations of options. */
OVERRIDE_OPTIONS;
@@ -5411,15 +5421,10 @@ lang_dependent_init (name)
if (dump_base_name == 0)
dump_base_name = name ? name : "gccdump";
- /* Front-end initialization. This hook can assume that GC,
- identifier hashes etc. are set up, but debug initialization is
- not done yet. This routine must return the original filename
- (e.g. foo.i -> foo.c) so can correctly initialize debug output. */
- name = (*lang_hooks.init) (name);
- if (name == NULL)
+ /* Other front-end initialization. */
+ if ((*lang_hooks.init) () == 0)
return 0;
- main_input_filename = input_filename = name;
init_asm_output (name);
/* These create various _DECL nodes, so need to be called after the
@@ -5513,8 +5518,7 @@ finalize ()
/* Initialize the compiler, and compile the input file. */
static void
-do_compile (no_backend)
- int no_backend;
+do_compile ()
{
/* We cannot start timing until after options are processed since that
says if we run timers or not. */
@@ -5558,16 +5562,11 @@ toplev_main (argc, argv)
/* Exit early if we can (e.g. -help). */
if (!exit_after_options)
{
- /* All command line options have been parsed; allow the front
- end to perform consistency checks, etc. */
- bool no_backend = (*lang_hooks.post_options) ();
-
- /* The bulk of command line switch processing. */
process_options ();
/* Don't do any more if an error has already occurred. */
if (!errorcount)
- do_compile (no_backend);
+ do_compile ();
}
if (errorcount || sorrycount)