diff options
author | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-09-16 09:53:40 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-09-16 09:53:40 +0000 |
commit | 585b44d301a56eb7c2e40e840c6c9868f6b92d46 (patch) | |
tree | 05f087296df6da2876dbac64a95198a03423740d /gcc/cp/typeck2.c | |
parent | 45f1796923b1b10a3bb13e79f4905cd7763d969a (diff) | |
download | gcc-585b44d301a56eb7c2e40e840c6c9868f6b92d46.zip gcc-585b44d301a56eb7c2e40e840c6c9868f6b92d46.tar.gz gcc-585b44d301a56eb7c2e40e840c6c9868f6b92d46.tar.bz2 |
cp-tree.h (struct lang_type_class): Make pure_virtuals a VEC(tree).
* cp-tree.h (struct lang_type_class): Make pure_virtuals a
VEC(tree).
(CLASSTYPE_INLINE_FRIENDS, CLASSTYPE_PURE_VIRTUALS): Update
comments.
* call.c (build_new_method_call): Don't confirm a pure virtual is
in CLASSTYPE_PURE_VIRTUALS. Reorder checks. Make it a warning.
* class.c (check_methods): CLASSTYPE_INLINE_FRIENDS is a VEC(tree).
(fixup_inline_methods, finish_struct): Likewise.
* decl.c (finish_method): Likewise.
* search.c (dfs_get_pure_virtuals, get_pure_virtuals):
CLASSTYPE_PURE_VIRTUALS is a VEC(tree).
* typeck2.c (abstract_virtuals_error): Likewise. Truncate the
vector to avoid repeating the list in error messages.
From-SVN: r87592
Diffstat (limited to 'gcc/cp/typeck2.c')
-rw-r--r-- | gcc/cp/typeck2.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 548d089..44f6483 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -235,9 +235,8 @@ complete_type_check_abstract (tree type) int abstract_virtuals_error (tree decl, tree type) { - tree u; - tree tu; - + VEC (tree) *pure; + /* This function applies only to classes. Any other entity can never be abstract. */ if (!CLASS_TYPE_P (type)) @@ -275,15 +274,15 @@ abstract_virtuals_error (tree decl, tree type) return 0; } - if (!CLASSTYPE_PURE_VIRTUALS (type)) - return 0; - if (!TYPE_SIZE (type)) /* TYPE is being defined, and during that time CLASSTYPE_PURE_VIRTUALS holds the inline friends. */ return 0; - u = CLASSTYPE_PURE_VIRTUALS (type); + pure = CLASSTYPE_PURE_VIRTUALS (type); + if (!pure) + return 0; + if (decl) { if (TREE_CODE (decl) == RESULT_DECL) @@ -316,15 +315,20 @@ abstract_virtuals_error (tree decl, tree type) error ("cannot allocate an object of abstract type `%T'", type); /* Only go through this once. */ - if (TREE_PURPOSE (u) == NULL_TREE) + if (VEC_length (tree, pure)) { - TREE_PURPOSE (u) = error_mark_node; - + unsigned ix; + tree fn; + inform ("%J because the following virtual functions are pure " "within `%T':", TYPE_MAIN_DECL (type), type); - for (tu = u; tu; tu = TREE_CHAIN (tu)) - inform ("%J\t%#D", TREE_VALUE (tu), TREE_VALUE (tu)); + for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++) + inform ("%J\t%#D", fn, fn); + /* Now truncate the vector. This leaves it non-null, so we know + there are pure virtuals, but empty so we don't list them out + again. */ + VEC_truncate (tree, pure, 0); } else inform ("%J since type `%T' has pure virtual functions", |