c-ada-spec.c (print_ada_declaration): For typedef declarations...
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 13 Nov 2016 17:37:35 +0000 (17:37 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sun, 13 Nov 2016 17:37:35 +0000 (17:37 +0000)
* c-ada-spec.c (print_ada_declaration): For typedef declarations, look
for nested types only if the type is a record or union and dump SLOC.

From-SVN: r242356

gcc/c-family/ChangeLog
gcc/c-family/c-ada-spec.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/dump-ada-spec-6.c [new file with mode: 0644]

index 55c2e609606ffbd3c6223725871090a189004654..8c99b75aa56317e60d1166c38e174ff56b65fd67 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-13  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-ada-spec.c (print_ada_declaration): For typedef declarations, look
+       for nested types only if the type is a record or union and dump SLOC.
+
 2016-11-09  Jason Merrill  <jason@redhat.com>
 
        * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_template_auto.
index a5395b69489c0f25935b46918a20a09f1c577f4b..42a2cd3a302f8c8fc87d86ca6ccec039eeaff845 100644 (file)
@@ -2813,7 +2813,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
                }
              else
                {
-                 if (!TREE_VISITED (stub)
+                 if (RECORD_OR_UNION_TYPE_P (typ)
                      && DECL_SOURCE_FILE (stub) == source_file_base)
                    dump_nested_types (buffer, stub, stub, true, spc);
 
@@ -2821,7 +2821,8 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
                  dump_generic_ada_node (buffer, t, type, spc, false, true);
                  pp_string (buffer, " is ");
                  dump_generic_ada_node (buffer, typ, type, spc, false, true);
-                 pp_semicolon (buffer);
+                 pp_string (buffer, ";  -- ");
+                 dump_sloc (buffer, t);
                }
 
              TREE_VISITED (t) = 1;
index 37ddec7723ae5db6a2fe1711576d33dcdcacaa18..ee0282c78706b81b2db0134e6eb2d13ed53989d6 100644 (file)
@@ -1,3 +1,7 @@
+2016-11-13  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-c++-common/dump-ada-spec-6.c: New test.
+
 2016-11-13  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/lto21.adb: New test.
diff --git a/gcc/testsuite/c-c++-common/dump-ada-spec-6.c b/gcc/testsuite/c-c++-common/dump-ada-spec-6.c
new file mode 100644 (file)
index 0000000..fb31b3b
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-ada-spec" } */
+
+typedef enum {
+    Zero
+} MyEnum;
+
+typedef MyEnum SomethingElse; 
+
+/* { dg-final { cleanup-ada-spec } } */