This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Remove TYPE_HAS_NONPUBLIC_CTOR
- To: gcc-patches at gcc dot gnu dot org
- Subject: C++ PATCH: Remove TYPE_HAS_NONPUBLIC_CTOR
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 11 Apr 2000 00:47:12 -0700
- Organization: CodeSourcery, LLC
Neither TYPE_HAS_NONPUBLIC_CTOR nor TYPE_HAS_NONPUBLIC_ASSIGN_REF were
being used.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2000-04-11 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (lang_type): Remove has_nonpublic_ctor and
has_nonpublic_assign_ref.
(TYPE_HAS_NONPUBLIC_CTOR): Don't declare.
(TYPE_HAS_NONPUBLIC_ASSIGN_REF): Likewise.
* class.c (finish_struct_methods): Don't set
TYPE_HAS_NONPUBLIC_CTOR or TYPE_HAS_NONPUBLIC_ASSIGN_REF.
(interface_only): Don't declare.
(interface_unknown): Likewise.
Index: class.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/class.c,v
retrieving revision 1.286
diff -c -p -r1.286 class.c
*** class.c 2000/04/09 06:44:18 1.286
--- class.c 2000/04/11 07:19:46
*************** method_name_cmp (m1, m2)
*** 2122,2143 ****
list. That allows them to be quickly deleted, and requires no
extra storage.
! If there are any constructors/destructors, they are moved to the
! front of the list. This makes pushclass more efficient.
- @@ The above comment is obsolete. It mostly describes what add_method
- @@ and add_implicitly_declared_members do.
-
- Sort methods that are not special (i.e., constructors, destructors, and
- type conversion operators) so that we can find them faster in search. */
-
static void
finish_struct_methods (t)
tree t;
{
tree fn_fields;
tree method_vec;
- tree ctor_name = constructor_name (t);
int slot, len;
if (!TYPE_METHODS (t))
--- 2124,2139 ----
list. That allows them to be quickly deleted, and requires no
extra storage.
! Sort methods that are not special (i.e., constructors, destructors,
! and type conversion operators) so that we can find them faster in
! search. */
static void
finish_struct_methods (t)
tree t;
{
tree fn_fields;
tree method_vec;
int slot, len;
if (!TYPE_METHODS (t))
*************** finish_struct_methods (t)
*** 2158,2207 ****
and the next few with type conversion operators (if any). */
for (fn_fields = TYPE_METHODS (t); fn_fields;
fn_fields = TREE_CHAIN (fn_fields))
! {
! tree fn_name = DECL_NAME (fn_fields);
!
! /* Clear out this flag.
!
! @@ Doug may figure out how to break
! @@ this with nested classes and friends. */
! DECL_IN_AGGR_P (fn_fields) = 0;
!
! /* Note here that a copy ctor is private, so we don't dare generate
! a default copy constructor for a class that has a member
! of this type without making sure they have access to it. */
! if (fn_name == ctor_name)
! {
! tree parmtypes = FUNCTION_ARG_CHAIN (fn_fields);
! tree parmtype = parmtypes ? TREE_VALUE (parmtypes) : void_type_node;
!
! if (TREE_CODE (parmtype) == REFERENCE_TYPE
! && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == t)
! {
! if (TREE_CHAIN (parmtypes) == NULL_TREE
! || TREE_CHAIN (parmtypes) == void_list_node
! || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
! {
! if (TREE_PROTECTED (fn_fields))
! TYPE_HAS_NONPUBLIC_CTOR (t) = 1;
! else if (TREE_PRIVATE (fn_fields))
! TYPE_HAS_NONPUBLIC_CTOR (t) = 2;
! }
! }
! }
! else if (fn_name == ansi_opname[(int) MODIFY_EXPR])
! {
! tree parmtype = TREE_VALUE (FUNCTION_ARG_CHAIN (fn_fields));
!
! if (copy_assignment_arg_p (parmtype, DECL_VIRTUAL_P (fn_fields)))
! {
! if (TREE_PROTECTED (fn_fields))
! TYPE_HAS_NONPUBLIC_ASSIGN_REF (t) = 1;
! else if (TREE_PRIVATE (fn_fields))
! TYPE_HAS_NONPUBLIC_ASSIGN_REF (t) = 2;
! }
! }
! }
if (TYPE_HAS_DESTRUCTOR (t) && !TREE_VEC_ELT (method_vec, 1))
/* We thought there was a destructor, but there wasn't. Some
--- 2154,2161 ----
and the next few with type conversion operators (if any). */
for (fn_fields = TYPE_METHODS (t); fn_fields;
fn_fields = TREE_CHAIN (fn_fields))
! /* Clear out this flag. */
! DECL_IN_AGGR_P (fn_fields) = 0;
if (TYPE_HAS_DESTRUCTOR (t) && !TREE_VEC_ELT (method_vec, 1))
/* We thought there was a destructor, but there wasn't. Some
*************** finish_struct_anon (t)
*** 2922,2929 ****
}
}
- extern int interface_only, interface_unknown;
-
/* Create default constructors, assignment operators, and so forth for
the type indicated by T, if they are needed.
CANT_HAVE_DEFAULT_CTOR, CANT_HAVE_CONST_CTOR, and
--- 2876,2881 ----
Index: cp-tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.435
diff -c -p -r1.435 cp-tree.h
*** cp-tree.h 2000/04/09 06:44:18 1.435
--- cp-tree.h 2000/04/11 07:19:49
*************** struct lang_type
*** 1331,1338 ****
unsigned has_const_assign_ref : 1;
unsigned anon_aggr : 1;
! unsigned has_nonpublic_ctor : 2;
! unsigned has_nonpublic_assign_ref : 2;
unsigned vtable_needs_writing : 1;
unsigned has_assign_ref : 1;
unsigned has_new : 1;
--- 1336,1345 ----
unsigned has_const_assign_ref : 1;
unsigned anon_aggr : 1;
! unsigned has_mutable : 1;
! unsigned com_interface : 1;
! unsigned non_pod_class : 1;
! unsigned nearly_empty_p : 1;
unsigned vtable_needs_writing : 1;
unsigned has_assign_ref : 1;
unsigned has_new : 1;
*************** struct lang_type
*** 1365,1384 ****
unsigned has_abstract_assign_ref : 1;
unsigned non_aggregate : 1;
unsigned is_partial_instantiation : 1;
- unsigned has_mutable : 1;
-
- unsigned com_interface : 1;
- unsigned non_pod_class : 1;
- unsigned nearly_empty_p : 1;
/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
so, make sure to copy it in instantiate_class_template! */
! /* There are six bits left to fill out a 32-bit word. Keep track of
! this by updating the size of this bitfield whenever you add or
remove a flag. */
! unsigned dummy : 5;
int vsize;
int vfield_parent;
--- 1372,1386 ----
unsigned has_abstract_assign_ref : 1;
unsigned non_aggregate : 1;
unsigned is_partial_instantiation : 1;
/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
so, make sure to copy it in instantiate_class_template! */
! /* There are some bits left to fill out a 32-bit word. Keep track
! of this by updating the size of this bitfield whenever you add or
remove a flag. */
! unsigned dummy : 9;
int vsize;
int vfield_parent;
*************** struct lang_type
*** 1642,1655 ****
/* Nonzero means that this type has an X() constructor. */
#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_default_ctor)
- /* Nonzero means the type declared a ctor as private or protected. We
- use this to make sure we don't try to generate a copy ctor for a
- class that has a member of type NODE. */
- #define TYPE_HAS_NONPUBLIC_CTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_nonpublic_ctor)
-
- /* Ditto, for operator=. */
- #define TYPE_HAS_NONPUBLIC_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_nonpublic_assign_ref)
-
/* Nonzero means that this type contains a mutable member */
#define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_mutable)
#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
--- 1656,1661 ----