c-common.h (yyparse, [...]): New.
authorNeil Booth <neil@daikokuya.demon.co.uk>
Sun, 17 Mar 2002 20:41:46 +0000 (20:41 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Sun, 17 Mar 2002 20:41:46 +0000 (20:41 +0000)
* c-common.h (yyparse, c_common_parse_file): New.
* c-lang.c: Include c-common.h.
(LANG_HOOKS_PARSE_FILE): Redefine.
* c-lex.c: Include c-common.h.
(yyparse): Rename c_common_parse_file.  Call yyparse.
* c-parse.in (yyparse): Remove macro.
* c-tree.h (yyparse_1): Remove.
* langhooks-def.h (LANG_HOOKS_PARSE_FILE): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.h (struct lang_hoooks): New hook parse_file.
* toplev.c (compile_file): Use parse_file hook.
* tree.h (yyparse): Remove.
ada:
* misc.c (LANG_HOOKS_PARSE_FILE): Redefine.
(yyparse): Rename gnat_parse_file.
cp:
* cp-lang.c (LANG_HOOKS_PARSE_FILE): Redefine.
* parse.y (yyparse): Remove macro.
f:
* com.c (LANG_HOOKS_PARSE_FILE): Redefine.
* com.h (ffe_parse_file): New.
* parse.c (NAME_OF_STDIN): Remove.
(yyparse): Rename ffe_parse_file.
java:
* java-tree.h (java_parse_file): New.
* jcf-parse.c (yyparse): Rename java_parse_file.
* lang.c (LANG_HOOKS_PARSE_FILE): Redefine.
objc:
* objc-lang.c (LANG_HOOKS_PARSE_FILE): Redefine.

From-SVN: r50926

24 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/misc.c
gcc/c-common.h
gcc/c-lang.c
gcc/c-lex.c
gcc/c-parse.in
gcc/c-tree.h
gcc/cp/ChangeLog
gcc/cp/cp-lang.c
gcc/cp/parse.y
gcc/f/ChangeLog
gcc/f/com.c
gcc/f/com.h
gcc/f/parse.c
gcc/java/ChangeLog
gcc/java/java-tree.h
gcc/java/jcf-parse.c
gcc/java/lang.c
gcc/langhooks-def.h
gcc/langhooks.h
gcc/objc/objc-lang.c
gcc/toplev.c
gcc/tree.h

index 82285b7f5773955b50d92fd7e4a03b1903757c12..9c9c00c4788eabec636188e003db3f60c8dacb99 100644 (file)
@@ -1,3 +1,20 @@
+2002-03-17  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * c-common.h (yyparse, c_common_parse_file): New.
+       * c-lang.c: Include c-common.h.
+       (LANG_HOOKS_PARSE_FILE): Redefine.
+       * c-lex.c: Include c-common.h.
+       (yyparse): Rename c_common_parse_file.  Call yyparse.
+       * c-parse.in (yyparse): Remove macro.
+       * c-tree.h (yyparse_1): Remove.
+       * langhooks-def.h (LANG_HOOKS_PARSE_FILE): New.
+       (LANG_HOOKS_INITIALIZER): Update.
+       * langhooks.h (struct lang_hoooks): New hook parse_file.
+       * toplev.c (compile_file): Use parse_file hook.
+       * tree.h (yyparse): Remove.
+objc:
+       * objc-lang.c (LANG_HOOKS_PARSE_FILE): Redefine.
+
 2002-03-17  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * config/mmix/mmix.md ("truncdfsf2"): Correct operator is
index 07211fa7c6fd447bcbb2e7f65acf0b9456b068d3..9b062a7c0b844947db5b46ff8803ee953d688aad 100644 (file)
@@ -1,3 +1,8 @@
+2002-03-17  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * misc.c (LANG_HOOKS_PARSE_FILE): Redefine.
+       (yyparse): Rename gnat_parse_file.
+
 2002-03-14  Geoffrey Keating  <geoffk@redhat.com>
 
        Delete all lines containing "$Revision:".
index 393f70a8bfe72472f4b461ee524b695307be3f49..46e280213593009cb12a40e6e87f36a6819d1bde 100644 (file)
@@ -85,6 +85,7 @@ static void gnat_print_type           PARAMS ((FILE *, tree, int));
 static const char *gnat_printable_name PARAMS  ((tree, int));
 static tree gnat_eh_runtime_type       PARAMS ((tree));
 static int gnat_eh_type_covers         PARAMS ((tree, tree));
+static void gnat_parse_file            PARAMS ((void));
 
 /* Structure giving our language-specific hooks.  */
 
@@ -98,6 +99,8 @@ static int gnat_eh_type_covers                PARAMS ((tree, tree));
 #define LANG_HOOKS_INIT_OPTIONS                gnat_init_options
 #undef  LANG_HOOKS_DECODE_OPTION
 #define LANG_HOOKS_DECODE_OPTION       gnat_decode_option
+#undef LANG_HOOKS_PARSE_FILE
+#define LANG_HOOKS_PARSE_FILE          gnat_parse_file
 #undef LANG_HOOKS_HONOR_READONLY
 #define LANG_HOOKS_HONOR_READONLY      1
 #undef LANG_HOOKS_GET_ALIAS_SET
@@ -167,11 +170,10 @@ extern void __gnat_initialize     PARAMS((void));
 extern void adainit            PARAMS((void));
 extern void _ada_gnat1drv      PARAMS((void));
 
-/* For most front-ends, this is the parser for the language.  For us, we
-   process the GNAT tree.  */
+/* The parser for the language.  For us, we process the GNAT tree.  */
 
-int
-yyparse ()
+static void
+gnat_parse_file ()
 {
   /* call the target specific initializations */
   __gnat_initialize();
@@ -183,8 +185,6 @@ yyparse ()
 
   /* Call the front end */
   _ada_gnat1drv ();
-
-  return 0;
 }
 
 /* Decode all the language specific options that cannot be decoded by GCC.
index 280c5b0d2d2ac86368de2cfee5bedab311c82323..f93e6fe29cf87cf762a5e5c489ceb2aebf6e0845 100644 (file)
@@ -325,7 +325,7 @@ extern void (*lang_expand_function_end)         PARAMS ((void));
    noreturn attribute.  */
 extern int (*lang_missing_noreturn_ok_p)       PARAMS ((tree));
 
-
+extern int yyparse                             PARAMS ((void));
 extern stmt_tree current_stmt_tree              PARAMS ((void));
 extern tree *current_scope_stmt_stack           PARAMS ((void));
 extern void begin_stmt_tree                     PARAMS ((tree *));
@@ -552,6 +552,7 @@ extern void c_common_init_options           PARAMS ((enum c_language_kind));
 extern void 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 ((void));
 extern HOST_WIDE_INT c_common_get_alias_set    PARAMS ((tree));
 extern bool c_promoting_integer_type_p         PARAMS ((tree));
 extern int self_promoting_args_p               PARAMS ((tree));
index c01d256abb76477eb94c5f1d149a594ec08260a9..bb26001f18571a40fb900746b5d0d5458cbbf582 100644 (file)
@@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "system.h"
 #include "tree.h"
 #include "c-tree.h"
+#include "c-common.h"
 #include "langhooks.h"
 #include "langhooks-def.h"
 
@@ -49,6 +50,8 @@ static void c_post_options PARAMS ((void));
 #define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
 #undef LANG_HOOKS_SAFE_FROM_P
 #define LANG_HOOKS_SAFE_FROM_P c_safe_from_p
+#undef LANG_HOOKS_PARSE_FILE
+#define LANG_HOOKS_PARSE_FILE c_common_parse_file
 #undef LANG_HOOKS_STATICP
 #define LANG_HOOKS_STATICP c_staticp
 #undef LANG_HOOKS_PRINT_IDENTIFIER
index d157a3f0db2fd6bba5c0e3c6cd4f153ebc4d9e36..7bafde752debfb59f6e3f6767c98f07d84f6c3b9 100644 (file)
@@ -29,6 +29,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "output.h"
 #include "c-lex.h"
 #include "c-tree.h"
+#include "c-common.h"
 #include "flags.h"
 #include "timevar.h"
 #include "cpplib.h"
@@ -155,13 +156,13 @@ init_c_lex (filename)
    Also, make sure the start_source_file debug hook gets called for
    the primary source file.  */
 
-int
-yyparse()
+void
+c_common_parse_file ()
 {
   (*debug_hooks->start_source_file) (lineno, input_filename);
   cpp_finish_options (parse_in);
 
-  return yyparse_1();
+  yyparse ();
 }
 
 struct c_fileinfo *
index 80e4ca862194270958c2dd70d740c08c9ef8c55f..1628057b78409e806737893fc91f5455c808a3a6 100644 (file)
@@ -64,9 +64,6 @@ end ifobjc
 
 /* Cause the "yydebug" variable to be defined.  */
 #define YYDEBUG 1
-
-/* Rename the "yyparse" function so that we can override it elsewhere.  */
-#define yyparse yyparse_1
 %}
 
 %start program
