We cannot generate the 'constant' keyword for components in Ada, it's illegal.

Tested on x86_64-suse-linux, applied on the mainline.


2018-02-09  Eric Botcazou  <ebotca...@adacore.com>

c-family/
        * c-ada-spec.c (dump_ada_declaration): Do not generate the 'constant'
        keyword for components.

-- 
Eric Botcazou
Index: c-family/c-ada-spec.c
===================================================================
--- c-family/c-ada-spec.c	(revision 257404)
+++ c-family/c-ada-spec.c	(working copy)
@@ -3131,7 +3131,7 @@ dump_ada_declaration (pretty_printer *bu
 	    {
 	      pp_string (buffer, "aliased ");
 
-	      if (TREE_READONLY (t))
+	      if (TREE_READONLY (t) && TREE_CODE (t) != FIELD_DECL)
 		pp_string (buffer, "constant ");
 
 	      if (TYPE_NAME (TREE_TYPE (t)))
@@ -3147,7 +3147,7 @@ dump_ada_declaration (pretty_printer *bu
 		      || TREE_CODE (TREE_TYPE (t)) != INTEGER_TYPE))
 		pp_string (buffer, "aliased ");
 
-	      if (TREE_READONLY (t))
+	      if (TREE_READONLY (t) && TREE_CODE (t) != FIELD_DECL)
 		pp_string (buffer, "constant ");
 
 	      dump_generic_ada_node

Reply via email to