diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2011-03-23 09:38:07 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2011-03-23 09:38:07 +0000 |
commit | 4184ef1b53a953f11d32569788d2ec3261dde565 (patch) | |
tree | cd54b4fec1924d75ab28ab56b0ea03c19e37cc25 /gcc/ada/gcc-interface/decl.c | |
parent | a5c7d693b920b650fb863e4b9a41b01c199f698f (diff) | |
download | gcc-4184ef1b53a953f11d32569788d2ec3261dde565.zip gcc-4184ef1b53a953f11d32569788d2ec3261dde565.tar.gz gcc-4184ef1b53a953f11d32569788d2ec3261dde565.tar.bz2 |
decl.c (gnat_to_gnu_entity): Create TYPE_DECL for the padded type built in order to support a specified...
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Create TYPE_DECL
for the padded type built in order to support a specified alignment.
Fix incorrect formatting.
From-SVN: r171342
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 2f9b2ec..313841a 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -687,6 +687,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (kind != E_Exception && Known_Alignment (gnat_entity)) { gcc_assert (Present (Alignment (gnat_entity))); + align = validate_alignment (Alignment (gnat_entity), gnat_entity, TYPE_ALIGN (gnu_type)); @@ -695,9 +696,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (Present (Address_Clause (gnat_entity))) align = 0; else - gnu_type - = maybe_pad_type (gnu_type, NULL_TREE, align, gnat_entity, - false, false, definition, true); + { + tree orig_type = gnu_type; + + gnu_type + = maybe_pad_type (gnu_type, NULL_TREE, align, gnat_entity, + false, false, definition, true); + + /* If a padding record was made, declare it now since it will + never be declared otherwise. This is necessary to ensure + that its subtrees are properly marked. */ + if (gnu_type != orig_type && !DECL_P (TYPE_NAME (gnu_type))) + create_type_decl (TYPE_NAME (gnu_type), gnu_type, NULL, true, + debug_info_p, gnat_entity); + } } /* If we are defining the object, see if it has a Size and validate it @@ -865,16 +877,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity)) && Is_Array_Type (Etype (gnat_entity)) && !type_annotate_only) - { - tree gnu_fat - = TREE_TYPE (gnat_to_gnu_type (Base_Type (Etype (gnat_entity)))); - - gnu_type - = build_unc_object_type_from_ptr (gnu_fat, gnu_type, - concat_name (gnu_entity_name, - "UNC"), - debug_info_p); - } + { + tree gnu_fat + = TREE_TYPE (gnat_to_gnu_type (Base_Type (Etype (gnat_entity)))); + gnu_type + = build_unc_object_type_from_ptr (gnu_fat, gnu_type, + concat_name (gnu_entity_name, + "UNC"), + debug_info_p); + } #ifdef MINIMUM_ATOMIC_ALIGNMENT /* If the size is a constant and no alignment is specified, force |