+2008-04-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * 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.
+
2008-04-03 Paolo Bonzini <bonzini@gnu.org>
- * gigi.h (insert_block): Kill.
- * utils.c (insert_block): Kill.
+ * gigi.h (insert_block): Kill.
+ * utils.c (insert_block): Kill.
2008-04-02 Eric Botcazou <ebotcazou@adacore.com>
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
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);
}
}
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);
}
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