c-common.c (c_common_post_options): Update prototype; don't init backends if preprocessing only.

* 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.
java:
	* lang.c (java_post_options): Update prototype.

From-SVN: r55306
This commit is contained in:
Neil Booth 2002-07-07 22:10:18 +00:00 committed by Neil Booth
parent c8cc4417e4
commit 5351f1ca74
8 changed files with 55 additions and 19 deletions

View File

@ -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> Sun Jul 7 20:38:38 2002 J"orn Rennecke <joern.rennecke@superh.com>
* sh.h (PRINT_OPERAND_PUNCT_VALID_P): Allow '\''. * sh.h (PRINT_OPERAND_PUNCT_VALID_P): Allow '\''.

View File

@ -4244,7 +4244,7 @@ c_common_init_options (lang)
} }
/* Post-switch processing. */ /* Post-switch processing. */
void bool
c_common_post_options () c_common_post_options ()
{ {
cpp_post_options (parse_in); 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 /* If an error has occurred in cpplib, note it so we fail
immediately. */ immediately. */
errorcount += cpp_errors (parse_in); errorcount += cpp_errors (parse_in);
return flag_preprocess_only;
} }
/* Hook that registers front end and target-specific built-ins. */ /* Hook that registers front end and target-specific built-ins. */

View File

@ -594,7 +594,7 @@ extern void disable_builtin_function PARAMS ((const char *));
extern tree build_va_arg PARAMS ((tree, tree)); extern tree build_va_arg PARAMS ((tree, tree));
extern void c_common_init_options PARAMS ((enum c_language_kind)); 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 const char *c_common_init PARAMS ((const char *));
extern void c_common_finish PARAMS ((void)); extern void c_common_finish PARAMS ((void));
extern void c_common_parse_file PARAMS ((int)); extern void c_common_parse_file PARAMS ((int));

View File

@ -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> 2002-07-05 Roger Sayle <roger@eyesopen.com>
* java/builtins.c (initialize_builtins): Ignore the additional * java/builtins.c (initialize_builtins): Ignore the additional

View File

@ -51,7 +51,7 @@ struct string_option
static const char *java_init PARAMS ((const char *)); static const char *java_init PARAMS ((const char *));
static void java_finish PARAMS ((void)); static void java_finish PARAMS ((void));
static void java_init_options 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 int java_decode_option PARAMS ((int, char **));
static void put_decl_string PARAMS ((const char *, int)); static void put_decl_string PARAMS ((const char *, int));
@ -780,7 +780,7 @@ java_init_options ()
} }
/* Post-switch processing. */ /* Post-switch processing. */
static void static bool
java_post_options () java_post_options ()
{ {
/* Turn off RTL inliner unless -finline-functions was really specified. */ /* Turn off RTL inliner unless -finline-functions was really specified. */
@ -789,6 +789,9 @@ java_post_options ()
flag_no_inline = 1; flag_no_inline = 1;
flag_inline_functions = 0; flag_inline_functions = 0;
} }
/* Initialize the compiler back end. */
return false;
} }
#include "gt-java-lang.h" #include "gt-java-lang.h"

View File

@ -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_CLEAR_BINDING_STACK lhd_clear_binding_stack
#define LANG_HOOKS_INIT_OPTIONS lhd_do_nothing #define LANG_HOOKS_INIT_OPTIONS lhd_do_nothing
#define LANG_HOOKS_DECODE_OPTION lhd_decode_option #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_GET_ALIAS_SET lhd_get_alias_set
#define LANG_HOOKS_EXPAND_CONSTANT lhd_return_tree #define LANG_HOOKS_EXPAND_CONSTANT lhd_return_tree
#define LANG_HOOKS_EXPAND_EXPR lhd_expand_expr #define LANG_HOOKS_EXPAND_EXPR lhd_expand_expr

View File

