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;
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;
+2019-04-07 Eric Botcazou <ebotcazou@adacore.com>
+
+ * 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-05 David Malcolm <dmalcolm@redhat.com>
PR c/89985
}
}
+/* 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
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:
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");