c-ada-spec.c (print_generic_ada_decl): Pass correctly-typed constant.
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 1 Aug 2017 20:50:00 +0000 (20:50 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 1 Aug 2017 20:50:00 +0000 (20:50 +0000)
* c-ada-spec.c (print_generic_ada_decl): Pass correctly-typed constant.
(dump_ada_function_declaration): Likewise.
(dump_generic_ada_node): Likewise.
(print_ada_declaration): Add support for const-qualified variables.

From-SVN: r250797

gcc/c-family/ChangeLog
gcc/c-family/c-ada-spec.c

index 1b6d7cfb903eea16f9c1bc890748e40255f0aea7..54c7d82c96852bdd2623d540f8eff69db9382492 100644 (file)
@@ -1,3 +1,10 @@
+2017-08-01  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-ada-spec.c (print_generic_ada_decl): Pass correctly-typed constant.
+       (dump_ada_function_declaration): Likewise.
+       (dump_generic_ada_node): Likewise.
+       (print_ada_declaration): Add support for const-qualified variables.
+
 2017-07-31  Martin Liska  <mliska@suse.cz>
 
        PR sanitize/81530
index de549501440e2d5827187b13428e6d449668729e..1f1c7e2f5d0e0e799d14f0a730e4f248d5ef4c84 100644 (file)
@@ -858,7 +858,7 @@ print_generic_ada_decl (pretty_printer *pp, tree decl, const char *source_file)
 {
   source_file_base = source_file;
 
-  if (print_ada_declaration (pp, decl, 0, INDENT_INCR))
+  if (print_ada_declaration (pp, decl, NULL_TREE, INDENT_INCR))
     {
       pp_newline (pp);
       pp_newline (pp);
@@ -1655,7 +1655,8 @@ dump_ada_function_declaration (pretty_printer *buffer, tree func,
          if (DECL_NAME (arg))
            {
              check_name (buffer, arg);
-             pp_ada_tree_identifier (buffer, DECL_NAME (arg), 0, false);
+             pp_ada_tree_identifier (buffer, DECL_NAME (arg), NULL_TREE,
+                                     false);
              pp_string (buffer, " : ");
            }
          else
@@ -2096,7 +2097,7 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
          {
            if (DECL_NAME (node))
              pp_ada_tree_identifier
-               (buffer, DECL_NAME (node), 0, limited_access);
+               (buffer, DECL_NAME (node), NULL_TREE, limited_access);
            else
              pp_string (buffer, "<unnamed type decl>");
          }
@@ -3097,6 +3098,9 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
            {
              pp_string (buffer, "aliased ");
 
+             if (TREE_READONLY (t))
+               pp_string (buffer, "constant ");
+
              if (TYPE_NAME (TREE_TYPE (t)))
                dump_generic_ada_node
                  (buffer, TREE_TYPE (t), t, spc, false, true);
@@ -3110,6 +3114,9 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
                      || TREE_CODE (TREE_TYPE (t)) != INTEGER_TYPE))
                pp_string (buffer, "aliased ");
 
+             if (TREE_READONLY (t))
+               pp_string (buffer, "constant ");
+
              dump_generic_ada_node
                (buffer, TREE_TYPE (t), TREE_TYPE (t), spc, false, true);
            }