* c-lang.c (lang_hooks): Update.
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Jan 2001 07:51:11 +0000 (07:51 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Jan 2001 07:51:11 +0000 (07:51 +0000)
        (lang_decode_option): Remove.
        (lang_init_options): Rename c_init_options.
        * toplev.c (main): Use lang_hooks for lang_init_options
        and lang_decode_option.
        * toplev.h (lang_hooks): Add 2 new hooks.
        * tree.h: Remove lang_init_options and lang_decode_option.
        * cp/cp-tree.h (lang_decode_option): Rename cxx_decode_option.
        * cp/decl2.c: Similarly.
        * cp/lex.c (lang_init_options): Rename cxx_init_options.
        (lang_hooks): Update.
        * f/com.c (f_init, f_finish): Rename ffe_init, ffe_finish
        for consistency.
        (lang_init_options): Rename ffe_init_options.
        (lang_hooks): Update.
        (lang_decode_option): Remove.
        * java/lang.c (lang_init_options): Rename java_init_options.
        (lang_decode_option): Rename java_decode_option.
        (lang_hooks): Update.
        * objc/objc-act.c (lang_init_options): Rename objc_init_options.
        (lang_decode_option): Rename objc_decode_option.
        (lang_hooks): Update.

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

gcc/ChangeLog
gcc/c-lang.c
gcc/cp/cp-tree.h
gcc/cp/decl2.c
gcc/cp/lex.c
gcc/f/com.c
gcc/java/lang.c
gcc/objc/objc-act.c
gcc/toplev.c
gcc/toplev.h
gcc/tree.h

index 5cc5582..8686ddf 100644 (file)
@@ -1,3 +1,28 @@
+2001-01-10  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+        * c-lang.c (lang_hooks): Update.
+        (lang_decode_option): Remove.
+        (lang_init_options): Rename c_init_options.
+        * toplev.c (main): Use lang_hooks for lang_init_options
+        and lang_decode_option.
+        * toplev.h (lang_hooks): Add 2 new hooks.
+        * tree.h: Remove lang_init_options and lang_decode_option.
+        * cp/cp-tree.h (lang_decode_option): Rename cxx_decode_option.
+        * cp/decl2.c: Similarly.
+        * cp/lex.c (lang_init_options): Rename cxx_init_options.
+        (lang_hooks): Update.   
+        * f/com.c (f_init, f_finish): Rename ffe_init, ffe_finish
+        for consistency.
+        (lang_init_options): Rename ffe_init_options.
+        (lang_hooks): Update.
+        (lang_decode_option): Remove.
+        * java/lang.c (lang_init_options): Rename java_init_options.
+        (lang_decode_option): Rename java_decode_option.
+        (lang_hooks): Update.
+        * objc/objc-act.c (lang_init_options): Rename objc_init_options.
+        (lang_decode_option): Rename objc_decode_option.
+        (lang_hooks): Update.
+
 2001-01-09  Nick Clifton  <nickc@redhat.com>
 
        * config/d30v/d30v.c (d30v_eh_epilogue_sp_ofs): Delete.
index f8cefb3..dfd772f 100644 (file)
@@ -39,11 +39,14 @@ Boston, MA 02111-1307, USA.  */
 static int c_tree_printer PARAMS ((output_buffer *));
 static int c_missing_noreturn_ok_p PARAMS ((tree));
 static void c_init PARAMS ((void));
+static void c_init_options PARAMS ((void));
 static void c_post_options PARAMS ((void));
 
 /* Each front end provides its own.  */
 struct lang_hooks lang_hooks = {c_init,
                                NULL, /* c_finish */
+                               c_init_options,
+                               c_decode_option,
                                c_post_options};
 
 /* Post-switch processing.  */
@@ -53,18 +56,8 @@ c_post_options ()
   cpp_post_options (parse_in);
 }
 
