c-ada-spec.c (dump_generic_ada_node): Take into account signedness for enumeral types.
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 29 Jul 2017 09:52:04 +0000 (09:52 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 29 Jul 2017 09:52:04 +0000 (09:52 +0000)
* c-ada-spec.c (dump_generic_ada_node): Take into account signedness
for enumeral types.
(print_ada_declaration): Add missing guard for record types.

From-SVN: r250714

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

index c05ca124ddc93fabd2fb8209e6a8385bd74a12d9..88752a88c22fb50f29e194cc0e94fd4319af4480 100644 (file)
@@ -1,3 +1,9 @@
+2017-07-29  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-ada-spec.c (dump_generic_ada_node): Take into account signedness
+       for enumeral types.
+       (print_ada_declaration): Add missing guard for record types.
+
 2017-07-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/45784
index d39501c7b914d539ec4c6f1b274b7b73c6d234c7..de549501440e2d5827187b13428e6d449668729e 100644 (file)
@@ -2055,7 +2055,10 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
            }
          else
            {
-             pp_string (buffer, "unsigned");
+             if (TYPE_UNSIGNED (node))
+               pp_string (buffer, "unsigned");
+             else
+               pp_string (buffer, "int");
              for (; value; value = TREE_CHAIN (value))
                {
                  pp_semicolon (buffer);
@@ -3097,7 +3100,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
              if (TYPE_NAME (TREE_TYPE (t)))
                dump_generic_ada_node
                  (buffer, TREE_TYPE (t), t, spc, false, true);
-             else
+             else if (type)
                dump_ada_double_name (buffer, type, t);
            }
          else
index 8e83a732a5f50fd5434e4052781e3280f03f76ab..20ea9de7555edbfb801ecd6b32a1ec5669a3b5fc 100644 (file)
@@ -1,3 +1,7 @@
+2017-07-29  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-c++-common/dump-ada-spec-7.c: New test.
+
 2017-07-29  Jakub Jelinek  <jakub@redhat.com>
 
        * g++.dg/debug/dwarf2/inline-ns-1.C: New test.
diff --git a/gcc/testsuite/c-c++-common/dump-ada-spec-7.c b/gcc/testsuite/c-c++-common/dump-ada-spec-7.c
new file mode 100644 (file)
index 0000000..515d259
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */\r
+/* { dg-options "-fdump-ada-spec" } */\r
+\r
+enum E1 {\r
+    A1 = -1L,\r
+    A2 = 0,\r
+    A3 = 1\r
+};\r
+\r
+static enum {B1 = -1L, B2, B3} Obj1;\r
+\r
+static struct { int i; } Obj2;\r
+\r
+/* { dg-final { scan-ada-spec-not "unsigned" } } */\r
+/* { dg-final { cleanup-ada-spec } } */\r