index d6f622e0ff5834d3e5b34056644d47c15e4b4ae8..d39e3ff6e8369b73525da148bafd5c8a89380e2c 100644 (file)
@@ -161,7 +161,6 @@ extern tree lookup_objc_ivar                        PARAMS ((tree));
 /* in c-parse.in */
 extern void c_parse_init                       PARAMS ((void));
 extern void c_set_yydebug                      PARAMS ((int));
-extern int yyparse_1                           PARAMS ((void));
 
 /* in c-aux-info.c */
 extern void gen_aux_info_record                 PARAMS ((tree, int, int, int));
index 9ef43ede9467e0ec70bcb1249e614261505af13b..fd306a72857cf340fe100ecb0b4ee3340cf2d016 100644 (file)
@@ -1,3 +1,8 @@
+2002-03-17  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * cp-lang.c (LANG_HOOKS_PARSE_FILE): Redefine.
+       * parse.y (yyparse): Remove macro.
+
 2002-03-17  Jason Merrill  <jason@redhat.com>
 
        PR c++/5757
index 1a2713601b4006786b44547bc6c51622325443be..40defa57e9525b60e0a1265b768f0ed67b02641e 100644 (file)
@@ -51,6 +51,8 @@ static bool ok_to_generate_alias_set_for_type PARAMS ((tree));
 #define LANG_HOOKS_EXPAND_CONSTANT cplus_expand_constant
 #undef LANG_HOOKS_SAFE_FROM_P
 #define LANG_HOOKS_SAFE_FROM_P c_safe_from_p