-/* Each of the functions defined here
-   is an alternative to a function in objc-actions.c.  */
-int
-lang_decode_option (argc, argv)
-     int argc;
-     char **argv;
-{
-  return c_decode_option (argc, argv);
-}
-
-void
-lang_init_options ()
+static void
+c_init_options ()
 {
   parse_in = cpp_create_reader (CLK_GNUC89);
 
index e2309e9..d0664b1 100644 (file)
@@ -3913,7 +3913,7 @@ extern tmpl_spec_kind current_tmpl_spec_kind    PARAMS ((int));
 /* in decl2.c */
 extern void init_decl2                         PARAMS ((void));
 extern int check_java_method                   PARAMS ((tree));
-extern int lang_decode_option                  PARAMS ((int, char **));
+extern int cxx_decode_option                   PARAMS ((int, char **));
 extern int grok_method_quals                   PARAMS ((tree, tree, tree));
 extern void warn_if_unknown_interface          PARAMS ((tree));
 extern void grok_x_components                  PARAMS ((tree));
index 8bdd43e..f051a45 100644 (file)
@@ -560,7 +560,7 @@ compare_options (p1, p2)
    recognise the option.  */
 
 int   
-lang_decode_option (argc, argv)
+cxx_decode_option (argc, argv)
      int argc;
      char **argv;
 {
index 3203b4c..f295e7c 100644 (file)
@@ -63,6 +63,7 @@ static void handle_pragma_interface PARAMS ((cpp_reader *));
 static void handle_pragma_implementation PARAMS ((cpp_reader *));
 static void cxx_init PARAMS ((void));
 static void cxx_finish PARAMS ((void));
+static void cxx_init_options PARAMS ((void));
 static void cxx_post_options PARAMS ((void));
 
 #ifdef GATHER_STATISTICS
@@ -246,6 +247,8 @@ static const char *cplus_tree_code_name[] = {
 /* Each front end provides its own hooks, for toplev.c.  */
 struct lang_hooks lang_hooks = {cxx_init,
                                cxx_finish,
+                               cxx_init_options,
+                               cxx_decode_option,
                                cxx_post_options};
 
 /* Post-switch processing.  */
@@ -255,8 +258,8 @@ cxx_post_options ()
   cpp_post_options (parse_in);
 }
 
-void
-lang_init_options ()
+static void
+cxx_init_options ()
 {
   parse_in = cpp_create_reader (CLK_GNUCXX);
 
index cdd48bf..3e66467 100644 (file)
@@ -14677,21 +14677,16 @@ insert_block (block)
 }
 
 /* Each front end provides its own.  */
-static void f_init PARAMS ((void));
-static void f_finish PARAMS ((void));
-
-struct lang_hooks lang_hooks = {f_init,
-                               f_finish,
+static void ffe_init PARAMS ((void));
+static void ffe_finish PARAMS ((void));
+static void ffe_init_options PARAMS ((void));
+
+struct lang_hooks lang_hooks = {ffe_init,
+                               ffe_finish,
+                               ffe_init_options,
+                               ffe_decode_option,
                                NULL /* post_options */};
 
-int
-lang_decode_option (argc, argv)
-     int argc;
-     char **argv;
-{
-  return ffe_decode_option (argc, argv);
-}
-
 /* used by print-tree.c */
 
 void
@@ -14703,7 +14698,7 @@ lang_print_xnode (file, node, indent)
 }
 
 static void
-f_finish ()
+ffe_finish ()
 {
   ffe_terminate_0 ();
 
@@ -14732,8 +14727,8 @@ lang_get_alias_set (t)
   return 0;
 }
 
-void
-lang_init_options ()
+static void
+ffe_init_options ()
 {
   /* Set default options for Fortran.  */
   flag_move_all_movables = 1;
@@ -14744,7 +14739,7 @@ lang_init_options ()
 }
 
 static void
-f_init ()
+ffe_init ()
 {
   /* If the file is output from cpp, it should contain a first line
      `# 1 "real-filename"', and the current design of gcc (toplev.c
index 9b299b2..a88203c 100644 (file)
@@ -46,6 +46,8 @@ struct string_option
 };
 
 static void java_init PARAMS ((void));
+static void java_init_options PARAMS ((void));
+static int java_decode_option PARAMS ((int, char **));
 static void put_decl_string PARAMS ((const char *, int));
 static void put_decl_node PARAMS ((tree));
 static void java_dummy_print PARAMS ((const char *));
@@ -190,6 +192,8 @@ static int dependency_tracking = 0;
 /* Each front end provides its own.  */
 struct lang_hooks lang_hooks = {java_init,
                                NULL, /* java_finish */
+                               java_init_options,
+                               java_decode_option,
                                NULL /* post_options */};
 
 /* Process an option that can accept a `no-' form.
@@ -224,8 +228,8 @@ process_option_with_no (p, table, table_size)
  * process java-specific compiler command-line options
  * return 0, but do not complain if the option is not recognised.
  */
-int
-lang_decode_option (argc, argv)
+static int
+java_decode_option (argc, argv)
      int argc __attribute__ ((__unused__));
      char **argv;
 {
@@ -678,8 +682,8 @@ void lang_init_source (level)
     print_error_function = lang_print_error;
 }
 
-void
-lang_init_options ()
+static void
+java_init_options ()
 {
   flag_new_exceptions = 1;
   flag_bounds_check = 1;
index b70c3e6..12af8f9 100644 (file)
@@ -148,8 +148,10 @@ char *util_firstobj;
 
 static void init_objc                          PARAMS ((void));
 static void finish_objc                                PARAMS ((void));
-static void objc_post_options                  PARAMS ((void));
 static void objc_init                          PARAMS ((void));
+static void objc_init_options                  PARAMS ((void));
+static int objc_decode_option                  PARAMS ((int, char **));
+static void objc_post_options                  PARAMS ((void));
 
 /* Code generation.  */
 
@@ -631,6 +633,8 @@ static int print_struct_values = 0;
 /* Each front end provides its own.  */
 struct lang_hooks lang_hooks = {objc_init,
                                NULL, /* objc_finish */
+                               objc_init_options,
+                               objc_decode_option,
                                objc_post_options};
 
 /* Post-switch processing.  */
@@ -703,8 +707,8 @@ generate_struct_by_value_array ()
   exit (0);
 }
 
-void
-lang_init_options ()
+static void
+objc_init_options ()
 {
   parse_in = cpp_create_reader (CLK_OBJC);
   c_language = clk_objective_c;
@@ -774,8 +778,8 @@ lang_identify ()
   return "objc";
 }
 
-int
-lang_decode_option (argc, argv)
+static int
+objc_decode_option (argc, argv)
      int argc;
      char **argv;
 {
index 32effd4..e9ca071 100644 (file)
@@ -4590,7 +4590,8 @@ main (argc, argv)
   initialize_diagnostics ();
 
   /* Perform language-specific options intialization.  */
-  lang_init_options ();
+  if (lang_hooks.init_options)
+    (*lang_hooks.init_options) ();
 
   /* Scan to see what optimization level has been specified.  That will
      determine the default value of many flags.  */
@@ -4700,7 +4701,7 @@ main (argc, argv)
       unsigned int indep_processed;
 
       /* Give the language a chance to decode the option for itself.  */
-      lang_processed = lang_decode_option (argc - i, argv + i);
+      lang_processed = (*lang_hooks.decode_option) (argc - i, argv + i);
 
       /* Now see if the option also has a language independent meaning.
         Some options are both language specific and language independent,
@@ -4770,7 +4771,7 @@ main (argc, argv)
       flag_no_inline = 1;
       warn_inline = 0;
 
-      /* The c_decode_option and lang_decode_option functions set
+      /* The c_decode_option function and decode_option hook set
         this to `2' if -Wall is used, so we can avoid giving out
         lots of errors for people who don't realize what -Wall does.  */
       if (warn_uninitialized == 1)
index f0c37f8..97134d9 100644 (file)
@@ -142,6 +142,16 @@ struct lang_hooks
   /* Called last, as a finalizer.  */
   void (*finish) PARAMS ((void));
 
+  /* Called to initialize options, before any calls to decode_option.  */
+  void (*init_options) PARAMS ((void));
+
+  /* Function called with an option vector as argument, to decode a
+     single option (typically starting with -f or -W or +).  It should
+     return the number of command-line arguments it uses if it handles
+     the option, or 0 and not complain if it does not recognise the
+     option.  This hook cannot be NULL.  */
+  int (*decode_option) PARAMS ((int, char **));
+
   /* Called when all command line options have been processed.  */
   void (*post_options) PARAMS ((void));
 };
index b6129fc..d77336f 100644 (file)
@@ -2563,9 +2563,6 @@ extern tree fold_builtin          PARAMS ((tree));
 \f
 /* The language front-end must define these functions.  */
 
-/* Function of no arguments for initializing options.  */
-extern void lang_init_options                  PARAMS ((void));
-
 /* Function of no arguments for initializing lexical scanning.  */
 extern void init_lex                           PARAMS ((void));
 /* Function of no arguments for initializing the symbol table.  */
@@ -2583,11 +2580,6 @@ extern void copy_lang_decl                       PARAMS ((tree));
 
 /* Function called with no arguments to parse and compile the input.  */
 extern int yyparse                             PARAMS ((void));
-/* Function called with option as argument
-   to decode options starting with -f or -W or +.
-   It should return nonzero if it handles the option.  */
-extern int lang_decode_option                  PARAMS ((int, char **));
-
 /* Functions for processing symbol declarations.  */
 /* Function to enter a new lexical scope.
    Takes one argument: always zero when called from outside the front end.  */