diff options
author | Mark Mitchell <mark@codesourcery.com> | 2002-09-30 16:52:19 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2002-09-30 16:52:19 +0000 |
commit | 17bbb839f1270db8e2f99a8f173f38188ad176f3 (patch) | |
tree | ca1fbe15f3c944722c4671ad1534fc2a6abdb753 /gcc/cp/cp-tree.h | |
parent | acc59b855d7e95215412c2c86a6865595245be36 (diff) | |
download | gcc-17bbb839f1270db8e2f99a8f173f38188ad176f3.zip gcc-17bbb839f1270db8e2f99a8f173f38188ad176f3.tar.gz gcc-17bbb839f1270db8e2f99a8f173f38188ad176f3.tar.bz2 |
store-layout.c (finish_record_layout): Add free_p parameter.
* store-layout.c (finish_record_layout): Add free_p parameter.
(layout_type): Pass it.
* tree.h (finish_record_layout): Update prototype.
* class.c (walk_subobject_offsets): Correct the calculation of
offsets for virtual bases. Correct the counting of array
elements.
(layout_nonempty_base_or_field): Simplify. Correct the
calculation of offsets to be propagated through the binfo
hierarchy.
(build_base_field): Avoid creating a FIELD_DECL for empty bases.
Add the FIELD_DECL to TYPE_FIELDS.
(build_base_fields): Adjust accordingly.
(layout_virtual_bases): Use build_base_field.
(end_of_class): Return a tree, not an integer.
(warn_about_ambiguous_direct_bases): Rename to ...
(warn_about_ambiguous_bases): ... this.
(include_empty_classes): New function.
(layout_class_type): Create an alternative version of the type to
be used when as a base class type. Do not call
finish_record_layout until we are done laying out the class.
* cp-tree.h (lang_type_class): Remove size, size_unit. Add
as_base.
(CLASSTYPE_SIZE): Reimplement.
(CLASSTYPE_SIZE_UNIT): Likewise.
(CLASSTYPE_ALIGN): Likweise.
(CLASSTYPE_USER_ALIGN): Likewise.
(CLASSTYPE_AS_BASE): New macro.
(DECL_INITIALIZED_P): Likewise.
(extract_init): Remove prototype.
(build_forced_zero_init): Rename to ...
(build_zero_init): ... this.
(force_store_init_value): Remove.
* decl.c (obscure_complex_init): Remove.
(duplicate_decls): Copy DECL_INITIALIZED_P.
(check_initializer): Do not leave junk in DECL_INITIAL.
(cp_finish_decl): Handle zero-initialization of entities with
static storage duration.
* expr.c (extract_init): Remove.
* init.c (build_forced_zero_init): Remove.
(build_zero_init): New function.
(build_default_init): Use it.
(build_field_list): Skip FIELD_DECLs for base subobjects.
(push_base_cleanups): Likewise.
* method.c (do_build_assign_ref): Likewise.
(synthesize_exception_spec): Likewise.
* pt.c (tsubst_decl): Clear DECL_INITIALIZED_P.
(regenerate_decl_from_template): To not set DECL_INITIAL for a
static data member whose initialization took place in its class.
(instantiate_decl): Do not pass an initializer to cp_finish_decl
in that situation.
* search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects.
(dfs_unuse_fields): Likewise.
* tree.c (pod_type_p): Handle error_mark_node.
(zero_init_p): Likewise.
* typeck.c (lookup_anon_field): Skip FIELD_DECLs for base
subobjects.
* typeck2.c (store_init_value): Remove #if 0'd code.
(force_store_init_value): Remove.
(process_init_constructor): Use build_zero_init.
* g++.dg/abi/empty7.C: New test.
* g++.dg/init/pm2.C: Likewise.
From-SVN: r57654
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r-- | gcc/cp/cp-tree.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 7e40937..3a9c7e7 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -59,6 +59,7 @@ struct diagnostic_context; INHERITED_VALUE_BINDING_P (in CPLUS_BINDING) ICS_ELLIPSIS_FLAG (in _CONV) BINFO_ACCESS (in BINFO) + DECL_INITIALIZED_P (in VAR_DECL) 2: IDENTIFIER_OPNAME_P. TYPE_POLYMORPHIC_P (in _TYPE) ICS_THIS_FLAG (in _CONV) @@ -96,11 +97,10 @@ struct diagnostic_context; DECL_MUTABLE_P (in FIELD_DECL) 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL). DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL) - DECL_C_BITFIELD (in FIELD_DECL) 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL). DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL) 3: DECL_IN_AGGR_P. - 4: DECL_C_BIT_FIELD + 4: DECL_C_BIT_FIELD (in a FIELD_DECL) 5: DECL_INTERFACE_KNOWN. 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL). 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL). @@ -1150,8 +1150,7 @@ struct lang_type_class GTY(()) tree vfields; tree vbases; tree tags; - tree size; - tree size_unit; + tree as_base; tree pure_virtuals; tree friend_classes; tree rtti; @@ -1396,12 +1395,17 @@ struct lang_type GTY(()) #define CLASSTYPE_N_BASECLASSES(NODE) \ (BINFO_N_BASETYPES (TYPE_BINFO (NODE))) +/* The type corresponding to NODE when NODE is used as a base class, + i.e., NODE without virtual base classes. */ + +#define CLASSTYPE_AS_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->as_base) + /* These are the size and alignment of the type without its virtual base classes, for when we use this type as a base itself. */ -#define CLASSTYPE_SIZE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->size) -#define CLASSTYPE_SIZE_UNIT(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->size_unit) -#define CLASSTYPE_ALIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->align) -#define CLASSTYPE_USER_ALIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->user_align) +#define CLASSTYPE_SIZE(NODE) TYPE_SIZE (CLASSTYPE_AS_BASE (NODE)) +#define CLASSTYPE_SIZE_UNIT(NODE) TYPE_SIZE_UNIT (CLASSTYPE_AS_BASE (NODE)) +#define CLASSTYPE_ALIGN(NODE) TYPE_ALIGN (CLASSTYPE_AS_BASE (NODE)) +#define CLASSTYPE_USER_ALIGN(NODE) TYPE_USER_ALIGN (CLASSTYPE_AS_BASE (NODE)) /* The alignment of NODE, without its virtual bases, in bytes. */ #define CLASSTYPE_ALIGN_UNIT(NODE) \ @@ -1954,6 +1958,11 @@ struct lang_decl GTY(()) should be allocated. */ #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE)) +/* Nonzero for a VAR_DECL means that the variable's initialization has + been processed. */ +#define DECL_INITIALIZED_P(NODE) \ + (TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE))) + /* Nonzero if the DECL was initialized in the class definition itself, rather than outside the class. */ #define DECL_INITIALIZED_IN_CLASS_P(DECL) \ @@ -3850,7 +3859,6 @@ extern void check_handlers PARAMS ((tree)); extern void choose_personality_routine PARAMS ((enum languages)); /* in expr.c */ -extern int extract_init PARAMS ((tree, tree)); extern rtx cxx_expand_expr PARAMS ((tree, rtx, enum machine_mode, int)); @@ -3870,7 +3878,7 @@ extern tree build_init PARAMS ((tree, tree, int)); extern int is_aggr_type PARAMS ((tree, int)); extern tree get_aggr_from_typedef PARAMS ((tree, int)); extern tree get_type_value PARAMS ((tree)); -extern tree build_forced_zero_init PARAMS ((tree)); +extern tree build_zero_init (tree, bool); extern tree build_member_call PARAMS ((tree, tree, tree)); extern tree build_offset_ref PARAMS ((tree, tree)); extern tree resolve_offset_ref PARAMS ((tree)); @@ -4344,7 +4352,6 @@ extern tree binfo_or_else PARAMS ((tree, tree)); extern void readonly_error PARAMS ((tree, const char *, int)); extern int abstract_virtuals_error PARAMS ((tree, tree)); -extern tree force_store_init_value PARAMS ((tree, tree)); extern tree store_init_value PARAMS ((tree, tree)); extern tree digest_init PARAMS ((tree, tree, tree *)); extern tree build_scoped_ref PARAMS ((tree, tree, tree *)); |