+#undef LANG_HOOKS_PARSE_FILE
+#define LANG_HOOKS_PARSE_FILE c_common_parse_file
 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL cxx_dup_lang_specific_decl
 #undef LANG_HOOKS_UNSAVE_EXPR_NOW
index fd53a850cb25e1ca93f6bfc066cbfa3cebddd1a0..7988ec31edfbb4d87934d862fbcd22ce119263c2 100644 (file)
@@ -228,9 +228,6 @@ cp_parse_init ()
   ggc_add_tree_root (&current_enum_type, 1);
   ggc_add_tree_root (&saved_scopes, 1);
 }
-
-/* Rename the "yyparse" function so that we can override it elsewhere.  */
-#define yyparse yyparse_1
 %}
 
 %start program
index 0f3ec2c3a16efc1cc39020a19da75ff3db57828f..43c9c9c2c2e38d8766aac6002ede6e7785ca7cff 100644 (file)
@@ -1,3 +1,10 @@
+Sun Mar 17 20:57:30 2002  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * com.c (LANG_HOOKS_PARSE_FILE): Redefine.
+       * com.h (ffe_parse_file): New.
+       * parse.c (NAME_OF_STDIN): Remove.
+       (yyparse): Rename ffe_parse_file.
+
 Tue Mar 12 20:23:18 2002  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * com.c (tree_code_type, tree_code_length, tree_code_name):
index f895db4cb9f449dd1e064c588f3a90f26b423d19..016b422db256eedc458189ddb58b87fb4fa78dd6 100644 (file)
@@ -13928,7 +13928,7 @@ start_decl (tree decl, bool is_top_level)
 
    Returns 1 on success.  If the DECLARATOR is not suitable for a function
    (it defines a datum instead), we return 0, which tells
-   yyparse to report a parse error.
+   ffe_parse_file to report a parse error.
 
    NESTED is nonzero for a function nested within another function.  */
 
