The aspect syntax introduced in Ada 2012 makes it much easier to support 
function overloading in particular, so the patch removes a lot of lines:

 c-ada-spec.c |  322 ++++++++++++++++++---------------------------------------
 1 file changed, 105 insertions(+), 217 deletions(-)

Tested on x86-64/Linux, applied on the mainline.


2018-07-07  Eric Botcazou  <ebotca...@adacore.com>

        * c-ada-spec.c (to_ada_name): Remove index parameter.
        (pp_ada_tree_identifier): Likewise.
        (dump_ada_macros): Adjust call to to_ada_name.
        (struct overloaded_name_hash): Delete.
        (struct overloaded_name_hasher): Likewise.
        (overloaded_names): Likewise.
        (compute_overloading_index): Likewise.
        (dump_ada_decl_name): Do not call compute_overloading_index and
        adjust calls to pp_ada_tree_identifier.
        (dump_ada_double_name): Adjust calls to pp_ada_tree_identifier.
        (dump_ada_import): Add spc parameter and switch to aspect syntax.
        (dump_ada_function_declaration): Adjust call to pp_ada_tree_identifier.
        (dump_ada_enum_type): Remove type and display_convention parameters.
        Adjust calls to pp_ada_tree_identifier.
        (dump_ada_node): Likewise and for dump_ada_structure.
        (dump_nested_type) <ENUMERAL_TYPE>: Adjust call to dump_ada_enum_type
        and tidy up.
        <RECORD_TYPE>: Adjust call to dump_ada_structure and switch to aspect
        syntax.
        (print_constructor): Adjust call to pp_ada_tree_identifier.
        (print_destructor): Likewise.
        (dump_ada_declaration): Switch to aspect syntax.
        (dump_ada_structure): Likewise and tidy up.  Replace display_convention
        parameter with nested parameter.
        (dump_ads): Emit pragma Ada_2012 in lieu of pragma Ada_2005.
        (dump_ada_specs): Do not delete overloaded_names table.

-- 
Eric Botcazou
Index: c-ada-spec.c
===================================================================
--- c-ada-spec.c	(revision 262468)
+++ c-ada-spec.c	(working copy)
@@ -34,8 +34,8 @@ along with GCC; see the file COPYING3.
 /* Local functions, macros and variables.  */
 static int  dump_ada_node (pretty_printer *, tree, tree, int, bool, bool);
 static int  dump_ada_declaration (pretty_printer *, tree, tree, int);
-static void dump_ada_structure (pretty_printer *, tree, tree, int, bool);
-static char *to_ada_name (const char *, unsigned int, bool *);
+static void dump_ada_structure (pretty_printer *, tree, tree, bool, int);
+static char *to_ada_name (const char *, bool *);
 
 #define INDENT(SPACE) \
   do { int i; for (i = 0; i<SPACE; i++) pp_space (buffer); } while (0)
