OSDN Git Service

Merge from pch-branch.
[pf3gnuchains/gcc-fork.git] / gcc / java / parse.y
index 4da4b5f..c67a42e 100644 (file)
@@ -73,272 +73,263 @@ definitions and other extensions.  */
 #include "tree-inline.h"
 
 /* Local function prototypes */
-static char *java_accstring_lookup PARAMS ((int));
-static void  classitf_redefinition_error PARAMS ((const char *,tree, tree, tree));
-static void  variable_redefinition_error PARAMS ((tree, tree, tree, int));
-static tree  create_class PARAMS ((int, tree, tree, tree));
-static tree  create_interface PARAMS ((int, tree, tree));
-static void  end_class_declaration PARAMS ((int));
-static tree  find_field PARAMS ((tree, tree));
-static tree lookup_field_wrapper PARAMS ((tree, tree));
-static int   duplicate_declaration_error_p PARAMS ((tree, tree, tree));
-static void  register_fields PARAMS ((int, tree, tree));
-static tree parser_qualified_classname PARAMS ((tree));
-static int  parser_check_super PARAMS ((tree, tree, tree));
-static int  parser_check_super_interface PARAMS ((tree, tree, tree));
-static void check_modifiers_consistency PARAMS ((int));
-static tree lookup_cl PARAMS ((tree));
-static tree lookup_java_method2 PARAMS ((tree, tree, int));
-static tree method_header PARAMS ((int, tree, tree, tree));
-static void fix_method_argument_names PARAMS ((tree ,tree));
-static tree method_declarator PARAMS ((tree, tree));
-static void parse_warning_context PARAMS ((tree cl, const char *msg, ...))
+static char *java_accstring_lookup (int);
+static void  classitf_redefinition_error (const char *,tree, tree, tree);
+static void  variable_redefinition_error (tree, tree, tree, int);
+static tree  create_class (int, tree, tree, tree);
+static tree  create_interface (int, tree, tree);
+static void  end_class_declaration (int);
+static tree  find_field (tree, tree);
+static tree lookup_field_wrapper (tree, tree);
+static int   duplicate_declaration_error_p (tree, tree, tree);
+static void  register_fields (int, tree, tree);
+static tree parser_qualified_classname (tree);
+static int  parser_check_super (tree, tree, tree);
+static int  parser_check_super_interface (tree, tree, tree);
+static void check_modifiers_consistency (int);
+static tree lookup_cl (tree);
+static tree lookup_java_method2 (tree, tree, int);
+static tree method_header (int, tree, tree, tree);
+static void fix_method_argument_names (tree ,tree);
+static tree method_declarator (tree, tree);
+static void parse_warning_context (tree cl, const char *msg, ...)
   ATTRIBUTE_PRINTF_2;
-static void issue_warning_error_from_context PARAMS ((tree, const char *msg, va_list))
+static void issue_warning_error_from_context (tree, const char *msg, va_list)
   ATTRIBUTE_PRINTF (2, 0);