@@ -14211,6 +14211,8 @@ static void ffe_print_identifier PARAMS ((FILE *, tree, int));
 #define LANG_HOOKS_INIT_OPTIONS                ffe_init_options
 #undef  LANG_HOOKS_DECODE_OPTION
 #define LANG_HOOKS_DECODE_OPTION       ffe_decode_option
+#undef  LANG_HOOKS_PARSE_FILE
+#define LANG_HOOKS_PARSE_FILE          ffe_parse_file
 #undef  LANG_HOOKS_PRINT_IDENTIFIER
 #define LANG_HOOKS_PRINT_IDENTIFIER    ffe_print_identifier
 
index 5e20e2b10fb659ba756b4c69ea56b38f2b892a82..58b0131beec70f14b1ac2073e83b19e1a927494b 100644 (file)
@@ -265,6 +265,7 @@ tree ffecom_truth_value (tree expr);
 tree ffecom_truth_value_invert (tree expr);
 tree ffecom_type_expr (ffebld expr);
 tree ffecom_which_entrypoint_decl (void);
+void ffe_parse_file ();
 
 /* Define macros. */
 
index 29c6133c38b4a4414d683448256a32f3aade4e4c..fe48b6d4f9e7593f16b6e228151396f205ca5005 100644 (file)
@@ -26,12 +26,10 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "version.h"
 #include "flags.h"
 
-#define NAME_OF_STDIN "<stdin>"
-
 extern FILE *finput;
 
-int
-yyparse ()
+void
+ffe_parse_file ()
 {
   ffewhereFile wf;
 
@@ -46,6 +44,4 @@ yyparse ()
   ffe_file (wf, finput);
 
   ffecom_finish_compile ();
-
-  return 0;
 }
index ce82f8d6485f1673e7b6b14ea0cd3323235b4767..3dbb7f0d955f80006561a27b0b9f550ec802de97 100644 (file)
@@ -1,3 +1,9 @@
+2002-03-17  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * java-tree.h (java_parse_file): New.
+       * jcf-parse.c (yyparse): Rename java_parse_file.
+       * lang.c (LANG_HOOKS_PARSE_FILE): Redefine.
+
 2002-03-16  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
 
        * parse.y (craft_constructor): Return the constructor decl.
index 898c851cc9ec0a2f03571be06626d445e71eda4e..aa92f2718be1370ddf4deca9642ce2d3ada6aa39 100644 (file)
@@ -1037,6 +1037,7 @@ struct lang_type
 #define JCF_u2 unsigned short
 
 extern void java_set_yydebug PARAMS ((int));
+extern void java_parse_file PARAMS ((void));
 extern void add_assume_compiled PARAMS ((const char *, int));
 extern tree lookup_class PARAMS ((tree));
 extern tree lookup_java_constructor PARAMS ((tree, tree));
index d77ddce15dafff56e8c42acf2625c526f794b98b..9f5b44ee7d80f468bc488966d146efcec98f1675 100644 (file)
@@ -913,8 +913,8 @@ predefined_filename_p (node)
   return 0;
 }
 
-int
-yyparse ()
+void
+java_parse_file ()
 {
   int filename_count = 0;
   char *list, *next;
@@ -1054,7 +1054,7 @@ yyparse ()
       resource_filename = IDENTIFIER_POINTER (TREE_VALUE (current_file_list));
       compile_resource_file (resource_name, resource_filename);
 
-      return 0;
+      return;
     }
 
   current_jcf = main_jcf;
@@ -1156,7 +1156,6 @@ yyparse ()
       if (flag_indirect_dispatch)
        emit_offset_symbol_table ();
     }
-  return 0;
 }
 
 /* Process all class entries found in the zip file.  */
index 24e0375e27585eca840d66088240183cc59ff424..d9e5847a63efb8ce727a277ee91c95d962bad2b1 100644 (file)
@@ -221,6 +221,8 @@ static int dependency_tracking = 0;
 #define LANG_HOOKS_DECODE_OPTION java_decode_option
 #undef LANG_HOOKS_SET_YYDEBUG
 #define LANG_HOOKS_SET_YYDEBUG java_set_yydebug
+#undef LANG_HOOKS_PARSE_FILE
+#define LANG_HOOKS_PARSE_FILE java_parse_file
 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL java_dup_lang_specific_decl
 
