aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog29
-rw-r--r--gcc/cp/call.c4
-rw-r--r--gcc/cp/class.c36
-rw-r--r--gcc/cp/cp-tree.h14
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/cp/decl2.c6
-rw-r--r--gcc/cp/search.c15
-rw-r--r--gcc/cp/typeck2.c4
-rw-r--r--gcc/cp/xref.c2
9 files changed, 71 insertions, 45 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ef4f421..91c343a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,32 @@
+1999-12-28 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_type): Replace abstract_virtuals with pure_virtuals.
+ (CLASSTYPE_ABSTRACT_VIRTUALS): Rename to ...
+ (CLASSTYPE_PURE_VIRTUALS): ... this.
+ (lang_decl_flags): Replace abstract_virtual with pure_virtual.
+ (DECL_ABSTRACT_VIRTUAL_P): Rename to ...
+ (DECL_PURE_VIRTUAL_P): ... this.
+ (get_abstract_virtuals): Rename to ...
+ (get_pure_virtuals): ... this.
+ * call.c (build_new_method_call): Replace DECL_PURE_VIRTUAL_P with
+ DECL_ABSTRACT_VIRTUAL_P. Replace CLASSTYPE_ABSTRACT_VIRTUALS with
+ CLASSTYPE_PURE_VIRTUALS.
+ * class.c (build_vtable_entry): Likewise.
+ (finish_struct_bits): Likewise. Call get_pure_virtuals, not
+ get_abstract_virtuals.
+ (build_vtbl_initializer): Likewise.
+ (override_one_vtable): Likewise.
+ (check_methods): Likewise.
+ * decl.c (duplicate_decls): Likewise.
+ (redeclaration_error_message): Likewise.
+ (lang_mark_tree): Likewise.
+ * decl2.c (grok_function_init): Likewise.
+ (import_export_vtable): Likewise.
+ (import_expor_class): Likewise.
+ * typeck2.c (abstract_virtuals_error): Likewise.
+ * xref.c (GNU_xref_member): Likewise.
+ * search.c (get_abstract_virtuals): Rename to get_pure_virtuals.
+
1999-12-26 Zack Weinberg <zack@wolery.cumb.org>
* cp-tree.h: Replace ENABLE_CHECKING with ENABLE_TREE_CHECKING
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index cfc6fd5..fd5cfee 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4319,11 +4319,11 @@ build_new_method_call (instance, name, args, basetype_path, flags)
return error_mark_node;
}
- if (DECL_ABSTRACT_VIRTUAL_P (cand->fn)
+ if (DECL_PURE_VIRTUAL_P (cand->fn)
&& instance == current_class_ref
&& DECL_CONSTRUCTOR_P (current_function_decl)
&& ! (flags & LOOKUP_NONVIRTUAL)
- && value_member (cand->fn, CLASSTYPE_ABSTRACT_VIRTUALS (basetype)))
+ && value_member (cand->fn, CLASSTYPE_PURE_VIRTUALS (basetype)))
cp_error ("abstract virtual `%#D' called from constructor", cand->fn);
if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
&& is_dummy_object (instance_ptr))
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 14c67af..628e556 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -389,7 +389,7 @@ build_vtable_entry (delta, pfn)
if (flag_vtable_thunks)
{
HOST_WIDE_INT idelta = TREE_INT_CST_LOW (delta);
- if (idelta && ! DECL_ABSTRACT_VIRTUAL_P (TREE_OPERAND (pfn, 0)))
+ if (idelta && ! DECL_PURE_VIRTUAL_P (TREE_OPERAND (pfn, 0)))
{
pfn = build1 (ADDR_EXPR, vtable_entry_type,
make_thunk (pfn, idelta));
@@ -1786,17 +1786,15 @@ finish_struct_bits (t, max_has_virtual)
}
if (n_baseclasses && max_has_virtual)
- {
- /* For a class w/o baseclasses, `finish_struct' has set
- CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by definition). Similarly
- for a class who's base classes do not have vtables. When neither
- of these is true, we might have removed abstract virtuals (by
- providing a definition), added some (by declaring new ones), or
- redeclared ones from a base class. We need to recalculate what's
- really an abstract virtual at this point (by looking in the
- vtables). */
- CLASSTYPE_ABSTRACT_VIRTUALS (t) = get_abstract_virtuals (t);
- }
+ /* For a class w/o baseclasses, `finish_struct' has set
+ CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by
+ definition). Similarly for a class whose base classes do not
+ have vtables. When neither of these is true, we might have
+ removed abstract virtuals (by providing a definition), added
+ some (by declaring new ones), or redeclared ones from a base
+ class. We need to recalculate what's really an abstract virtual
+ at this point (by looking in the vtables). */
+ get_pure_virtuals (t);
if (n_baseclasses)
{
@@ -2251,7 +2249,7 @@ build_vtbl_initializer (binfo)
/* You can't call an abstract virtual function; it's abstract.
So, we replace these functions with __pure_virtual. */
- if (DECL_ABSTRACT_VIRTUAL_P (fn))
+ if (DECL_PURE_VIRTUAL_P (fn))
fn = abort_fndecl;
/* Package up that information for the vtable. */
@@ -2806,8 +2804,8 @@ override_one_vtable (binfo, old, t)
copy_lang_decl (fndecl);
DECL_NEEDS_FINAL_OVERRIDER_P (fndecl) = 1;
/* Make sure we search for it later. */
- if (! CLASSTYPE_ABSTRACT_VIRTUALS (t))
- CLASSTYPE_ABSTRACT_VIRTUALS (t) = error_mark_node;
+ if (! CLASSTYPE_PURE_VIRTUALS (t))
+ CLASSTYPE_PURE_VIRTUALS (t) = error_mark_node;
/* We can use integer_zero_node, as we will core dump
if this is used anyway. */
@@ -3922,7 +3920,7 @@ check_methods (t)
DECL_FIELD_SIZE (x) = 0;
check_for_override (x, t);
- if (DECL_ABSTRACT_VIRTUAL_P (x) && ! DECL_VINDEX (x))
+ if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
cp_error_at ("initializer specified for non-virtual method `%D'", x);
/* The name of the field is the original field name
@@ -3930,9 +3928,9 @@ check_methods (t)
if (DECL_VINDEX (x))
{
TYPE_POLYMORPHIC_P (t) = 1;
- if (DECL_ABSTRACT_VIRTUAL_P (x))
- CLASSTYPE_ABSTRACT_VIRTUALS (t)
- = tree_cons (NULL_TREE, x, CLASSTYPE_ABSTRACT_VIRTUALS (t));
+ if (DECL_PURE_VIRTUAL_P (x))
+ CLASSTYPE_PURE_VIRTUALS (t)
+ = tree_cons (NULL_TREE, x, CLASSTYPE_PURE_VIRTUALS (t));
}
}
}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 5a3fa66..f572916 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1240,7 +1240,7 @@ struct lang_type
union tree_node *size;
- union tree_node *abstract_virtuals;
+ union tree_node *pure_virtuals;
union tree_node *friend_classes;
union tree_node *rtti;
@@ -1428,7 +1428,7 @@ struct lang_type
/* A cons list of virtual functions which cannot be inherited by
derived classes. When deriving from this type, the derived
class must provide its own definition for each of these functions. */
-#define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
+#define CLASSTYPE_PURE_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->pure_virtuals)
/* Nonzero means that this aggr type has been `closed' by a semicolon. */
#define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->got_semicolon)
@@ -1612,7 +1612,7 @@ struct lang_decl_flags
unsigned static_function : 1;
unsigned const_memfunc : 1;
unsigned volatile_memfunc : 1;
- unsigned abstract_virtual : 1;
+ unsigned pure_virtual : 1;
unsigned constructor_for_vbase_attr : 1;
unsigned mutable_flag : 1;
@@ -1780,9 +1780,9 @@ struct lang_decl
constructor. */
#define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting)
-/* Nonzero for FUNCTION_DECL means that this member function
- exists as part of an abstract class's interface. */
-#define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
+/* Nonzero for FUNCTION_DECL means that this member function is a pure
+ virtual function. */
+#define DECL_PURE_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.pure_virtual)
/* Nonzero for FUNCTION_DECL means that this member function
must be overridden by derived classes. */
@@ -3868,7 +3868,7 @@ extern tree lookup_fnfields PROTO((tree, tree, int));
extern tree lookup_member PROTO((tree, tree, int, int));
extern tree lookup_nested_tag PROTO((tree, tree));
extern tree get_matching_virtual PROTO((tree, tree, int));
-extern tree get_abstract_virtuals PROTO((tree));
+extern void get_pure_virtuals PROTO((tree));
extern tree init_vbase_pointers PROTO((tree, tree));
extern void expand_indirect_vtbls_init PROTO((tree, tree, tree));
extern void clear_search_slots PROTO((tree));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f8c473f..51d2d9e 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3247,7 +3247,7 @@ duplicate_decls (newdecl, olddecl)
DECL_PENDING_INLINE_INFO (newdecl) = DECL_PENDING_INLINE_INFO (olddecl);
DECL_STATIC_CONSTRUCTOR (newdecl) |= DECL_STATIC_CONSTRUCTOR (olddecl);
DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
- DECL_ABSTRACT_VIRTUAL_P (newdecl) |= DECL_ABSTRACT_VIRTUAL_P (olddecl);
+ DECL_PURE_VIRTUAL_P (newdecl) |= DECL_PURE_VIRTUAL_P (olddecl);
DECL_VIRTUAL_P (newdecl) |= DECL_VIRTUAL_P (olddecl);
DECL_NEEDS_FINAL_OVERRIDER_P (newdecl) |= DECL_NEEDS_FINAL_OVERRIDER_P (olddecl);
DECL_THIS_STATIC (newdecl) |= DECL_THIS_STATIC (olddecl);
@@ -4523,7 +4523,7 @@ redeclaration_error_message (newdecl, olddecl)
/* If this is a pure function, its olddecl will actually be
the original initialization to `0' (which we force to call
abort()). Don't complain about redefinition in this case. */
- if (DECL_LANG_SPECIFIC (olddecl) && DECL_ABSTRACT_VIRTUAL_P (olddecl))
+ if (DECL_LANG_SPECIFIC (olddecl) && DECL_PURE_VIRTUAL_P (olddecl))
return 0;
/* If both functions come from different namespaces, this is not
@@ -14519,7 +14519,7 @@ lang_mark_tree (t)
ggc_mark_tree (lt->tags);
ggc_mark_tree (lt->search_slot);
ggc_mark_tree (lt->size);
- ggc_mark_tree (lt->abstract_virtuals);
+ ggc_mark_tree (lt->pure_virtuals);
ggc_mark_tree (lt->friend_classes);
ggc_mark_tree (lt->rtti);
ggc_mark_tree (lt->methods);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 58cbf3c..3633c12 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1880,7 +1880,7 @@ grok_function_init (decl, init)
DECL_RTL (decl) = DECL_RTL (abort_fndecl);
}
#endif
- DECL_ABSTRACT_VIRTUAL_P (decl) = 1;
+ DECL_PURE_VIRTUAL_P (decl) = 1;
if (DECL_NAME (decl) == ansi_opname [(int) MODIFY_EXPR])
{
tree parmtype
@@ -2420,7 +2420,7 @@ import_export_vtable (decl, type, final)
method = TREE_CHAIN (method))
if (DECL_VINDEX (method) != NULL_TREE
&& ! DECL_THIS_INLINE (method)
- && ! DECL_ABSTRACT_VIRTUAL_P (method))
+ && ! DECL_PURE_VIRTUAL_P (method))
{
found = 1;
break;
@@ -2489,7 +2489,7 @@ import_export_class (ctype)
{
if (DECL_VINDEX (method) != NULL_TREE
&& !DECL_THIS_INLINE (method)
- && !DECL_ABSTRACT_VIRTUAL_P (method))
+ && !DECL_PURE_VIRTUAL_P (method))
{
import_export = (DECL_REALLY_EXTERN (method) ? -1 : 1);
break;
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 8ee63f1..ba414de 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -2138,7 +2138,7 @@ get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals)
while (virtuals)
{
tree base_fndecl = TREE_VALUE (virtuals);
- if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl))
+ if (DECL_PURE_VIRTUAL_P (base_fndecl))
abstract_virtuals = tree_cons (NULL_TREE, base_fndecl,
abstract_virtuals);
virtuals = TREE_CHAIN (virtuals);
@@ -2147,12 +2147,10 @@ get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals)
return abstract_virtuals;
}
-/* Return the list of virtual functions which are abstract in type TYPE.
- This information is cached, and so must be built on a
- non-temporary obstack. */
+/* Set CLASSTYPE_PURE_VIRTUALS for TYPE. */
-tree
-get_abstract_virtuals (type)
+void
+get_pure_virtuals (type)
tree type;
{
tree vbases;
@@ -2173,13 +2171,14 @@ get_abstract_virtuals (type)
tree base_fndecl = TREE_VALUE (virtuals);
if (DECL_NEEDS_FINAL_OVERRIDER_P (base_fndecl))
cp_error ("`%#D' needs a final overrider", base_fndecl);
- else if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl))
+ else if (DECL_PURE_VIRTUAL_P (base_fndecl))
abstract_virtuals = tree_cons (NULL_TREE, base_fndecl,
abstract_virtuals);
virtuals = TREE_CHAIN (virtuals);
}
}
- return nreverse (abstract_virtuals);
+
+ CLASSTYPE_PURE_VIRTUALS (type) = nreverse (abstract_virtuals);
}
static tree
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 182b3d7..bda3c07 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -136,10 +136,10 @@ abstract_virtuals_error (decl, type)
tree u;
tree tu;
- if (!CLASS_TYPE_P (type) || !CLASSTYPE_ABSTRACT_VIRTUALS (type))
+ if (!CLASS_TYPE_P (type) || !CLASSTYPE_PURE_VIRTUALS (type))
return 0;
- u = CLASSTYPE_ABSTRACT_VIRTUALS (type);
+ u = CLASSTYPE_PURE_VIRTUALS (type);
if (decl)
{
if (TREE_CODE (decl) == RESULT_DECL)
diff --git a/gcc/cp/xref.c b/gcc/cp/xref.c
index 5c6e7b7..94b757b 100644
--- a/gcc/cp/xref.c
+++ b/gcc/cp/xref.c
@@ -608,7 +608,7 @@ GNU_xref_member(cls, fld)
confg = 1;
pure = 0;
- if (TREE_CODE (fld) == FUNCTION_DECL && DECL_ABSTRACT_VIRTUAL_P(fld))
+ if (TREE_CODE (fld) == FUNCTION_DECL && DECL_PURE_VIRTUAL_P(fld))
pure = 1;
d = IDENTIFIER_POINTER(cls);