-static void parse_ctor_invocation_error PARAMS ((void));
-static tree parse_jdk1_1_error PARAMS ((const char *));
-static void complete_class_report_errors PARAMS ((jdep *));
-static int process_imports PARAMS ((void));
-static void read_import_dir PARAMS ((tree));
-static int find_in_imports_on_demand PARAMS ((tree, tree));
-static void find_in_imports PARAMS ((tree, tree));
-static void check_inner_class_access PARAMS ((tree, tree, tree));
-static int check_pkg_class_access PARAMS ((tree, tree, bool));
-static void register_package PARAMS ((tree));
-static tree resolve_package PARAMS ((tree, tree *, tree *));
-static tree resolve_class PARAMS ((tree, tree, tree, tree));
-static void declare_local_variables PARAMS ((int, tree, tree));
-static void dump_java_tree PARAMS ((enum tree_dump_index, tree));
-static void source_start_java_method PARAMS ((tree));
-static void source_end_java_method PARAMS ((void));
-static tree find_name_in_single_imports PARAMS ((tree));
-static void check_abstract_method_header PARAMS ((tree));
-static tree lookup_java_interface_method2 PARAMS ((tree, tree));
-static tree resolve_expression_name PARAMS ((tree, tree *));
-static tree maybe_create_class_interface_decl PARAMS ((tree, tree, tree, tree));
-static int check_class_interface_creation PARAMS ((int, int, tree,
-                                                 tree, tree, tree));
-static tree patch_method_invocation PARAMS ((tree, tree, tree, int,
-                                           int *, tree *));
-static int breakdown_qualified PARAMS ((tree *, tree *, tree));
-static int in_same_package PARAMS ((tree, tree));
-static tree resolve_and_layout PARAMS ((tree, tree));
-static tree qualify_and_find PARAMS ((tree, tree, tree));
-static tree resolve_no_layout PARAMS ((tree, tree));
-static int invocation_mode PARAMS ((tree, int));
-static tree find_applicable_accessible_methods_list PARAMS ((int, tree,
-                                                           tree, tree));
-static void search_applicable_methods_list PARAMS ((int, tree, tree, tree,
-                                                  tree *, tree *));
-static tree find_most_specific_methods_list PARAMS ((tree));
-static int argument_types_convertible PARAMS ((tree, tree));
-static tree patch_invoke PARAMS ((tree, tree, tree));
-static int maybe_use_access_method PARAMS ((int, tree *, tree *));
-static tree lookup_method_invoke PARAMS ((int, tree, tree, tree, tree));
-static tree register_incomplete_type PARAMS ((int, tree, tree, tree));
-static tree check_inner_circular_reference PARAMS ((tree, tree));
-static tree check_circular_reference PARAMS ((tree));
-static tree obtain_incomplete_type PARAMS ((tree));
-static tree java_complete_lhs PARAMS ((tree));
-static tree java_complete_tree PARAMS ((tree));
-static tree maybe_generate_pre_expand_clinit PARAMS ((tree));
-static int analyze_clinit_body PARAMS ((tree, tree));
-static int maybe_yank_clinit PARAMS ((tree));
-static void start_complete_expand_method PARAMS ((tree));
-static void java_complete_expand_method PARAMS ((tree));
-static void java_expand_method_bodies PARAMS ((tree));
-static int  unresolved_type_p PARAMS ((tree, tree *));
-static void create_jdep_list PARAMS ((struct parser_ctxt *));
-static tree build_expr_block PARAMS ((tree, tree));
-static tree enter_block PARAMS ((void));
-static tree exit_block PARAMS ((void));
-static tree lookup_name_in_blocks PARAMS ((tree));
-static void maybe_absorb_scoping_blocks PARAMS ((void));
-static tree build_method_invocation PARAMS ((tree, tree));
-static tree build_new_invocation PARAMS ((tree, tree));
-static tree build_assignment PARAMS ((int, int, tree, tree));
-static tree build_binop PARAMS ((enum tree_code, int, tree, tree));
-static tree patch_assignment PARAMS ((tree, tree));
-static tree patch_binop PARAMS ((tree, tree, tree));
-static tree build_unaryop PARAMS ((int, int, tree));
-static tree build_incdec PARAMS ((int, int, tree, int));
-static tree patch_unaryop PARAMS ((tree, tree));
-static tree build_cast PARAMS ((int, tree, tree));
-static tree build_null_of_type PARAMS ((tree));
-static tree patch_cast PARAMS ((tree, tree));
-static int valid_ref_assignconv_cast_p PARAMS ((tree, tree, int));
-static int valid_builtin_assignconv_identity_widening_p PARAMS ((tree, tree));
-static int valid_cast_to_p PARAMS ((tree, tree));
-static int valid_method_invocation_conversion_p PARAMS ((tree, tree));
-static tree try_builtin_assignconv PARAMS ((tree, tree, tree));
-static tree try_reference_assignconv PARAMS ((tree, tree));
-static tree build_unresolved_array_type PARAMS ((tree));
-static int build_type_name_from_array_name PARAMS ((tree, tree *));
-static tree build_array_from_name PARAMS ((tree, tree, tree, tree *));
-static tree build_array_ref PARAMS ((int, tree, tree));
-static tree patch_array_ref PARAMS ((tree));
-static tree make_qualified_name PARAMS ((tree, tree, int));
-static tree merge_qualified_name PARAMS ((tree, tree));
-static tree make_qualified_primary PARAMS ((tree, tree, int));
-static int resolve_qualified_expression_name PARAMS ((tree, tree *,
-                                                    tree *, tree *));
-static void qualify_ambiguous_name PARAMS ((tree));
-static tree resolve_field_access PARAMS ((tree, tree *, tree *));
-static tree build_newarray_node PARAMS ((tree, tree, int));
-static tree patch_newarray PARAMS ((tree));
-static tree resolve_type_during_patch PARAMS ((tree));
-static tree build_this PARAMS ((int));
-static tree build_wfl_wrap PARAMS ((tree, int));
-static tree build_return PARAMS ((int, tree));
-static tree patch_return PARAMS ((tree));
-static tree maybe_access_field PARAMS ((tree, tree, tree));
-static int complete_function_arguments PARAMS ((tree));
-static int check_for_static_method_reference PARAMS ((tree, tree, tree,
-                                                     tree, tree));
-static int not_accessible_p PARAMS ((tree, tree, tree, int));
-static void check_deprecation PARAMS ((tree, tree));
-static int class_in_current_package PARAMS ((tree));
-static tree build_if_else_statement PARAMS ((int, tree, tree, tree));
-static tree patch_if_else_statement PARAMS ((tree));
-static tree add_stmt_to_compound PARAMS ((tree, tree, tree));
-static tree add_stmt_to_block PARAMS ((tree, tree, tree));
-static tree patch_exit_expr PARAMS ((tree));
-static tree build_labeled_block PARAMS ((int, tree));
-static tree finish_labeled_statement PARAMS ((tree, tree));
-static tree build_bc_statement PARAMS ((int, int, tree));
-static tree patch_bc_statement PARAMS ((tree));
-static tree patch_loop_statement PARAMS ((tree));
-static tree build_new_loop PARAMS ((tree));
-static tree build_loop_body PARAMS ((int, tree, int));
-static tree finish_loop_body PARAMS ((int, tree, tree, int));
-static tree build_debugable_stmt PARAMS ((int, tree));
-static tree finish_for_loop PARAMS ((int, tree, tree, tree));
-static tree patch_switch_statement PARAMS ((tree));
-static tree string_constant_concatenation PARAMS ((tree, tree));
-static tree build_string_concatenation PARAMS ((tree, tree));
-static tree patch_string_cst PARAMS ((tree));
-static tree patch_string PARAMS ((tree));
-static tree encapsulate_with_try_catch PARAMS ((int, tree, tree, tree));
-static tree build_assertion PARAMS ((int, tree, tree));
-static tree build_try_statement PARAMS ((int, tree, tree));
-static tree build_try_finally_statement PARAMS ((int, tree, tree));
-static tree patch_try_statement PARAMS ((tree));
-static tree patch_synchronized_statement PARAMS ((tree, tree));
-static tree patch_throw_statement PARAMS ((tree, tree));
-static void check_thrown_exceptions PARAMS ((int, tree));
-static int check_thrown_exceptions_do PARAMS ((tree));
-static void purge_unchecked_exceptions PARAMS ((tree));
-static bool ctors_unchecked_throws_clause_p PARAMS ((tree));
-static void check_throws_clauses PARAMS ((tree, tree, tree));
-static void finish_method_declaration PARAMS ((tree));
-static tree build_super_invocation PARAMS ((tree));
-static int verify_constructor_circularity PARAMS ((tree, tree));
-static char *constructor_circularity_msg PARAMS ((tree, tree));
-static tree build_this_super_qualified_invocation PARAMS ((int, tree, tree,
-                                                         int, int));
-static const char *get_printable_method_name PARAMS ((tree));
-static tree patch_conditional_expr PARAMS ((tree, tree, tree));
-static tree generate_finit PARAMS ((tree));
-static tree generate_instinit PARAMS ((tree));
-static tree build_instinit_invocation PARAMS ((tree));
-static void fix_constructors PARAMS ((tree));
-static tree build_alias_initializer_parameter_list PARAMS ((int, tree,
-                                                           tree, int *));
-static tree craft_constructor PARAMS ((tree, tree));
-static int verify_constructor_super PARAMS ((tree));
-static tree create_artificial_method PARAMS ((tree, int, tree, tree, tree));
-static void start_artificial_method_body PARAMS ((tree));
-static void end_artificial_method_body PARAMS ((tree));
-static int check_method_redefinition PARAMS ((tree, tree));
-static int check_method_types_complete PARAMS ((tree));
-static void java_check_regular_methods PARAMS ((tree));
-static void java_check_abstract_methods PARAMS ((tree));
-static void unreachable_stmt_error PARAMS ((tree));
-static tree find_expr_with_wfl PARAMS ((tree));
-static void missing_return_error PARAMS ((tree));
-static tree build_new_array_init PARAMS ((int, tree));
-static tree patch_new_array_init PARAMS ((tree, tree));
-static tree maybe_build_array_element_wfl PARAMS ((tree));
-static int array_constructor_check_entry PARAMS ((tree, tree));
-static const char *purify_type_name PARAMS ((const char *));
-static tree fold_constant_for_init PARAMS ((tree, tree));
-static tree strip_out_static_field_access_decl PARAMS ((tree));
-static jdeplist *reverse_jdep_list PARAMS ((struct parser_ctxt *));
-static void static_ref_err PARAMS ((tree, tree, tree));
-static void parser_add_interface PARAMS ((tree, tree, tree));
-static void add_superinterfaces PARAMS ((tree, tree));
-static tree jdep_resolve_class PARAMS ((jdep *));
-static int note_possible_classname PARAMS ((const char *, int));
-static void java_complete_expand_classes PARAMS ((void));
-static void java_complete_expand_class PARAMS ((tree));
-static void java_complete_expand_methods PARAMS ((tree));
-static tree cut_identifier_in_qualified PARAMS ((tree));
-static tree java_stabilize_reference PARAMS ((tree));
-static tree do_unary_numeric_promotion PARAMS ((tree));
-static char * operator_string PARAMS ((tree));
-static tree do_merge_string_cste PARAMS ((tree, const char *, int, int));
-static tree merge_string_cste PARAMS ((tree, tree, int));
-static tree java_refold PARAMS ((tree));
-static int java_decl_equiv PARAMS ((tree, tree));
-static int binop_compound_p PARAMS ((enum tree_code));
-static tree search_loop PARAMS ((tree));
-static int labeled_block_contains_loop_p PARAMS ((tree, tree));
-static int check_abstract_method_definitions PARAMS ((int, tree, tree));
-static void java_check_abstract_method_definitions PARAMS ((tree));
-static void java_debug_context_do PARAMS ((int));
-static void java_parser_context_push_initialized_field PARAMS ((void));
-static void java_parser_context_pop_initialized_field PARAMS ((void));
-static tree reorder_static_initialized PARAMS ((tree));
-static void java_parser_context_suspend PARAMS ((void));
-static void java_parser_context_resume PARAMS ((void));
-static int pop_current_osb PARAMS ((struct parser_ctxt *));
+static void parse_ctor_invocation_error (void);
+static tree parse_jdk1_1_error (const char *);
+static void complete_class_report_errors (jdep *);
+static int process_imports (void);
+static void read_import_dir (tree);
+static int find_in_imports_on_demand (tree, tree);
+static void find_in_imports (tree, tree);
+static void check_inner_class_access (tree, tree, tree);
+static int check_pkg_class_access (tree, tree, bool);
+static void register_package (tree);
+static tree resolve_package (tree, tree *, tree *);
+static tree resolve_class (tree, tree, tree, tree);
+static void declare_local_variables (int, tree, tree);
+static void dump_java_tree (enum tree_dump_index, tree);
+static void source_start_java_method (tree);
+static void source_end_java_method (void);
+static tree find_name_in_single_imports (tree);
+static void check_abstract_method_header (tree);
+static tree lookup_java_interface_method2 (tree, tree);
+static tree resolve_expression_name (tree, tree *);
+static tree maybe_create_class_interface_decl (tree, tree, tree, tree);
+static int check_class_interface_creation (int, int, tree, tree, tree, tree);
+static tree patch_method_invocation (tree, tree, tree, int, int *, tree *);
+static int breakdown_qualified (tree *, tree *, tree);
+static int in_same_package (tree, tree);
+static tree resolve_and_layout (tree, tree);
+static tree qualify_and_find (tree, tree, tree);
+static tree resolve_no_layout (tree, tree);
+static int invocation_mode (tree, int);
+static tree find_applicable_accessible_methods_list (int, tree, tree, tree);
+static void search_applicable_methods_list (int, tree, tree, tree, tree *, tree *);
+static tree find_most_specific_methods_list (tree);
+static int argument_types_convertible (tree, tree);
+static tree patch_invoke (tree, tree, tree);
+static int maybe_use_access_method (int, tree *, tree *);
+static tree lookup_method_invoke (int, tree, tree, tree, tree);
+static tree register_incomplete_type (int, tree, tree, tree);
+static tree check_inner_circular_reference (tree, tree);
+static tree check_circular_reference (tree);
+static tree obtain_incomplete_type (tree);
+static tree java_complete_lhs (tree);
+static tree java_complete_tree (tree);
+static tree maybe_generate_pre_expand_clinit (tree);
+static int analyze_clinit_body (tree, tree);
+static int maybe_yank_clinit (tree);
+static void start_complete_expand_method (tree);
+static void java_complete_expand_method (tree);
+static void java_expand_method_bodies (tree);
+static int  unresolved_type_p (tree, tree *);
+static void create_jdep_list (struct parser_ctxt *);
+static tree build_expr_block (tree, tree);
+static tree enter_block (void);
+static tree exit_block (void);
+static tree lookup_name_in_blocks (tree);
+static void maybe_absorb_scoping_blocks (void);
+static tree build_method_invocation (tree, tree);
+static tree build_new_invocation (tree, tree);
+static tree build_assignment (int, int, tree, tree);
+static tree build_binop (enum tree_code, int, tree, tree);
+static tree patch_assignment (tree, tree);
+static tree patch_binop (tree, tree, tree);
+static tree build_unaryop (int, int, tree);
+static tree build_incdec (int, int, tree, int);
+static tree patch_unaryop (tree, tree);
+static tree build_cast (int, tree, tree);
+static tree build_null_of_type (tree);
+static tree patch_cast (tree, tree);
+static int valid_ref_assignconv_cast_p (tree, tree, int);
+static int valid_builtin_assignconv_identity_widening_p (tree, tree);
+static int valid_cast_to_p (tree, tree);
+static int valid_method_invocation_conversion_p (tree, tree);
+static tree try_builtin_assignconv (tree, tree, tree);
+static tree try_reference_assignconv (tree, tree);
+static tree build_unresolved_array_type (tree);
+static int build_type_name_from_array_name (tree, tree *);
+static tree build_array_from_name (tree, tree, tree, tree *);
+static tree build_array_ref (int, tree, tree);
+static tree patch_array_ref (tree);
+static tree make_qualified_name (tree, tree, int);
+static tree merge_qualified_name (tree, tree);
+static tree make_qualified_primary (tree, tree, int);
+static int resolve_qualified_expression_name (tree, tree *, tree *, tree *);
+static void qualify_ambiguous_name (tree);
+static tree resolve_field_access (tree, tree *, tree *);
+static tree build_newarray_node (tree, tree, int);
+static tree patch_newarray (tree);
+static tree resolve_type_during_patch (tree);
+static tree build_this (int);
+static tree build_wfl_wrap (tree, int);
+static tree build_return (int, tree);
+static tree patch_return (tree);
+static tree maybe_access_field (tree, tree, tree);
+static int complete_function_arguments (tree);
+static int check_for_static_method_reference (tree, tree, tree, tree, tree);
+static int not_accessible_p (tree, tree, tree, int);
+static void check_deprecation (tree, tree);
+static int class_in_current_package (tree);
+static tree build_if_else_statement (int, tree, tree, tree);
+static tree patch_if_else_statement (tree);
+static tree add_stmt_to_compound (tree, tree, tree);
+static tree add_stmt_to_block (tree, tree, tree);
+static tree patch_exit_expr (tree);
+static tree build_labeled_block (int, tree);
+static tree finish_labeled_statement (tree, tree);
+static tree build_bc_statement (int, int, tree);
+static tree patch_bc_statement (tree);
+static tree patch_loop_statement (tree);
+static tree build_new_loop (tree);
+static tree build_loop_body (int, tree, int);
+static tree finish_loop_body (int, tree, tree, int);
+static tree build_debugable_stmt (int, tree);
+static tree finish_for_loop (int, tree, tree, tree);
+static tree patch_switch_statement (tree);
+static tree string_constant_concatenation (tree, tree);
+static tree build_string_concatenation (tree, tree);
+static tree patch_string_cst (tree);
+static tree patch_string (tree);
+static tree encapsulate_with_try_catch (int, tree, tree, tree);
+static tree build_assertion (int, tree, tree);
+static tree build_try_statement (int, tree, tree);
+static tree build_try_finally_statement (int, tree, tree);
+static tree patch_try_statement (tree);
+static tree patch_synchronized_statement (tree, tree);
+static tree patch_throw_statement (tree, tree);
+static void check_thrown_exceptions (int, tree);
+static int check_thrown_exceptions_do (tree);
+static void purge_unchecked_exceptions (tree);
+static bool ctors_unchecked_throws_clause_p (tree);
+static void check_throws_clauses (tree, tree, tree);
+static void finish_method_declaration (tree);
+static tree build_super_invocation (tree);
+static int verify_constructor_circularity (tree, tree);
+static char *constructor_circularity_msg (tree, tree);
+static tree build_this_super_qualified_invocation (int, tree, tree, int, int);
+static const char *get_printable_method_name (tree);
+static tree patch_conditional_expr (tree, tree, tree);
+static tree generate_finit (tree);
+static tree generate_instinit (tree);
+static tree build_instinit_invocation (tree);
+static void fix_constructors (tree);
+static tree build_alias_initializer_parameter_list (int, tree, tree, int *);
+static tree craft_constructor (tree, tree);
+static int verify_constructor_super (tree);
+static tree create_artificial_method (tree, int, tree, tree, tree);
+static void start_artificial_method_body (tree);
+static void end_artificial_method_body (tree);
+static int check_method_redefinition (tree, tree);
+static int check_method_types_complete (tree);
+static void java_check_regular_methods (tree);
+static void java_check_abstract_methods (tree);
+static void unreachable_stmt_error (tree);
+static tree find_expr_with_wfl (tree);
+static void missing_return_error (tree);
+static tree build_new_array_init (int, tree);
+static tree patch_new_array_init (tree, tree);
+static tree maybe_build_array_element_wfl (tree);
+static int array_constructor_check_entry (tree, tree);
+static const char *purify_type_name (const char *);
+static tree fold_constant_for_init (tree, tree);
+static tree strip_out_static_field_access_decl (tree);
+static jdeplist *reverse_jdep_list (struct parser_ctxt *);
+static void static_ref_err (tree, tree, tree);
+static void parser_add_interface (tree, tree, tree);
+static void add_superinterfaces (tree, tree);
+static tree jdep_resolve_class (jdep *);
+static int note_possible_classname (const char *, int);
+static void java_complete_expand_classes (void);
+static void java_complete_expand_class (tree);
+static void java_complete_expand_methods (tree);
+static tree cut_identifier_in_qualified (tree);
+static tree java_stabilize_reference (tree);
+static tree do_unary_numeric_promotion (tree);
+static char * operator_string (tree);
+static tree do_merge_string_cste (tree, const char *, int, int);
+static tree merge_string_cste (tree, tree, int);
+static tree java_refold (tree);
+static int java_decl_equiv (tree, tree);
+static int binop_compound_p (enum tree_code);
+static tree search_loop (tree);
+static int labeled_block_contains_loop_p (tree, tree);
+static int check_abstract_method_definitions (int, tree, tree);
+static void java_check_abstract_method_definitions (tree);
+static void java_debug_context_do (int);
+static void java_parser_context_push_initialized_field (void);
+static void java_parser_context_pop_initialized_field (void);
+static tree reorder_static_initialized (tree);
+static void java_parser_context_suspend (void);
+static void java_parser_context_resume (void);
+static int pop_current_osb (struct parser_ctxt *);
 
 /* JDK 1.1 work. FIXME */
 
