From: Eric Botcazou Date: Sat, 2 Apr 2011 08:16:29 +0000 (+0000) Subject: decl.c (gnat_to_gnu_entity): Defer finalizing types when updating the pointers to... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=80ec8b4cf19ac985c95e2a222d84e48324cb8994;p=gcc.git 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) : Defer finalizing types when updating the pointers to the designated type. : Finalize the deferred types even if we didn't defer processing of incomplete types in this invocation. From-SVN: r171879 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7d51728ba5b..e4928c4b4bb 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2011-04-02 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Defer + finalizing types when updating the pointers to the designated type. + : Finalize the deferred types even if we didn't defer processing + of incomplete types in this invocation. + 2011-04-01 Olivier Hainque Nicolas Setton Eric Botcazou @@ -8,27 +15,23 @@ 2011-03-28 Kai Tietz * 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 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. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index cea8d3d6990..1afa06c7ade 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -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; + 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; + /* 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 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); - } + for (; p; p = next) + { + next = p->next; - 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