summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-30 16:52:19 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-30 16:52:19 +0000
commit23ed74d856ac9fe84673db612bb9e62ae26608d8 (patch)
treeca1fbe15f3c944722c4671ad1534fc2a6abdb753 /gcc/stor-layout.c
parent4770b4b70e757113c478d68f5e8eb22613eeef27 (diff)
downloadgcc-23ed74d856ac9fe84673db612bb9e62ae26608d8.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57654 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index e468a2b8ebe..953d58f75ca 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1484,11 +1484,14 @@ finalize_type_size (type)
/* Do all of the work required to layout the type indicated by RLI,
once the fields have been laid out. This function will call `free'
- for RLI. */
+ for RLI, unless FREE_P is false. Passing a value other than false
+ for FREE_P is bad practice; this option only exists to support the
+ G++ 3.2 ABI. */
void
-finish_record_layout (rli)
+finish_record_layout (rli, free_p)
record_layout_info rli;
+ int free_p;
{
/* Compute the final size. */
finalize_record_size (rli);
@@ -1508,7 +1511,8 @@ finish_record_layout (rli)
}
/* Clean up. */
- free (rli);
+ if (free_p)
+ free (rli);
}
/* Calculate the mode, size, and alignment for TYPE.
@@ -1763,7 +1767,7 @@ layout_type (type)
(*lang_adjust_rli) (rli);
/* Finish laying out the record. */
- finish_record_layout (rli);
+ finish_record_layout (rli, /*free_p=*/true);
}
break;