-static tree maybe_make_nested_class_name PARAMS ((tree));
-static int make_nested_class_name PARAMS ((tree));
-static void set_nested_class_simple_name_value PARAMS ((tree, int));
-static void link_nested_class_to_enclosing PARAMS ((void));
-static tree resolve_inner_class PARAMS ((htab_t, tree, tree *, tree *, tree));
-static tree find_as_inner_class PARAMS ((tree, tree, tree));
-static tree find_as_inner_class_do PARAMS ((tree, tree));
-static int check_inner_class_redefinition PARAMS ((tree, tree));
-
-static tree build_thisn_assign PARAMS ((void));
-static tree build_current_thisn PARAMS ((tree));
-static tree build_access_to_thisn PARAMS ((tree, tree, int));
-static tree maybe_build_thisn_access_method PARAMS ((tree));
-
-static tree build_outer_field_access PARAMS ((tree, tree));
-static tree build_outer_field_access_methods PARAMS ((tree));
-static tree build_outer_field_access_expr PARAMS ((int, tree, tree,
-                                                 tree, tree));
-static tree build_outer_method_access_method PARAMS ((tree));
-static tree build_new_access_id PARAMS ((void));
-static tree build_outer_field_access_method PARAMS ((tree, tree, tree,
-                                                   tree, tree));
-
-static int outer_field_access_p PARAMS ((tree, tree));
-static int outer_field_expanded_access_p PARAMS ((tree, tree *,
-                                                tree *, tree *));
-static tree outer_field_access_fix PARAMS ((tree, tree, tree));
-static tree build_incomplete_class_ref PARAMS ((int, tree));
-static tree patch_incomplete_class_ref PARAMS ((tree));
-static tree create_anonymous_class PARAMS ((int, tree));
-static void patch_anonymous_class PARAMS ((tree, tree, tree));
-static void add_inner_class_fields PARAMS ((tree, tree));
-
-static tree build_dot_class_method PARAMS ((tree));
-static tree build_dot_class_method_invocation PARAMS ((tree));
-static void create_new_parser_context PARAMS ((int));
-static void mark_parser_ctxt PARAMS ((void *));
-static tree maybe_build_class_init_for_field PARAMS ((tree, tree));
-
-static int attach_init_test_initialization_flags PARAMS ((PTR *, PTR));
-static int emit_test_initialization PARAMS ((PTR *, PTR));
-
-static char *string_convert_int_cst PARAMS ((tree));
+static tree maybe_make_nested_class_name (tree);
+static int make_nested_class_name (tree);
+static void set_nested_class_simple_name_value (tree, int);
+static void link_nested_class_to_enclosing (void);
+static tree resolve_inner_class (htab_t, tree, tree *, tree *, tree);
+static tree find_as_inner_class (tree, tree, tree);
+static tree find_as_inner_class_do (tree, tree);
+static int check_inner_class_redefinition (tree, tree);
+
+static tree build_thisn_assign (void);
+static tree build_current_thisn (tree);
+static tree build_access_to_thisn (tree, tree, int);
+static tree maybe_build_thisn_access_method (tree);
+
+static tree build_outer_field_access (tree, tree);
+static tree build_outer_field_access_methods (tree);
+static tree build_outer_field_access_expr (int, tree, tree,
+                                                 tree, tree);
+static tree build_outer_method_access_method (tree);
+static tree build_new_access_id (void);
+static tree build_outer_field_access_method (tree, tree, tree,
+                                                   tree, tree);
+
+static int outer_field_access_p (tree, tree);
+static int outer_field_expanded_access_p (tree, tree *,
+                                                tree *, tree *);
+static tree outer_field_access_fix (tree, tree, tree);
+static tree build_incomplete_class_ref (int, tree);
+static tree patch_incomplete_class_ref (tree);
+static tree create_anonymous_class (int, tree);
+static void patch_anonymous_class (tree, tree, tree);
+static void add_inner_class_fields (tree, tree);
+
+static tree build_dot_class_method (tree);
+static tree build_dot_class_method_invocation (tree);
+static void create_new_parser_context (int);
+static tree maybe_build_class_init_for_field (tree, tree);
+
+static int attach_init_test_initialization_flags (PTR *, PTR);
+static int emit_test_initialization (PTR *, PTR);
+
+static char *string_convert_int_cst (tree);
 
 /* Number of error found so far. */
 int java_error_count;
