aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.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/utils.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/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 78d5506..3117272 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -4736,9 +4736,28 @@ smaller_form_type_p (tree type, tree orig_type)
/* Perform final processing on global variables. */
+static GTY (()) tree dummy_global;
+
void
gnat_write_global_declarations (void)
{
+ /* If we have declared types as used at the global level, insert them in
+ the global hash table. We use a dummy variable for this purpose. */
+ if (!VEC_empty (tree, types_used_by_cur_var_decl))
+ {
+ dummy_global
+ = build_decl (BUILTINS_LOCATION, VAR_DECL, NULL_TREE, void_type_node);
+ TREE_STATIC (dummy_global) = 1;
+ TREE_ASM_WRITTEN (dummy_global) = 1;
+ varpool_mark_needed_node (varpool_node (dummy_global));
+
+ while (!VEC_empty (tree, types_used_by_cur_var_decl))
+ {
+ tree t = VEC_pop (tree, types_used_by_cur_var_decl);
+ types_used_by_var_decl_insert (t, dummy_global);
+ }
+ }
+
/* Proceed to optimize and emit assembly.
FIXME: shouldn't be the front end's responsibility to call this. */
cgraph_finalize_compilation_unit ();