Commit 58731fd1 by Mark Mitchell Committed by Mark Mitchell

class.c (check_field_decls): Remove empty_p parameter.

	* class.c (check_field_decls): Remove empty_p parameter.  Instead,
	clear CLASSTYPE_EMPTY_P.
	(build_base_field): Likewise.
	(build_base_fields): Likewise.
	(check_bases_and_members): Likewise.
	(create_vtbl_ptr): Likewise.
	(layout_class_type): Likewise.  Ensure that empty classes have
	size zero when used as base classes in the 3.2 ABI.
	(finish_struct_1): Initialize CLASSTYPE_EMPTY_P and
	CLASSTYPE_NEARLY_EMPTY_P.  Adjust calls to avoid passing empty_p
	parameter.
	(is_empty_class): Correct definition when using post-3.2 ABI.
	* cp-tree.h (lang_type_class): Add empty_p.
	(CLASSTYPE_EMPTY_P): New macro.

From-SVN: r58170
parent a2ee89d8
2002-10-14 Mark Mitchell <mark@codesourcery.com>
* class.c (check_field_decls): Remove empty_p parameter. Instead,
clear CLASSTYPE_EMPTY_P.
(build_base_field): Likewise.
(build_base_fields): Likewise.
(check_bases_and_members): Likewise.
(create_vtbl_ptr): Likewise.
(layout_class_type): Likewise. Ensure that empty classes have
size zero when used as base classes in the 3.2 ABI.
(finish_struct_1): Initialize CLASSTYPE_EMPTY_P and
CLASSTYPE_NEARLY_EMPTY_P. Adjust calls to avoid passing empty_p
parameter.
(is_empty_class): Correct definition when using post-3.2 ABI.
* cp-tree.h (lang_type_class): Add empty_p.
(CLASSTYPE_EMPTY_P): New macro.
2002-10-12 Nathan Sidwell <nathan@codesourcery.com>
* init.c (build_delete): Do not apply save_expr for arrays.
......
......@@ -1134,6 +1134,7 @@ struct lang_type_class GTY(())
unsigned anon_aggr : 1;
unsigned non_zero_init : 1;
unsigned 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
......@@ -1142,7 +1143,7 @@ struct lang_type_class GTY(())
/* 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 : 6;
unsigned dummy : 5;
int vsize;
......@@ -1447,6 +1448,10 @@ struct lang_type GTY(())
#define CLASSTYPE_NON_ZERO_INIT_P(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init)
/* Nonzero if this class is "empty" in the sense of the C++ ABI. */
#define CLASSTYPE_EMPTY_P(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->empty_p)
/* Nonzero if this class is "nearly empty", i.e., contains only a
virtual function table pointer. */
#define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
......
2002-10-14 Mark Mitchell <mark@codesourcery.com>
* g++.dg/abi/empty8.C: New test.
2002-10-15 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/init/ctor1.C: New test.
......
// { dg-do run }
// { dg-options "-fabi-version=0" }
struct E1 {};
struct E2 : public E1 {};
struct S1 { int i; };
struct S2 : public S1, E2 {};
S2 s2;
int main () {
if ((char *)(E2*) &s2 != (char *)&s2)
return 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment