This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: gcj PR 305
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Subject: Patch: gcj PR 305
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 20 Aug 2000 10:34:40 -0600
- Reply-To: tromey at cygnus dot com
I'm checking this in with Alex's approval.
2000-08-09 Tom Tromey <tromey@cygnus.com>
* parse.y (check_abstract_method_definitions): Now return `int'.
Check implemented interfaces. Fixes PR gcj/305.
Tom
Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.200
diff -u -r1.200 parse.y
--- parse.y 2000/08/11 22:01:37 1.200
+++ parse.y 2000/08/20 16:17:57
@@ -276,7 +276,7 @@
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 void check_abstract_method_definitions PARAMS ((int, 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));
@@ -5825,13 +5825,15 @@
return 0;
}
-static void
+/* Return 1 if check went ok, 0 otherwise. */
+static int
check_abstract_method_definitions (do_interface, class_decl, type)
int do_interface;
tree class_decl, type;
{
tree class = TREE_TYPE (class_decl);
tree method, end_type;
+ int ok = 1;
end_type = (do_interface ? object_type_node : type);
for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method))
@@ -5904,13 +5906,27 @@
IDENTIFIER_POINTER (ccn),
(CLASS_INTERFACE (class_decl) ? "interface" : "class"),
IDENTIFIER_POINTER (DECL_NAME (class_decl)));
-
+ ok = 0;
free (t);
-
+
if (saved_wfl)
DECL_NAME (method) = saved_wfl;
}
}
+
+ if (ok && do_interface)
+ {
+ /* Check for implemented interfaces. */
+ int i;
+ tree vector = TYPE_BINFO_BASETYPES (type);
+ for (i = 1; ok && vector && i < TREE_VEC_LENGTH (vector); i++)
+ {
+ tree super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
+ ok = check_abstract_method_definitions (1, class_decl, super);
+ }
+ }
+
+ return ok;
}
/* Check that CLASS_DECL somehow implements all inherited abstract