aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-02-28 13:59:44 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2018-02-28 13:59:44 +0000
commit09de35509f92de3a11a1ca879b958c0f73e28b88 (patch)
treef9a59c0225ccd0b2297a5192de8558d2587ae915
parente02f4b9298b75d7f4294574f7eb8baef9a48ff0c (diff)
downloadgcc-09de35509f92de3a11a1ca879b958c0f73e28b88.zip
gcc-09de35509f92de3a11a1ca879b958c0f73e28b88.tar.gz
gcc-09de35509f92de3a11a1ca879b958c0f73e28b88.tar.bz2
c-ada-spec.c (dump_ada_node): Do not use generic address for incomplete structures.
* c-ada-spec.c (dump_ada_node) <POINTER_TYPE>: Do not use generic address for incomplete structures. (dump_forward_type): Do not bail out for incomplete structures. (dump_ada_declaration): Do not special-case incomplete structures for subtypes. Dump them as null records for types. From-SVN: r258066
-rw-r--r--gcc/c-family/ChangeLog8
-rw-r--r--gcc/c-family/c-ada-spec.c42
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/c-c++-common/dump-ada-spec-11.c11
4 files changed, 37 insertions, 28 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 796ded2..ea203c3 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,5 +1,13 @@
2018-02-28 Eric Botcazou <ebotcazou@adacore.com>
+ * c-ada-spec.c (dump_ada_node) <POINTER_TYPE>: Do not use generic
+ address for incomplete structures.
+ (dump_forward_type): Do not bail out for incomplete structures.
+ (dump_ada_declaration): Do not special-case incomplete structures
+ for subtypes. Dump them as null records for types.
+
+2018-02-28 Eric Botcazou <ebotcazou@adacore.com>
+
* c-ada-spec.c (dump_ada_import): Use boolean and fix formatting.
(is_char_array): Fix formatting.
(dump_template_types): Likewise.
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index fbe654d..588dc5d 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -2266,11 +2266,8 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
{
tree type_name = TYPE_NAME (TREE_TYPE (node));
- /* For now, handle access-to-access and access-to-incomplete
- as opaque System.Address. */
- if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE
- || (RECORD_OR_UNION_TYPE_P (TREE_TYPE (node))
- && !COMPLETE_TYPE_P (TREE_TYPE (node))))
+ /* For now, handle access-to-access as System.Address. */
+ if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE)
{
if (package_prefix)
{
@@ -2515,11 +2512,6 @@ dump_forward_type (pretty_printer *buffer, tree type, tree t, int spc)
if (DECL_IS_BUILTIN (decl) || TREE_VISITED (decl))
return;
- /* We'll need to generate a completion at some point. */
- if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl))
- && !COMPLETE_TYPE_P (TREE_TYPE (decl)))
- return;
-
/* Forward declarations are only needed within a given file. */
if (DECL_SOURCE_FILE (decl) != DECL_SOURCE_FILE (t))
return;
@@ -2743,23 +2735,15 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
INDENT (spc);
- if (RECORD_OR_UNION_TYPE_P (typ) && !COMPLETE_TYPE_P (typ))
- {
- pp_string (buffer, "-- skipped incomplete struct ");
- dump_ada_node (buffer, t, type, spc, false, true);
- }
- else
- {
- if (RECORD_OR_UNION_TYPE_P (typ))
- dump_forward_type (buffer, stub, t, spc);
-
- pp_string (buffer, "subtype ");
- dump_ada_node (buffer, t, type, spc, false, true);
- pp_string (buffer, " is ");
- dump_ada_node (buffer, typ, type, spc, false, true);
- pp_string (buffer, "; -- ");
- dump_sloc (buffer, t);
- }
+ if (RECORD_OR_UNION_TYPE_P (typ))
+ dump_forward_type (buffer, stub, t, spc);
+
+ pp_string (buffer, "subtype ");
+ dump_ada_node (buffer, t, type, spc, false, true);
+ pp_string (buffer, " is ");
+ dump_ada_node (buffer, typ, type, spc, false, true);
+ pp_string (buffer, "; -- ");
+ dump_sloc (buffer, t);
TREE_VISITED (t) = 1;
return 1;
@@ -2788,8 +2772,10 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
case UNION_TYPE:
if (!COMPLETE_TYPE_P (TREE_TYPE (t)))
{
- pp_string (buffer, "-- skipped incomplete struct ");
+ pp_string (buffer, "type ");
dump_ada_node (buffer, t, type, spc, false, true);
+ pp_string (buffer, " is null record; -- incomplete struct");
+ TREE_VISITED (t) = 1;
return 1;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f799a93..dd2651f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * c-c++-common/dump-ada-spec-11.c: New test.
+
2018-02-28 Martin Liska <mliska@suse.cz>
PR testsuite/84597
diff --git a/gcc/testsuite/c-c++-common/dump-ada-spec-11.c b/gcc/testsuite/c-c++-common/dump-ada-spec-11.c
new file mode 100644
index 0000000..c812604
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dump-ada-spec-11.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-ada-spec" } */
+
+typedef struct T My_T;
+
+int foo1 (My_T *);
+
+int foo2 (My_T *);
+
+/* { dg-final { scan-ada-spec-not "System.Address" } } */
+/* { dg-final { cleanup-ada-spec } } */