@@ -605,18 +596,7 @@ static GTY(()) tree src_parse_roots[1];
 
 %%
 /* 19.2 Production from 2.3: The Syntactic Grammar  */
-goal:
-                {
-                 /* Register static variables with the garbage
-                    collector.  */
-                 ggc_add_root (&ctxp, 1,
-                               sizeof (struct parser_ctxt *),
-                               mark_parser_ctxt);
-                 ggc_add_root (&ctxp_for_generation, 1,
-                               sizeof (struct parser_ctxt *),
-                               mark_parser_ctxt);
-               }
-       compilation_unit
+goal:  compilation_unit
                {}
 ;
 
@@ -2680,7 +2660,7 @@ create_new_parser_context (copy_from_previous)
 {
   struct parser_ctxt *new;
 
-  new =  (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
+  new =  (struct parser_ctxt *) ggc_alloc (sizeof (struct parser_ctxt));
   if (copy_from_previous)
     {
       memcpy ((PTR)new, (PTR)ctxp, sizeof (struct parser_ctxt));
@@ -2741,8 +2721,6 @@ java_pop_parser_context (generate)
       toFree->next = ctxp_for_generation;
       ctxp_for_generation = toFree;
     }
-  else
-    free (toFree);
 }
 
 /* Create a parser context for the use of saving some global
@@ -2841,10 +2819,6 @@ java_parser_context_resume ()
   /* Re-installed the data for the parsing to carry on */
   memcpy (&ctxp->marker_begining, &old->marker_begining,
          (size_t)(&ctxp->marker_end - &ctxp->marker_begining));
-
-  /* Buffer context can now be discarded */
-  free (saver);
-  free (old);
 }
 
 /* Add a new anchor node to which all statement(s) initializing static
@@ -6743,10 +6717,9 @@ process_imports ()
       tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import));
       char *original_name;
 
-      obstack_grow0 (&temporary_obstack,
-                    IDENTIFIER_POINTER (to_be_found),
-                    IDENTIFIER_LENGTH (to_be_found));
-      original_name = obstack_finish (&temporary_obstack);
+      original_name = xmemdup (IDENTIFIER_POINTER (to_be_found),
+                              IDENTIFIER_LENGTH (to_be_found),
+                              IDENTIFIER_LENGTH (to_be_found) + 1);
 
       /* Don't load twice something already defined. */
       if (IDENTIFIER_CLASS_VALUE (to_be_found))
