OSDN Git Service

* c-common.c (c_common_post_options): Update prototype;
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 7 Jul 2002 22:10:18 +0000 (22:10 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 7 Jul 2002 22:10:18 +0000 (22:10 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55306 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-common.c
gcc/c-common.h
gcc/java/ChangeLog
gcc/java/lang.c
gcc/langhooks-def.h
gcc/langhooks.h
gcc/toplev.c

index b14bb37..5b8a058 100644 (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>
 
        * sh.h (PRINT_OPERAND_PUNCT_VALID_P): Allow '\''.
index 57c191a..a948959 100644 (file)
@@ -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.  */
index b1fd976..8aac857 100644 (file)
@@ -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));
index d93b346..3863b14 100644 (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>
 
        * java/builtins.c (initialize_builtins): Ignore the additional
index 60dc67b..60f1a1c 100644 (file)
@@ -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"
index 6715159..246fea9 100644 (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_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
index 71ae251..0ec3c88 100644 (file)
@@ -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
index 0c2fd7c..d1af33e 100644 (file)
@@ -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) ();
 }
 \f
 /* 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 ()
 \f
 /* 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);