aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/c-common.c4
-rw-r--r--gcc/c-common.h2
-rw-r--r--gcc/java/ChangeLog4
-rw-r--r--gcc/java/lang.c7
-rw-r--r--gcc/langhooks-def.h2
-rw-r--r--gcc/langhooks.h5
-rw-r--r--gcc/toplev.c35
8 files changed, 55 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b14bb37..5b8a058 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2002-07-07 Neil Booth <neil@daikokuya.co.uk>
+
+ * c-common.c (c_common_post_options): Update prototype;
+ don't init backends if preprocessing only.
+ * langhooks-def.h (LANG_HOOKS_POST_OPTIONS): Update.
+ * langhooks.h (struct lang_hooks): Update post_options to
+ return a boolean.
+ * toplev.c (parse_options_and_default_flags, do_compile,
+ lang_independent_init): Update prototypes. Allow the
+ front end to specify that there is no need to initialize
+ the back end.
+ (general_init): Move call to hex_init here...
+ (toplev_main): ...from here. Pass flag for back end init
+ suppression.
+
Sun Jul 7 20:38:38 2002 J"orn Rennecke <joern.rennecke@superh.com>
* sh.h (PRINT_OPERAND_PUNCT_VALID_P): Allow '\''.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 57c191a..a948959 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -4244,7 +4244,7 @@ c_common_init_options (lang)
}
/* Post-switch processing. */
-void
+bool
c_common_post_options ()
{
cpp_post_options (parse_in);
@@ -4286,6 +4286,8 @@ c_common_post_options ()
/* If an error has occurred in cpplib, note it so we fail
immediately. */
errorcount += cpp_errors (parse_in);
+
+ return flag_preprocess_only;
}
/* Hook that registers front end and target-specific built-ins. */
diff --git a/gcc/c-common.h b/gcc/c-common.h
index b1fd976..8aac857 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -594,7 +594,7 @@ extern void disable_builtin_function PARAMS ((const char *));
extern tree build_va_arg PARAMS ((tree, tree));
extern void c_common_init_options PARAMS ((enum c_language_kind));
-extern void c_common_post_options PARAMS ((void));
+extern bool c_common_post_options PARAMS ((void));
extern const char *c_common_init PARAMS ((const char *));
extern void c_common_finish PARAMS ((void));
extern void c_common_parse_file PARAMS ((int));
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index d93b346..3863b14 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,7 @@
+2002-07-07 Neil Booth <neil@daikokuya.co.uk>
+
+ * lang.c (java_post_options): Update prototype.
+
2002-07-05 Roger Sayle <roger@eyesopen.com>
* java/builtins.c (initialize_builtins): Ignore the additional
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 60dc67b..60f1a1c 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -51,7 +51,7 @@ struct string_option
static const char *java_init PARAMS ((const char *));
static void java_finish PARAMS ((void));
static void java_init_options PARAMS ((void));
-static void java_post_options PARAMS ((void));
+static bool java_post_options PARAMS ((void));
static int java_decode_option PARAMS ((int, char **));
static void put_decl_string PARAMS ((const char *, int));
@@ -780,7 +780,7 @@ java_init_options ()
}
/* Post-switch processing. */
-static void
+static bool
java_post_options ()
{
/* Turn off RTL inliner unless -finline-functions was really specified. */
@@ -789,6 +789,9 @@ java_post_options ()
flag_no_inline = 1;
flag_inline_functions = 0;
}
+
+ /* Initialize the compiler back end. */
+ return false;
}
#include "gt-java-lang.h"
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 6715159..246fea9 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -88,7 +88,7 @@ tree lhd_tree_inlining_convert_parm_for_inlining PARAMS ((tree, tree, tree));
#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack
#define LANG_HOOKS_INIT_OPTIONS lhd_do_nothing
#define LANG_HOOKS_DECODE_OPTION lhd_decode_option
-#define LANG_HOOKS_POST_OPTIONS hook_void_void
+#define LANG_HOOKS_POST_OPTIONS hook_void_bool_false
#define LANG_HOOKS_GET_ALIAS_SET lhd_get_alias_set
#define LANG_HOOKS_EXPAND_CONSTANT lhd_return_tree
#define LANG_HOOKS_EXPAND_EXPR lhd_expand_expr
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 71ae251..0ec3c88 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -198,9 +198,12 @@ struct lang_hooks
initialization should be left to the "init" callback, since GC
and the identifier hashes are set up between now and then.
+ Should return zero unless the compiler back-end does not need to
+ be initialized, such as with the -E option.
+
If errorcount is non-zero after this call the compiler exits
immediately and the finish hook is not called. */
- void (*post_options) PARAMS ((void));
+ bool (*post_options) PARAMS ((void));
/* Called after post_options, to initialize the front end. The main
input filename is passed, which may be NULL; the front end should
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 0c2fd7c..d1af33e 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -96,10 +96,10 @@ extern int size_directive_output;
extern tree last_assemble_variable_decl;
static void general_init PARAMS ((char *));
-static void parse_options_and_default_flags PARAMS ((int, char **));
-static void do_compile PARAMS ((void));
+static bool parse_options_and_default_flags PARAMS ((int, char **));
+static void do_compile PARAMS ((int));
static void process_options PARAMS ((void));
-static void lang_independent_init PARAMS ((void));
+static void lang_independent_init PARAMS ((int));
static int lang_dependent_init PARAMS ((const char *));
static void init_asm_output PARAMS ((const char *));
static void finalize PARAMS ((void));
@@ -4584,6 +4584,8 @@ general_init (argv0)
xmalloc_set_program_name (progname);
+ hex_init ();
+
gcc_init_libintl ();
/* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */
@@ -4614,8 +4616,10 @@ general_init (argv0)
/* Parse command line options and set default flag values, called
after language-independent option-independent initialization. Do
minimal options processing. Outputting diagnostics is OK, but GC
- and identifier hashtables etc. are not initialized yet. */
-static void
+ and identifier hashtables etc. are not initialized yet.
+
+ Return non-zero to suppress compiler back end initialization. */
+static bool
parse_options_and_default_flags (argc, argv)
int argc;
char **argv;
@@ -4846,7 +4850,7 @@ parse_options_and_default_flags (argc, argv)
/* All command line options have been parsed; allow the front end to
perform consistency checks, etc. */
- (*lang_hooks.post_options) ();
+ return (*lang_hooks.post_options) ();
}
/* Process the options that have been parsed. */
@@ -5025,7 +5029,8 @@ process_options ()
/* Language-independent initialization, before language-dependent
initialization. */
static void
-lang_independent_init ()
+lang_independent_init (no_backend)
+ int no_backend;
{
/* Initialize the garbage-collector, and string pools. */
init_ggc ();
@@ -5033,6 +5038,9 @@ lang_independent_init ()
init_stringpool ();
init_obstacks ();
+ if (no_backend)
+ return;
+
/* init_emit_once uses reg_raw_mode and therefore must be called
after init_regs which initialized reg_raw_mode. */
init_regs ();
@@ -5167,7 +5175,8 @@ finalize ()
/* Initialize the compiler, and compile the input file. */
static void
-do_compile ()
+do_compile (no_backend)
+ int no_backend;
{
/* The bulk of command line switch processing. */
process_options ();
@@ -5178,8 +5187,8 @@ do_compile ()
timevar_start (TV_TOTAL);
/* Language-independent initialization. Also sets up GC, identifier
- hashes etc. */
- lang_independent_init ();
+ hashes etc., and the back-end if requested. */
+ lang_independent_init (no_backend);
/* Language-dependent initialization. Returns true on success. */
if (lang_dependent_init (filename))
@@ -5204,18 +5213,18 @@ toplev_main (argc, argv)
int argc;
char **argv;
{
- hex_init ();
+ bool no_backend;
/* Initialization of GCC's environment, and diagnostics. */
general_init (argv[0]);
/* Parse the options and do minimal processing; basically just
enough to default flags appropriately. */
- parse_options_and_default_flags (argc, argv);
+ no_backend = parse_options_and_default_flags (argc, argv);
/* Exit early if we can (e.g. -help). */
if (!errorcount && !exit_after_options)
- do_compile ();
+ do_compile (no_backend);
if (errorcount || sorrycount)
return (FATAL_EXIT_CODE);