This fixes a small issue that may be present when you use -fdump-ada-spec with 
very recent glibc releases.  Tested on Ubuntu 18.04, applied on the mainline.


2019-04-07  Eric Botcazou  <ebotca...@adacore.com>

c-family/
        * c-ada-spec.c (is_float128): New predicate extracted from...
        (dump_ada_node) <COMPLEX_TYPE>: Use it to recognize __cfloat128.
        <REAL_TYPE>: ...here.  Call it.


2019-04-07  Eric Botcazou  <ebotca...@adacore.com>

ada/
        * libgnat/i-cexten.ads (CFloat_128): New type.

-- 
Eric Botcazou
Index: ada/libgnat/i-cexten.ads
===================================================================
--- ada/libgnat/i-cexten.ads	(revision 270181)
+++ ada/libgnat/i-cexten.ads	(working copy)
@@ -74,7 +74,7 @@ package Interfaces.C.Extensions is
    for Signed_128'Alignment use unsigned_long_long'Alignment * 2;
 
    --  128-bit floating-point type available on x86:
-   --  typedef long_double float_128 __attribute__ ((mode (TF)));
+   --  typedef float float_128 __attribute__ ((mode (TF)));
 
    type Float_128 is record
       low, high : unsigned_long_long;
@@ -82,6 +82,14 @@ package Interfaces.C.Extensions is
    pragma Convention (C_Pass_By_Copy, Float_128);
    for Float_128'Alignment use unsigned_long_long'Alignment * 2;
 
+   --  128-bit complex floating-point type available on x86:
+   --  typedef _Complex float cfloat_128 __attribute__ ((mode (TC)));
+
+   type CFloat_128 is record
+      re, im : Float_128;
+   end record;
+   pragma Convention (C_Pass_By_Copy, CFloat_128);
+
    --  Types for bitfields
 
    type Unsigned_1 is mod 2 ** 1;
Index: c-family/c-ada-spec.c
===================================================================
--- c-family/c-ada-spec.c	(revision 270181)
+++ c-family/c-ada-spec.c	(working copy)
@@ -2014,6 +2014,22 @@ dump_ada_enum_type (pretty_printer *buff
     }
 }
 
+/* Return true if NODE is the __float128/_Float128 type.  */
+
+static bool
+is_float128 (tree node)
+{
+  if (!TYPE_NAME (node) || TREE_CODE (TYPE_NAME (node)) != TYPE_DECL)
+    return false;
+
+  tree name = DECL_NAME (TYPE_NAME (node));
+
+  if (IDENTIFIER_POINTER (name) [0] != '_')
+    return false;
+
+  return id_equal (name, "__float128") || id_equal (name, "_Float128");
+}
+
 static bool bitfield_used = false;
 
 /* Recursively dump in BUFFER Ada declarations corresponding to NODE of type
@@ -2067,7 +2083,13 @@ dump_ada_node (pretty_printer *buffer, t
       break;
 
     case COMPLEX_TYPE:
-      pp_string (buffer, "<complex>");
+      if (is_float128 (TREE_TYPE (node)))
+	{
+	  append_withs ("Interfaces.C.Extensions", false);
+	  pp_string (buffer, "Extensions.CFloat_128");
+	}
+      else
+	pp_string (buffer, "<complex>");
       break;
 
     case ENUMERAL_TYPE:
@@ -2078,11 +2100,7 @@ dump_ada_node (pretty_printer *buffer, t
       break;
 
     case REAL_TYPE:
-      if (TYPE_NAME (node)
-	  && TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
-	  && IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))) [0] == '_'
-	  && (id_equal (DECL_NAME (TYPE_NAME (node)), "_Float128")
-	      || id_equal (DECL_NAME (TYPE_NAME (node)), "__float128")))
+      if (is_float128 (node))
 	{
 	  append_withs ("Interfaces.C.Extensions", false);
 	  pp_string (buffer, "Extensions.Float_128");

Reply via email to