aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-06-01 08:36:20 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2018-06-01 08:36:20 +0000
commitabc24d932cf028c4ba363c89aad530fd0f49d93f (patch)
tree8ca1ef4b9a3cf43e2cc3d0bebef3cd0021d05c1e /gcc
parent67e5c59afb1696a624bdd2c49ada60db52158af4 (diff)
downloadgcc-abc24d932cf028c4ba363c89aad530fd0f49d93f.zip
gcc-abc24d932cf028c4ba363c89aad530fd0f49d93f.tar.gz
gcc-abc24d932cf028c4ba363c89aad530fd0f49d93f.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-ada-spec.c14
2 files changed, 16 insertions, 4 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 7024507..319e546 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+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>
PR c/82063
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index bc137a6..30fdb59 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -2734,19 +2734,25 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
if (TYPE_NAME (typ))
{
- /* If types have same representation, and same name (ignoring
- casing), then ignore the second type. */
+ /* If the types have the same name (ignoring casing), then ignore
+ the second type, but forward declare the first if need be. */
if (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;
return 0;
}
INDENT (spc);
- if (RECORD_OR_UNION_TYPE_P (typ))
- dump_forward_type (buffer, stub, t, spc);
+ if (RECORD_OR_UNION_TYPE_P (typ) && !TREE_VISITED (stub))
+ dump_forward_type (buffer, typ, t, spc);
pp_string (buffer, "subtype ");
dump_ada_node (buffer, t, type, spc, false, true);