@@ -591,7 +591,7 @@ dump_ada_macros (pretty_printer *pp, con
 	  prev_line = sloc.line;
 
 	  pp_string (pp, "   ");
-	  ada_name = to_ada_name ((const char *) NODE_NAME (node), 0, NULL);
+	  ada_name = to_ada_name ((const char *) NODE_NAME (node), NULL);
 	  pp_string (pp, ada_name);
 	  free (ada_name);
 	  pp_string (pp, " : ");
@@ -1095,17 +1095,17 @@ has_nontrivial_methods (tree type)
 #define INDEX_LENGTH 8
 
 /* Generate a legal Ada name from a C/C++ NAME and return a malloc'ed string.
-   INDEX, if non-zero, is used to disambiguate overloaded names.  SPACE_FOUND,
-   if not NULL, is used to indicate whether a space was found in NAME.  */
+   SPACE_FOUND, if not NULL, is used to indicate whether a space was found in
+   NAME.  */
 
 static char *
-to_ada_name (const char *name, unsigned int index, bool *space_found)
+to_ada_name (const char *name, bool *space_found)
 {
   const char **names;
   const int len = strlen (name);
   int j, len2 = 0;
   bool found = false;
-  char *s = XNEWVEC (char, len * 2 + 5 + (index ? INDEX_LENGTH : 0));
+  char *s = XNEWVEC (char, len * 2 + 5);
   char c;
 
   if (space_found)
@@ -1303,10 +1303,7 @@ to_ada_name (const char *name, unsigned
   if (s[len2 - 1] == '_')
     s[len2++] = 'u';
 
-  if (index)
-    snprintf (&s[len2], INDEX_LENGTH, "_u_%d", index + 1);
-  else
-    s[len2] = '\0';
+  s[len2] = '\0';
 
   return s;
 }
@@ -1324,17 +1321,16 @@ separate_class_package (tree decl)
 static bool package_prefix = true;
 
 /* Dump in BUFFER the name of an identifier NODE of type TYPE, following Ada
-   syntax.  INDEX, if non-zero, is used to disambiguate overloaded names.
-   LIMITED_ACCESS indicates whether NODE can be accessed via a limited
-   'with' clause rather than a regular 'with' clause.  */
+   syntax.  LIMITED_ACCESS indicates whether NODE can be accessed through a
+   limited 'with' clause rather than a regular 'with' clause.  */
 
 static void
 pp_ada_tree_identifier (pretty_printer *buffer, tree node, tree type,
-			unsigned int index, bool limited_access)
+			bool limited_access)
 {
   const char *name = IDENTIFIER_POINTER (node);
   bool space_found = false;
-  char *s = to_ada_name (name, index, &space_found);
+  char *s = to_ada_name (name, &space_found);
   tree decl = get_underlying_decl (type);
 
   /* If the entity comes from another file, generate a package prefix.  */
@@ -1446,71 +1442,6 @@ pp_asm_name (pretty_printer *buffer, tre
   pp_string (buffer, ada_name);
 }
 
-/* Hash table of overloaded names associating identifier nodes with DECL_UIDs.
-   It is needed in Ada 2005 because we can have at most one import directive
-   per subprogram name in a given scope, so we have to mangle the subprogram
-   names on the Ada side to import overloaded subprograms from C++.  */
-
-struct overloaded_name_hash {
-  hashval_t hash;
-  tree name;
-  tree context;
-  vec<unsigned int> homonyms;
-};
-
-struct overloaded_name_hasher : delete_ptr_hash<overloaded_name_hash>
-{
-  static inline hashval_t hash (overloaded_name_hash *t)
-    { return t->hash; }
-  static inline bool equal (overloaded_name_hash *a, overloaded_name_hash *b)
-    { return a->name == b->name && a->context == b->context; }
-};
-
-static hash_table<overloaded_name_hasher> *overloaded_names;
-
-/* Compute the overloading index of function DECL in its context.  */
-
-static unsigned int
-compute_overloading_index (tree decl)
-{
-  const hashval_t hashcode
-    = iterative_hash_hashval_t (htab_hash_pointer (DECL_NAME (decl)),
-			        htab_hash_pointer (DECL_CONTEXT (decl)));
-  struct overloaded_name_hash in, *h, **slot;
-  unsigned int index, *iter;
-
-  if (!overloaded_names)
-    overloaded_names = new hash_table<overloaded_name_hasher> (512);
-
-  /* Look up the list of homonyms in the table.  */
-  in.hash = hashcode;
-  in.name = DECL_NAME (decl);
-  in.context = DECL_CONTEXT (decl);
-  slot = overloaded_names->find_slot_with_hash (&in, hashcode, INSERT);
-  if (*slot)
-    h = *slot;
-  else
-    {
-      h = new overloaded_name_hash;
-      h->hash = hashcode;
-      h->name = DECL_NAME (decl);
-      h->context = DECL_CONTEXT (decl);
-      h->homonyms.create (0);
-      *slot = h;
-    }
-
-  /* Look up the function in the list of homonyms.  */
-  FOR_EACH_VEC_ELT (h->homonyms, index, iter)
-    if (*iter == DECL_UID (decl))
-      break;
-
-  /* If it is not present, push it onto the list.  */
-  if (!iter)
-    h->homonyms.safe_push (DECL_UID (decl));
-
-  return index;
-}
-
 /* Dump in BUFFER the name of a DECL node if set, in Ada syntax.
    LIMITED_ACCESS indicates whether NODE can be accessed via a
    limited 'with' clause rather than a regular 'with' clause.  */
@@ -1519,13 +1450,7 @@ static void
 dump_ada_decl_name (pretty_printer *buffer, tree decl, bool limited_access)
 {
   if (DECL_NAME (decl))
-    {
-      const unsigned int index
-	= (TREE_CODE (decl) == FUNCTION_DECL && cpp_check)
-	  ? compute_overloading_index (decl) : 0;
-      pp_ada_tree_identifier (buffer, DECL_NAME (decl), decl, index,
-			      limited_access);
-    }
+    pp_ada_tree_identifier (buffer, DECL_NAME (decl), decl, limited_access);
   else
     {
       tree type_name = TYPE_NAME (TREE_TYPE (decl));
@@ -1539,7 +1464,7 @@ dump_ada_decl_name (pretty_printer *buff
 	    pp_scalar (buffer, "%d", TYPE_UID (TREE_TYPE (decl)));
 	}
       else if (TREE_CODE (type_name) == IDENTIFIER_NODE)
-	pp_ada_tree_identifier (buffer, type_name, decl, 0, limited_access);
+	pp_ada_tree_identifier (buffer, type_name, decl, limited_access);
     }
 }
 
@@ -1549,7 +1474,7 @@ static void
 dump_ada_double_name (pretty_printer *buffer, tree t1, tree t2)
 {
   if (DECL_NAME (t1))
-    pp_ada_tree_identifier (buffer, DECL_NAME (t1), t1, 0, false);
+    pp_ada_tree_identifier (buffer, DECL_NAME (t1), t1, false);
   else
     {
       pp_string (buffer, "anon");
@@ -1559,7 +1484,7 @@ dump_ada_double_name (pretty_printer *bu
   pp_underscore (buffer);
 
   if (DECL_NAME (t2))
-    pp_ada_tree_identifier (buffer, DECL_NAME (t2), t2, 0, false);
+    pp_ada_tree_identifier (buffer, DECL_NAME (t2), t2, false);
   else
     {
       pp_string (buffer, "anon");
@@ -1586,32 +1511,38 @@ dump_ada_double_name (pretty_printer *bu
     }
 }
 
-/* Dump in BUFFER pragma Import C/CPP on a given node T.  */
+/* Dump in BUFFER aspect Import on a given node T.  SPC is the current
+   indentation level.  */
 
 static void
-dump_ada_import (pretty_printer *buffer, tree t)
+dump_ada_import (pretty_printer *buffer, tree t, int spc)
 {
   const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (t));
   const bool is_stdcall
     = TREE_CODE (t) == FUNCTION_DECL
       && lookup_attribute ("stdcall", TYPE_ATTRIBUTES (TREE_TYPE (t)));
 
+  pp_string (buffer, "with Import => True, ");
+
+  newline_and_indent (buffer, spc + 5);
+
   if (is_stdcall)
-    pp_string (buffer, "pragma Import (Stdcall, ");
+    pp_string (buffer, "Convention => Stdcall, ");
   else if (name[0] == '_' && name[1] == 'Z')
-    pp_string (buffer, "pragma Import (CPP, ");
+    pp_string (buffer, "Convention => CPP, ");
   else
-    pp_string (buffer, "pragma Import (C, ");
+    pp_string (buffer, "Convention => C, ");
 
-  dump_ada_decl_name (buffer, t, false);
-  pp_string (buffer, ", \"");
+  newline_and_indent (buffer, spc + 5);
+
+  pp_string (buffer, "External_Name => \"");
 
   if (is_stdcall)
     pp_string (buffer, IDENTIFIER_POINTER (DECL_NAME (t)));
   else
     pp_asm_name (buffer, t);
 
-  pp_string (buffer, "\");");
+  pp_string (buffer, "\";");
 }
 
 /* Check whether T and its type have different names, and append "the_"
@@ -1717,7 +1648,7 @@ dump_ada_function_declaration (pretty_pr
 	  if (DECL_NAME (arg))
 	    {
 	      check_name (buffer, arg);
-	      pp_ada_tree_identifier (buffer, DECL_NAME (arg), NULL_TREE, 0,
+	      pp_ada_tree_identifier (buffer, DECL_NAME (arg), NULL_TREE,
 				      false);
 	      pp_string (buffer, " : ");
 	    }
@@ -2022,13 +1953,11 @@ is_simple_enum (tree node)
   return true;
 }
 
-/* Dump in BUFFER an enumeral type NODE of type TYPE in Ada syntax.  SPC is
-   the indentation level.  If DISPLAY_CONVENTION is true, also print the
-   pragma Convention for NODE.  */
+/* Dump in BUFFER an enumeral type NODE in Ada syntax.  SPC is the indentation
+   level.  */
 
 static void
-dump_ada_enum_type (pretty_printer *buffer, tree node, tree type, int spc,
-		    bool display_convention)
+dump_ada_enum_type (pretty_printer *buffer, tree node, int spc)
 {
   if (is_simple_enum (node))
     {
@@ -2046,19 +1975,12 @@ dump_ada_enum_type (pretty_printer *buff
 	      newline_and_indent (buffer, spc);
 	    }
 
-	  pp_ada_tree_identifier (buffer, TREE_PURPOSE (value), node, 0, false);
+	  pp_ada_tree_identifier (buffer, TREE_PURPOSE (value), node, false);
 	}
-      pp_string (buffer, ");");
+      pp_string (buffer, ")");
       spc -= INDENT_INCR;
       newline_and_indent (buffer, spc);
-
-      if (display_convention)
-	{
-	  pp_string (buffer, "pragma Convention (C, ");
-	  dump_ada_node (buffer, DECL_NAME (type) ? type : TYPE_NAME (node),
-		     type, spc, false, true);
-	  pp_right_paren (buffer);
-	}
+      pp_string (buffer, "with Convention => C");
     }
   else
     {
@@ -2071,7 +1993,7 @@ dump_ada_enum_type (pretty_printer *buff
 	  pp_semicolon (buffer);
 	  newline_and_indent (buffer, spc);
 
-	  pp_ada_tree_identifier (buffer, TREE_PURPOSE (value), node, 0, false);
+	  pp_ada_tree_identifier (buffer, TREE_PURPOSE (value), node, false);
 	  pp_string (buffer, " : constant ");
 
 	  if (TYPE_UNSIGNED (node))
@@ -2110,7 +2032,7 @@ dump_ada_node (pretty_printer *buffer, t
       return 0;
 
     case IDENTIFIER_NODE:
-      pp_ada_tree_identifier (buffer, node, type, 0, limited_access);
+      pp_ada_tree_identifier (buffer, node, type, limited_access);
       break;
 
     case TREE_LIST:
@@ -2149,7 +2071,7 @@ dump_ada_node (pretty_printer *buffer, t
       if (name_only)
 	dump_ada_node (buffer, TYPE_NAME (node), node, spc, false, true);
       else
-	dump_ada_enum_type (buffer, node, type, spc, true);
+	dump_ada_enum_type (buffer, node, spc);
       break;
 
     case REAL_TYPE:
@@ -2171,7 +2093,7 @@ dump_ada_node (pretty_printer *buffer, t
       if (TYPE_NAME (node))
 	{
 	  if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
-	    pp_ada_tree_identifier (buffer, TYPE_NAME (node), node, 0,
+	    pp_ada_tree_identifier (buffer, TYPE_NAME (node), node,
 				    limited_access);
 	  else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
 		   && DECL_NAME (TYPE_NAME (node)))
@@ -2215,14 +2137,11 @@ dump_ada_node (pretty_printer *buffer, t
 					 spc + INDENT_INCR);
 
 	  /* If we are dumping the full type, it means we are part of a
-	     type definition and need also a Convention C pragma.  */
+	     type definition and need also a Convention C aspect.  */
 	  if (!name_only)
 	    {
-	      pp_semicolon (buffer);
 	      newline_and_indent (buffer, spc);
-	      pp_string (buffer, "pragma Convention (C, ");
-	      dump_ada_node (buffer, type, NULL_TREE, spc, false, true);
-	      pp_right_paren (buffer);
+	      pp_string (buffer, "with Convention => C");
 	    }
 	}
       else
@@ -2336,7 +2255,7 @@ dump_ada_node (pretty_printer *buffer, t
 	dump_ada_node (buffer, TYPE_NAME (node), node, spc, limited_access,
 		       true);
       else
-	dump_ada_structure (buffer, node, type, spc, true);
+	dump_ada_structure (buffer, node, type, false, spc);
       break;
 
     case INTEGER_CST:
@@ -2607,23 +2526,9 @@ dump_nested_type (pretty_printer *buffer
       else
 	dump_ada_double_name (buffer, parent, field);
       pp_string (buffer, " is ");
-      dump_ada_enum_type (buffer, field_type, t, spc, false);
-
-      if (is_simple_enum (field_type))
-	{
-	  pp_string (buffer, "pragma Convention (C, ");
-	  if (TYPE_NAME (field_type))
-	    dump_ada_node (buffer, field_type, NULL_TREE, spc, false, true);
-	  else
-	    dump_ada_double_name (buffer, parent, field);
-	  pp_string (buffer, ");");
-	  newline_and_indent (buffer, spc);
-	}
-      else
-	{
-	  pp_semicolon (buffer);
-	  newline_and_indent (buffer, spc);
-	}
+      dump_ada_enum_type (buffer, field_type, spc);
+      pp_semicolon (buffer);
+      newline_and_indent (buffer, spc);
       break;
 
     case RECORD_TYPE:
@@ -2641,25 +2546,19 @@ dump_nested_type (pretty_printer *buffer
 	pp_string (buffer, " (discr : unsigned := 0)");
 
       pp_string (buffer, " is ");
-      dump_ada_structure (buffer, field_type, t, spc, false);
+      dump_ada_structure (buffer, field_type, t, true, spc);
 
-      pp_string (buffer, "pragma Convention (C_Pass_By_Copy, ");
-      if (TYPE_NAME (field_type))
-	dump_ada_node (buffer, field_type, NULL_TREE, spc, false, true);
-      else
-	dump_ada_double_name (buffer, parent, field);
-      pp_string (buffer, ");");
-      newline_and_indent (buffer, spc);
+      pp_string (buffer, "with Convention => C_Pass_By_Copy");
 
       if (TREE_CODE (field_type) == UNION_TYPE)
 	{
-	  pp_string (buffer, "pragma Unchecked_Union (");
-	  if (TYPE_NAME (field_type))
-	    dump_ada_node (buffer, field_type, NULL_TREE, spc, false, true);
-	  else
-	    dump_ada_double_name (buffer, parent, field);
-	  pp_string (buffer, ");");
+	  pp_comma (buffer);
+	  newline_and_indent (buffer, spc + 5);
+	  pp_string (buffer, "Unchecked_Union => True");
 	}
+
+      pp_semicolon (buffer);
+      newline_and_indent (buffer, spc);
       break;
 
     default:
@@ -2675,7 +2574,7 @@ print_constructor (pretty_printer *buffe
   tree decl_name = DECL_NAME (TYPE_NAME (type));
 
   pp_string (buffer, "New_");
-  pp_ada_tree_identifier (buffer, decl_name, t, 0, false);
+  pp_ada_tree_identifier (buffer, decl_name, t, false);
 }
 
 /* Dump in BUFFER destructor spec corresponding to T.  */
@@ -2686,7 +2585,7 @@ print_destructor (pretty_printer *buffer
   tree decl_name = DECL_NAME (TYPE_NAME (type));
 
   pp_string (buffer, "Delete_");
-  pp_ada_tree_identifier (buffer, decl_name, t, 0, false);
+  pp_ada_tree_identifier (buffer, decl_name, t, false);
 }
 
 /* Return the name of type T.  */
@@ -2981,33 +2880,33 @@ dump_ada_declaration (pretty_printer *bu
       if (is_abstract || is_abstract_class)
 	pp_string (buffer, " is abstract");
 
-      pp_semicolon (buffer);
-      pp_string (buffer, "  -- ");
-      dump_sloc (buffer, t);
-
       if (is_abstract || !DECL_ASSEMBLER_NAME (t))
-	return 1;
-
-      newline_and_indent (buffer, spc);
-
-      if (is_constructor)
 	{
+	  pp_semicolon (buffer);
+	  pp_string (buffer, "  -- ");
+	  dump_sloc (buffer, t);
+	}
+      else if (is_constructor)
+	{
+	  pp_semicolon (buffer);
+	  pp_string (buffer, "  -- ");
+	  dump_sloc (buffer, t);
+
+	  newline_and_indent (buffer, spc);
 	  pp_string (buffer, "pragma CPP_Constructor (");
 	  print_constructor (buffer, t, type);
 	  pp_string (buffer, ", \"");
 	  pp_asm_name (buffer, t);
 	  pp_string (buffer, "\");");
 	}
-      else if (is_destructor)
+      else
 	{
-	  pp_string (buffer, "pragma Import (CPP, ");
-	  print_destructor (buffer, t, type);
-	  pp_string (buffer, ", \"");
-	  pp_asm_name (buffer, t);
-	  pp_string (buffer, "\");");
+	  pp_string (buffer, "  -- ");
+	  dump_sloc (buffer, t);
+
+	  newline_and_indent (buffer, spc);
+	  dump_ada_import (buffer, t, spc);
 	}
-      else
-	dump_ada_import (buffer, t);
 
       return 1;
     }
@@ -3062,13 +2961,12 @@ dump_ada_declaration (pretty_printer *bu
       TREE_VISITED (t) = 1; 
       if (is_interface)
 	{
-	  pp_string (buffer, "limited interface;  -- ");
+	  pp_string (buffer, "limited interface  -- ");
 	  dump_sloc (buffer, t);
 	  newline_and_indent (buffer, spc);
-	  pp_string (buffer, "pragma Import (CPP, ");
-	  dump_ada_node (buffer, TYPE_NAME (TREE_TYPE (t)), type, spc, false,
-			 true);
-	  pp_right_paren (buffer);
+	  pp_string (buffer, "with Import => True,");
+	  newline_and_indent (buffer, spc + 5);
+	  pp_string (buffer, "Convention => CPP");
 
 	  dump_ada_methods (buffer, TREE_TYPE (t), spc);
 	}
@@ -3152,28 +3050,29 @@ dump_ada_declaration (pretty_printer *bu
       /* All needed indentation/newline performed already, so return 0.  */
       return 0;
     }
-  else
+  else if (is_var)
     {
-      pp_string (buffer, ";  -- ");
+      pp_string (buffer, "  -- ");
       dump_sloc (buffer, t);
+      newline_and_indent (buffer, spc);
+      dump_ada_import (buffer, t, spc);
     }
 
-  if (is_var)
+  else
     {
-      newline_and_indent (buffer, spc);
-      dump_ada_import (buffer, t);
+      pp_string (buffer, ";  -- ");
+      dump_sloc (buffer, t);
     }
 
   return 1;
 }
 
-/* Dump in BUFFER a structure NODE of type TYPE: name, fields, and methods
-   in Ada syntax.  SPC is the indentation level.  If DISPLAY_CONVENTION is
-   true, also print the pragma Convention for NODE.  */
+/* Dump in BUFFER a structure NODE of type TYPE in Ada syntax.  If NESTED is
+   true, it's an anonymous nested type.  SPC is the indentation level.  */
 
 static void
-dump_ada_structure (pretty_printer *buffer, tree node, tree type, int spc,
-		    bool display_convention)
+dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested,
+		    int spc)
 {
   const bool is_union = (TREE_CODE (node) == UNION_TYPE);
   char buf[32];
@@ -3268,45 +3167,35 @@ dump_ada_structure (pretty_printer *buff
     }
 
   INDENT (spc);
-  pp_string (buffer, "end record;");
+  pp_string (buffer, "end record");
 
   newline_and_indent (buffer, spc);
 
-  if (!display_convention)
+  /* We disregard the methods for anonymous nested types.  */
+  if (nested)
     return;
 
-  if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (type)))
+  if (has_nontrivial_methods (node))
     {
-      if (has_nontrivial_methods (TREE_TYPE (type)))
-	pp_string (buffer, "pragma Import (CPP, ");
-      else
-	pp_string (buffer, "pragma Convention (C_Pass_By_Copy, ");
+      pp_string (buffer, "with Import => True,");
+      newline_and_indent (buffer, spc + 5);
+      pp_string (buffer, "Convention => CPP");
     }
   else
-    pp_string (buffer, "pragma Convention (C, ");
-
-  package_prefix = false;
-  dump_ada_node (buffer, TREE_TYPE (type), type, spc, false, true);
-  package_prefix = true;
-  pp_right_paren (buffer);
+    pp_string (buffer, "with Convention => C_Pass_By_Copy");
 
   if (is_union)
     {
-      pp_semicolon (buffer);
-      newline_and_indent (buffer, spc);
-      pp_string (buffer, "pragma Unchecked_Union (");
-
-      dump_ada_node (buffer, TREE_TYPE (type), type, spc, false, true);
-      pp_right_paren (buffer);
+      pp_comma (buffer);
+      newline_and_indent (buffer, spc + 5);
+      pp_string (buffer, "Unchecked_Union => True");
     }
 
   if (bitfield_used)
     {
-      pp_semicolon (buffer);
-      newline_and_indent (buffer, spc);
-      pp_string (buffer, "pragma Pack (");
-      dump_ada_node (buffer, TREE_TYPE (type), type, spc, false, true);
-      pp_right_paren (buffer);
+      pp_comma (buffer);
+      newline_and_indent (buffer, spc + 5);
+      pp_string (buffer, "Pack => True");
       bitfield_used = false;
     }
 
@@ -3377,9 +3266,9 @@ dump_ads (const char *source_file,
       cpp_check = check;
       dump_ada_nodes (&pp, source_file);
 
-      /* Requires Ada 2005 syntax, so generate corresponding pragma.
+      /* We require Ada 2012 syntax, so generate corresponding pragma.
          Also, disable style checks since this file is auto-generated.  */
-      fprintf (f, "pragma Ada_2005;\npragma Style_Checks (Off);\n\n");
+      fprintf (f, "pragma Ada_2012;\npragma Style_Checks (Off);\n\n");
 
       /* Dump withs.  */
       dump_ada_withs (f);
@@ -3445,5 +3334,4 @@ dump_ada_specs (void (*collect_all_refs)
 
   /* Free various tables.  */
   free (source_refs);
-  delete overloaded_names;
 }

Reply via email to