index 06ca4f388e883a40e258a0067f059878e0d0ec48..ffc86d3958e75b1fcb7b81b2c07661695cbfbcdc 100644 (file)
@@ -68,6 +68,7 @@ void lhd_tree_inlining_end_inlining           PARAMS ((tree));
 #define LANG_HOOKS_IDENTIFIER_SIZE     sizeof (struct lang_identifier)
 #define LANG_HOOKS_INIT                        lhd_do_nothing
 #define LANG_HOOKS_FINISH              lhd_do_nothing
+#define LANG_HOOKS_PARSE_FILE          lhd_do_nothing
 #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
@@ -141,6 +142,7 @@ int lhd_tree_dump_type_quals                        PARAMS ((tree));
   LANG_HOOKS_POST_OPTIONS, \
   LANG_HOOKS_INIT, \
   LANG_HOOKS_FINISH, \
+  LANG_HOOKS_PARSE_FILE, \
   LANG_HOOKS_CLEAR_BINDING_STACK, \
   LANG_HOOKS_GET_ALIAS_SET, \
   LANG_HOOKS_EXPAND_CONSTANT, \
index 14eb999d9c06eefc7a0b11a6da2fc8f1574cfa11..c7e43ce63f7d14140691276a6f550050965efb69 100644 (file)
@@ -104,6 +104,9 @@ struct lang_hooks
   /* Called at the end of compilation, as a finalizer.  */
   void (*finish) PARAMS ((void));
 
+  /* Parses the entire file.  */
+  void (*parse_file) PARAMS ((void));
+
   /* Called immediately after parsing to clear the binding stack.  */
   void (*clear_binding_stack) PARAMS ((void));
 
index 2577f655fc999a5629bfaff5c818e40e587d8776..8f1a68bbfcfc49b3d0349ee6fdedc9726ac6a8f8 100644 (file)
@@ -44,6 +44,8 @@ static void objc_post_options                   PARAMS ((void));
 #define LANG_HOOKS_DECODE_OPTION objc_decode_option
 #undef LANG_HOOKS_POST_OPTIONS
 #define LANG_HOOKS_POST_OPTIONS objc_post_options
+#undef LANG_HOOKS_PARSE_FILE
+#define LANG_HOOKS_PARSE_FILE c_common_parse_file
 #undef LANG_HOOKS_STATICP
 #define LANG_HOOKS_STATICP c_staticp
 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
index 5ea36ae182c49c19264ed2f4b44622ff3bcea491..a99fdd1af19aa98fe0b9fa82af69cc55add34076 100644 (file)
@@ -2106,9 +2106,9 @@ compile_file ()
 
   timevar_push (TV_PARSE);
 
-  /* Call the parser, which parses the entire file
-     (calling rest_of_compilation for each function).  */
-  yyparse ();
+  /* Call the parser, which parses the entire file (calling
+     rest_of_compilation for each function).  */
+  (*lang_hooks.parse_file) ();
 
   /* In case there were missing block closers,
      get us back to the global binding level.  */
@@ -2116,7 +2116,6 @@ compile_file ()
 
   /* Compilation is now finished except for writing
      what's left of the symbol table output.  */
-
   timevar_pop (TV_PARSE);
 
   if (flag_syntax_only)
@@ -2339,7 +2338,7 @@ rest_of_type_compilation (type, toplev)
   timevar_pop (TV_SYMOUT);
 }
 
-/* This is called from finish_function (within yyparse)
+/* This is called from finish_function (within langhooks.parse_file)
    after each top-level definition is parsed.
    It is supposed to compile that function or variable
    and output the assembler code for it.
index 06b7dd556f2db822ba04cdafb33c0ab59d3bf997..d9ad985f342acb5c0632d4cac0e092890b240706 100644 (file)
@@ -2859,8 +2859,6 @@ extern tree fold_builtin          PARAMS ((tree));
 \f
 /* The language front-end must define these functions.  */
 
-/* Function called with no arguments to parse and compile the input.  */
-extern int yyparse                             PARAMS ((void));
 /* Functions for processing symbol declarations.  */
 /* Function to enter a new lexical scope.
    Takes one argument: always zero when called from outside the front end.  */