@@ -6782,7 +6755,7 @@ process_imports ()
          error_found = 1;
        }
 
-      obstack_free (&temporary_obstack, original_name);
+      free (original_name);
       if (error_found)
        return 1;
     }
@@ -16201,42 +16174,6 @@ resolve_qualified_name (name, context)
 }
 #endif
 
-/* Mark P, which is really a `struct parser_ctxt **' for GC.  */
-
-static void
-mark_parser_ctxt (p)
-     void *p;
-{
-  struct parser_ctxt *pc = *((struct parser_ctxt **) p);
-#ifndef JC1_LITE
-  size_t i;
-#endif
-
-  if (!pc)
-    return;
-
-#ifndef JC1_LITE
-  for (i = 0; i < ARRAY_SIZE (pc->modifier_ctx); ++i)
-    ggc_mark_tree (pc->modifier_ctx[i]);
-  ggc_mark_tree (pc->class_type);
-  ggc_mark_tree (pc->function_decl);
-  ggc_mark_tree (pc->package);
-  ggc_mark_tree (pc->class_list);
-  ggc_mark_tree (pc->current_parsed_class);
-  ggc_mark_tree (pc->current_parsed_class_un);
-  ggc_mark_tree (pc->non_static_initialized);
-  ggc_mark_tree (pc->static_initialized);
-  ggc_mark_tree (pc->instance_initializers);
-  ggc_mark_tree (pc->import_list);
-  ggc_mark_tree (pc->import_demand_list);
-  ggc_mark_tree (pc->current_loop);
-  ggc_mark_tree (pc->current_labeled_block);
-#endif /* JC1_LITE */
-
-  if (pc->next)
-    mark_parser_ctxt (&pc->next);
-}
-
 void
 init_src_parse ()
 {