aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-04-02 08:36:32 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-04-02 08:36:32 +0000
commit65444786bebc03fd4f639801aecc8a25047d33f8 (patch)
tree881fb3f82762fd6dd981e1216e6623745d035a07 /gcc/ada/gcc-interface/trans.c
parent1aeb40dd6d0e8d5a62d25679fa6b0533d72fd4dd (diff)
downloadgcc-65444786bebc03fd4f639801aecc8a25047d33f8.zip
gcc-65444786bebc03fd4f639801aecc8a25047d33f8.tar.gz
gcc-65444786bebc03fd4f639801aecc8a25047d33f8.tar.bz2
ada-tree.h (DECL_TAFT_TYPE_P): New flag.
* gcc-interface/ada-tree.h (DECL_TAFT_TYPE_P): New flag. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Incomplete_Type>: Set it if this is a Taft amendment type and the full declaration is available. * gcc-interface/trans.c (process_type): Likewise. If there is an old type, mark the new one as used if DECL_TAFT_TYPE_P. (process_freeze_entity): Likewise. * gcc-interface/utils.c (dummy_global): New static variable. (gnat_write_global_declarations): If there are types declared as used at the global level, insert them in the global hash table. From-SVN: r171881
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index cca9523..9622625 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -6609,11 +6609,17 @@ process_freeze_entity (Node_Id gnat_node)
&& Root_Type (Class_Wide_Type (gnat_entity)) == gnat_entity)
save_gnu_tree (Class_Wide_Type (gnat_entity), gnu_new, false);
- /* If we've made any pointers to the old version of this type, we
- have to update them. */
+ /* If we have an old type and we've made pointers to this type, update those
+ pointers. If this is a Taft amendment type in the main unit, we need to
+ mark the type as used since other units referencing it don't see the full
+ declaration and, therefore, cannot mark it as used themselves. */
if (gnu_old)
- update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_old)),
- TREE_TYPE (gnu_new));
+ {
+ update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_old)),
+ TREE_TYPE (gnu_new));
+ if (DECL_TAFT_TYPE_P (gnu_old))
+ used_types_insert (TREE_TYPE (gnu_new));
+ }
}
/* Elaborate decls in the lists GNAT_DECLS and GNAT_DECLS2, if present.
@@ -7456,7 +7462,11 @@ process_type (Entity_Id gnat_entity)
save_gnu_tree (gnat_entity, gnu_decl, false);
if (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind)
&& Present (Full_View (gnat_entity)))
- save_gnu_tree (Full_View (gnat_entity), gnu_decl, false);
+ {
+ if (Has_Completion_In_Body (gnat_entity))
+ DECL_TAFT_TYPE_P (gnu_decl) = 1;
+ save_gnu_tree (Full_View (gnat_entity), gnu_decl, false);
+ }
}
return;
@@ -7478,11 +7488,17 @@ process_type (Entity_Id gnat_entity)
gnu_new = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 1);
gcc_assert (TREE_CODE (gnu_new) == TYPE_DECL);
- /* If we have an old type and we've made pointers to this type,
- update those pointers. */
+ /* If we have an old type and we've made pointers to this type, update those
+ pointers. If this is a Taft amendment type in the main unit, we need to
+ mark the type as used since other units referencing it don't see the full
+ declaration and, therefore, cannot mark it as used themselves. */
if (gnu_old)
- update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_old)),
- TREE_TYPE (gnu_new));
+ {
+ update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_old)),
+ TREE_TYPE (gnu_new));
+ if (DECL_TAFT_TYPE_P (gnu_old))
+ used_types_insert (TREE_TYPE (gnu_new));
+ }
/* If this is a record type corresponding to a task or protected type
that is a completion of an incomplete type, perform a similar update