Plus a couple of minor tweaks left and right.

Bootstrapped/regtested on x86_64-suse-linux, applied on the mainline.


2017-08-01  Eric Botcazou  <ebotca...@adacore.com>

c-family/
        * 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.

-- 
Eric Botcazou
Index: c-family/c-ada-spec.c
===================================================================
--- c-family/c-ada-spec.c	(revision 250718)
+++ c-family/c-ada-spec.c	(working copy)
@@ -858,7 +858,7 @@ print_generic_ada_decl (pretty_printer *pp, tree d
 {
   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 *buf
 	  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, tre
 	  {
 	    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, tre
 	    {
 	      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, tre
 		      || 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);
 	    }

Reply via email to