diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-04-06 10:22:23 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-04-06 10:22:23 +0000 |
commit | 1bde5bc4681ac3713d54d6511cfb6000be57114f (patch) | |
tree | 42de824735fa6830fb3e6d3b17e3783804163d36 /gcc/ada/decl.c | |
parent | d7d7db8b40e645ae15a530348b55d2b11a7d3135 (diff) | |
download | gcc-1bde5bc4681ac3713d54d6511cfb6000be57114f.zip gcc-1bde5bc4681ac3713d54d6511cfb6000be57114f.tar.gz gcc-1bde5bc4681ac3713d54d6511cfb6000be57114f.tar.bz2 |
decl.c (rest_of_type_decl_compilation_no_defer): New local function used to process all the variants of the specified type.
* decl.c (rest_of_type_decl_compilation_no_defer): New local function
used to process all the variants of the specified type.
(gnat_to_gnu_entity): Invoke rest_of_type_decl_compilation for enumeral
types too. Call rest_of_type_decl_compilation_no_defer if undeferring.
(rest_of_type_decl_compilation): Likewise.
* utils.c (gnat_pushdecl): Propagate the name to all variants of type.
From-SVN: r133957
Diffstat (limited to 'gcc/ada/decl.c')
-rw-r--r-- | gcc/ada/decl.c | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index ee9c1c5..e31b525 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -119,7 +119,8 @@ static tree make_type_from_size (tree, tree, bool); static unsigned int validate_alignment (Uint, Entity_Id, unsigned int); static unsigned int ceil_alignment (unsigned HOST_WIDE_INT); static void check_ok_for_atomic (tree, Entity_Id, bool); -static int compatible_signatures_p (tree ftype1, tree ftype2); +static int compatible_signatures_p (tree ftype1, tree ftype2); +static void rest_of_type_decl_compilation_no_defer (tree); /* Given GNAT_ENTITY, an entity in the incoming GNAT tree, return a GCC type corresponding to that entity. GNAT_ENTITY is assumed to @@ -4417,12 +4418,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (TREE_CODE (gnu_scalar_type) == ENUMERAL_TYPE) { - TYPE_STUB_DECL (gnu_scalar_type) = gnu_decl; - /* Since this has both a typedef and a tag, avoid outputting the name twice. */ DECL_ARTIFICIAL (gnu_decl) = 1; - rest_of_type_compilation (gnu_scalar_type, global_bindings_p ()); + rest_of_type_decl_compilation (gnu_decl); } } @@ -4462,12 +4461,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) now proceed with the finalization of the deferred types. */ if (defer_finalize_level == 0 && defer_finalize_list) { - int toplev = global_bindings_p (); unsigned int i; tree t; for (i = 0; VEC_iterate (tree, defer_finalize_list, i, t); i++) - rest_of_decl_compilation (t, toplev, 0); + rest_of_type_decl_compilation_no_defer (t); VEC_free (tree, heap, defer_finalize_list); } @@ -4514,17 +4512,46 @@ gnat_to_gnu_field_decl (Entity_Id gnat_entity) return gnu_field; } -/* Wrap up compilation of T, a TYPE_DECL, possibly deferring it. */ +/* Wrap up compilation of DECL, a TYPE_DECL, possibly deferring it. + Every TYPE_DECL generated for a type definition must be passed + to this function once everything else has been done for it. */ void -rest_of_type_decl_compilation (tree t) +rest_of_type_decl_compilation (tree decl) { /* We need to defer finalizing the type if incomplete types are being deferred or if they are being processed. */ if (defer_incomplete_level || defer_finalize_level) - VEC_safe_push (tree, heap, defer_finalize_list, t); + VEC_safe_push (tree, heap, defer_finalize_list, decl); else - rest_of_decl_compilation (t, global_bindings_p (), 0); + rest_of_type_decl_compilation_no_defer (decl); +} + +/* Same as above but without deferring the compilation. This + function should not be invoked directly on a TYPE_DECL. */ + +static void +rest_of_type_decl_compilation_no_defer (tree decl) +{ + const int toplev = global_bindings_p (); + tree t = TREE_TYPE (decl); + + rest_of_decl_compilation (decl, toplev, 0); + + /* Now process all the variants. This is needed for STABS. */ + for (t = TYPE_MAIN_VARIANT (t); t; t = TYPE_NEXT_VARIANT (t)) + { + if (t == TREE_TYPE (decl)) + continue; + + if (!TYPE_STUB_DECL (t)) + { + TYPE_STUB_DECL (t) = build_decl (TYPE_DECL, DECL_NAME (decl), t); + DECL_ARTIFICIAL (TYPE_STUB_DECL (t)) = 1; + } + + rest_of_type_compilation (t, toplev); + } } /* Finalize any From_With_Type incomplete types. We do this after processing |