aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>2000-08-20 16:28:48 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-08-20 16:28:48 +0000
commit1175b9b4c50acab6a26f3fa5ce7299cae62b5008 (patch)
treeb5f84c7d7c18140c7a7604d06583ba8c48bab26b /gcc/java
parent2e0f0affd69c15612e111d39135dd4fb7520b5df (diff)
downloadgcc-1175b9b4c50acab6a26f3fa5ce7299cae62b5008.zip
gcc-1175b9b4c50acab6a26f3fa5ce7299cae62b5008.tar.gz
gcc-1175b9b4c50acab6a26f3fa5ce7299cae62b5008.tar.bz2
re GNATS gcj/305 (Interface methods implementations not always checked)
* parse.y (check_abstract_method_definitions): Now return `int'. Check implemented interfaces. Fixes PR gcj/305. From-SVN: r35820
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog3
-rw-r--r--gcc/java/parse.y24
2 files changed, 23 insertions, 4 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 805b4b9..902a6d5 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,5 +1,8 @@
2000-08-09 Tom Tromey <tromey@cygnus.com>
+ * parse.y (check_abstract_method_definitions): Now return `int'.
+ Check implemented interfaces. Fixes PR gcj/305.
+
* parse.y (patch_switch_statement): Disallow `long' in switch
expressions. Fixes PR gcj/310.
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 514ecbb..ae60ebe 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -276,7 +276,7 @@ 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 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 @@ check_method_redefinition (class, method)
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 @@ check_abstract_method_definitions (do_interface, class_decl, type)
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