decl.c (gnat_to_gnu_entity): Defer finalizing types when updating the pointers to the designated type.

* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Access_Type>: Defer
	finalizing types when updating the pointers to the designated type.
	<all>: Finalize the deferred types even if we didn't defer processing
	of incomplete types in this invocation.

From-SVN: r171879
This commit is contained in:
Eric Botcazou 2011-04-02 08:16:29 +00:00
parent bb0ce33a0e
commit 80ec8b4cf1
2 changed files with 57 additions and 49 deletions

View File

@ -1,3 +1,10 @@
2011-04-02 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Access_Type>: Defer
finalizing types when updating the pointers to the designated type.
<all>: Finalize the deferred types even if we didn't defer processing
of incomplete types in this invocation.
2011-04-01 Olivier Hainque <hainque@adacore.com>
Nicolas Setton <setton@adacore.com>
Eric Botcazou <ebotcazou@adacore.com>
@ -8,27 +15,23 @@
2011-03-28 Kai Tietz <ktietz@redhat.com>
* gcc-interface/Makefile.in (SO_LIB): Handle multilib build for native
windows targets.
(EH_MECHANISM): Make sure we use gcc's exception mechanism for all
native windows target.
* system-mingw.ads (System): Change ZCX_By_Default default to
True.
Windows targets.
(EH_MECHANISM): Use GCC exception mechanism for native Windows targets.
* system-mingw.ads (System): Change ZCX_By_Default default to True.
* raise-gcc.c (PERSONALITY_FUNCTION): Add prototype to
prevent warning.
* raise-gcc.c (PERSONALITY_FUNCTION): Add prototype.
2011-03-28 Tristan Gingold <gingold@adacore.com>
PR ada/44431
* gcc-interface/Make-lang.in (ada/b_gnat1.adb): Replaces
ada/b_gnat1.c. Use ada output of gnatbind.
* gcc-interface/Make-lang.in (ada/b_gnat1.adb): Replace ada/b_gnat1.c.
Use ada output of gnatbind.
(ada/b_gnatb.adb): Ditto.
(ada/b_gnat1.o, ada/b_gnatb.o): New rules.
(ada.mostlyclean, ada.stage1)
(ada.stage2, ada.stage3, ada.stage4, ada.stageprofile)
(ada.stagefeedback): Adjust.
* gcc-interface/Makefile.in (b_gnatl.adb): Replaces b_gnatl.c
* gcc-interface/Makefile.in (b_gnatl.adb): Replace b_gnatl.c.
Use ada output of gnatbind.
(b_gnatm.adb): Ditto.
(b_gnatl.o, b_gnatm.o): New rules.

View File

@ -3769,8 +3769,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
along the way. update_pointer_to is expected to properly take
care of those situations. */
if (defer_incomplete_level == 0 && !is_from_limited_with)
update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_desig_type),
gnat_to_gnu_type (gnat_desig_equiv));
{
defer_finalize_level++;
update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_desig_type),
gnat_to_gnu_type (gnat_desig_equiv));
defer_finalize_level--;
}
else
{
struct incomplete *p = XNEW (struct incomplete);
@ -4968,49 +4972,50 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
}
/* If we deferred processing of incomplete types, re-enable it. If there
were no other disables and we have some to process, do so. */
if (this_deferred && --defer_incomplete_level == 0)
were no other disables and we have deferred types to process, do so. */
if (this_deferred
&& --defer_incomplete_level == 0
&& defer_incomplete_list)
{
if (defer_incomplete_list)
struct incomplete *p, *next;
/* We are back to level 0 for the deferring of incomplete types.
But processing these incomplete types below may itself require
deferring, so preserve what we have and restart from scratch. */
p = defer_incomplete_list;
defer_incomplete_list = NULL;
/* For finalization, however, all types must be complete so we
cannot do the same because deferred incomplete types may end up
referencing each other. Process them all recursively first. */
defer_finalize_level++;
for (; p; p = next)
{
struct incomplete *p, *next;
next = p->next;
/* We are back to level 0 for the deferring of incomplete types.
But processing these incomplete types below may itself require
deferring, so preserve what we have and restart from scratch. */
p = defer_incomplete_list;
defer_incomplete_list = NULL;
/* For finalization, however, all types must be complete so we
cannot do the same because deferred incomplete types may end up
referencing each other. Process them all recursively first. */
defer_finalize_level++;
for (; p; p = next)
{
next = p->next;
if (p->old_type)
update_pointer_to (TYPE_MAIN_VARIANT (p->old_type),
gnat_to_gnu_type (p->full_type));
free (p);
}
defer_finalize_level--;
if (p->old_type)
update_pointer_to (TYPE_MAIN_VARIANT (p->old_type),
gnat_to_gnu_type (p->full_type));
free (p);
}
/* All the deferred incomplete types have been processed so we can
now proceed with the finalization of the deferred types. */
if (defer_finalize_level == 0 && defer_finalize_list)
{
unsigned int i;
tree t;
defer_finalize_level--;
}
FOR_EACH_VEC_ELT (tree, defer_finalize_list, i, t)
rest_of_type_decl_compilation_no_defer (t);
/* If all the deferred incomplete types have been processed, we can proceed
with the finalization of the deferred types. */
if (defer_incomplete_level == 0
&& defer_finalize_level == 0
&& defer_finalize_list)
{
unsigned int i;
tree t;
VEC_free (tree, heap, defer_finalize_list);
}
FOR_EACH_VEC_ELT (tree, defer_finalize_list, i, t)
rest_of_type_decl_compilation_no_defer (t);
VEC_free (tree, heap, defer_finalize_list);
}
/* If we are not defining this type, see if it's on one of the lists of