@ -198,9 +198,12 @@ struct lang_hooks
initialization should be left to the "init" callback, since GC initialization should be left to the "init" callback, since GC
and the identifier hashes are set up between now and then. 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 If errorcount is non-zero after this call the compiler exits
immediately and the finish hook is not called. */ 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 /* Called after post_options, to initialize the front end. The main
input filename is passed, which may be NULL; the front end should input filename is passed, which may be NULL; the front end should

View File

@ -96,10 +96,10 @@ extern int size_directive_output;
extern tree last_assemble_variable_decl; extern tree last_assemble_variable_decl;
static void general_init PARAMS ((char *)); static void general_init PARAMS ((char *));
static void parse_options_and_default_flags PARAMS ((int, char **)); static bool parse_options_and_default_flags PARAMS ((int, char **));
static void do_compile PARAMS ((void)); static void do_compile PARAMS ((int));
static void process_options PARAMS ((void)); 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 int lang_dependent_init PARAMS ((const char *));
static void init_asm_output PARAMS ((const char *)); static void init_asm_output PARAMS ((const char *));
static void finalize PARAMS ((void)); static void finalize PARAMS ((void));
@ -4584,6 +4584,8 @@ general_init (argv0)
xmalloc_set_program_name (progname); xmalloc_set_program_name (progname);
hex_init ();
gcc_init_libintl (); gcc_init_libintl ();
/* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */ /* 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 /* Parse command line options and set default flag values, called
after language-independent option-independent initialization. Do after language-independent option-independent initialization. Do
minimal options processing. Outputting diagnostics is OK, but GC minimal options processing. Outputting diagnostics is OK, but GC
and identifier hashtables etc. are not initialized yet. */ and identifier hashtables etc. are not initialized yet.
static void
Return non-zero to suppress compiler back end initialization. */
static bool
parse_options_and_default_flags (argc, argv) parse_options_and_default_flags (argc, argv)
int argc; int argc;
char **argv; 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 /* All command line options have been parsed; allow the front end to
perform consistency checks, etc. */ perform consistency checks, etc. */
(*lang_hooks.post_options) (); return (*lang_hooks.post_options) ();
} }
/* Process the options that have been parsed. */ /* Process the options that have been parsed. */
@ -5025,7 +5029,8 @@ process_options ()
/* Language-independent initialization, before language-dependent /* Language-independent initialization, before language-dependent
initialization. */ initialization. */
static void static void
lang_independent_init () lang_independent_init (no_backend)
int no_backend;
{ {
/* Initialize the garbage-collector, and string pools. */ /* Initialize the garbage-collector, and string pools. */
init_ggc (); init_ggc ();
@ -5033,6 +5038,9 @@ lang_independent_init ()
init_stringpool (); init_stringpool ();
init_obstacks (); init_obstacks ();
if (no_backend)
return;
/* init_emit_once uses reg_raw_mode and therefore must be called /* init_emit_once uses reg_raw_mode and therefore must be called
after init_regs which initialized reg_raw_mode. */ after init_regs which initialized reg_raw_mode. */
init_regs (); init_regs ();
@ -5167,7 +5175,8 @@ finalize ()
/* Initialize the compiler, and compile the input file. */ /* Initialize the compiler, and compile the input file. */
static void static void
do_compile () do_compile (no_backend)
int no_backend;
{ {
/* The bulk of command line switch processing. */ /* The bulk of command line switch processing. */
process_options (); process_options ();
@ -5178,8 +5187,8 @@ do_compile ()
timevar_start (TV_TOTAL); timevar_start (TV_TOTAL);
/* Language-independent initialization. Also sets up GC, identifier /* Language-independent initialization. Also sets up GC, identifier
hashes etc. */ hashes etc., and the back-end if requested. */
lang_independent_init (); lang_independent_init (no_backend);
/* Language-dependent initialization. Returns true on success. */ /* Language-dependent initialization. Returns true on success. */
if (lang_dependent_init (filename)) if (lang_dependent_init (filename))
@ -5204,18 +5213,18 @@ toplev_main (argc, argv)
int argc; int argc;
char **argv; char **argv;
{ {
hex_init (); bool no_backend;
/* Initialization of GCC's environment, and diagnostics. */ /* Initialization of GCC's environment, and diagnostics. */
general_init (argv[0]); general_init (argv[0]);
/* Parse the options and do minimal processing; basically just /* Parse the options and do minimal processing; basically just
enough to default flags appropriately. */ 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). */ /* Exit early if we can (e.g. -help). */
if (!errorcount && !exit_after_options) if (!errorcount && !exit_after_options)
do_compile (); do_compile (no_backend);
if (errorcount || sorrycount) if (errorcount || sorrycount)
return (FATAL_EXIT_CODE); return (FATAL_EXIT_CODE);