Commit abc24d93 by Eric Botcazou Committed by Eric Botcazou

c-ada-spec.c (dump_ada_declaration): Generate a forward declaration for a…

c-ada-spec.c (dump_ada_declaration): Generate a forward declaration for a typedef independently of whether the...

	* c-ada-spec.c (dump_ada_declaration) <TYPE_DECL>: Generate a forward
	declaration for a typedef independently of whether the declaration of
	the subtype is generated.

From-SVN: r261058
parent 67e5c59a
2018-06-01 Eric Botcazou <ebotcazou@adacore.com>
* c-ada-spec.c (dump_ada_declaration) <TYPE_DECL>: Generate a forward
declaration for a typedef independently of whether the declaration of
the subtype is generated.
2018-05-31 Martin Sebor <msebor@redhat.com> 2018-05-31 Martin Sebor <msebor@redhat.com>
PR c/82063 PR c/82063
......
...@@ -2734,19 +2734,25 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) ...@@ -2734,19 +2734,25 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
if (TYPE_NAME (typ)) if (TYPE_NAME (typ))
{ {
/* If types have same representation, and same name (ignoring /* If the types have the same name (ignoring casing), then ignore
casing), then ignore the second type. */ the second type, but forward declare the first if need be. */
if (type_name (typ) == type_name (TREE_TYPE (t)) if (type_name (typ) == type_name (TREE_TYPE (t))
|| !strcasecmp (type_name (typ), type_name (TREE_TYPE (t)))) || !strcasecmp (type_name (typ), type_name (TREE_TYPE (t))))
{ {
if (RECORD_OR_UNION_TYPE_P (typ) && !TREE_VISITED (stub))
{
INDENT (spc);
dump_forward_type (buffer, typ, t, 0);
}
TREE_VISITED (t) = 1; TREE_VISITED (t) = 1;
return 0; return 0;
} }
INDENT (spc); INDENT (spc);
if (RECORD_OR_UNION_TYPE_P (typ)) if (RECORD_OR_UNION_TYPE_P (typ) && !TREE_VISITED (stub))
dump_forward_type (buffer, stub, t, spc); dump_forward_type (buffer, typ, t, spc);
pp_string (buffer, "subtype "); pp_string (buffer, "subtype ");
dump_ada_node (buffer, t, type, spc, false, true); dump_ada_node (buffer, t, type, spc, false, true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment