]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Small fix for -fdump-ada-spec
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 13 Jan 2023 21:11:32 +0000 (22:11 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 13 Jan 2023 21:15:20 +0000 (22:15 +0100)
This is needed to support the _Float32 and _Float64 types.

gcc/c-family/
* c-ada-spec.cc (is_float32): New function.
(is_float64): Likewise.
(is_float128): Tweak.
(dump_ada_node) <REAL_TYPE>: Call them to recognize more types.

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

index faf71742522bd063165c5464f4375ab1a600e6af..1e011d528256d5be6375161e5d045c3d585e4d02 100644 (file)
@@ -2030,7 +2030,39 @@ dump_ada_enum_type (pretty_printer *buffer, tree node, tree type, int spc)
     }
 }
 
-/* Return true if NODE is the __float128/_Float128 type.  */
+/* Return true if NODE is the _Float32/_Float32x type.  */
+
+static bool
+is_float32 (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, "_Float32") || id_equal (name, "_Float32x");
+}
+
+/* Return true if NODE is the _Float64/_Float64x type.  */
+
+static bool
+is_float64 (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, "_Float64") || id_equal (name, "_Float64x");
+}
+
+/* Return true if NODE is the __float128/_Float128/_Float128x type.  */
 
 static bool
 is_float128 (tree node)
@@ -2043,7 +2075,9 @@ is_float128 (tree node)
   if (IDENTIFIER_POINTER (name) [0] != '_')
     return false;
 
-  return id_equal (name, "__float128") || id_equal (name, "_Float128");
+  return id_equal (name, "__float128")
+        || id_equal (name, "_Float128")
+        || id_equal (name, "_Float128x");
 }
 
 static bool bitfield_used = false;
@@ -2132,7 +2166,17 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
       break;
 
     case REAL_TYPE:
-      if (is_float128 (node))
+      if (is_float32 (node))
+       {
+         pp_string (buffer, "Float");
+         break;
+       }
+      else if (is_float64 (node))
+       {
+         pp_string (buffer, "Long_Float");
+         break;
+       }
+      else if (is_float128 (node))
        {
          append_withs ("Interfaces.C.Extensions", false);
          pp_string (buffer, "Extensions.Float_128");