Commit 22be5873 by Eric Botcazou Committed by Eric Botcazou

c-ada-spec.c (is_float128): New predicate extracted from...

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.
ada/
	* libgnat/i-cexten.ads (CFloat_128): New type.

From-SVN: r270188
parent db9860b1
2019-04-07 Eric Botcazou <ebotcazou@adacore.com>
* libgnat/i-cexten.ads (CFloat_128): New type.
2019-03-22 Dmitriy Anisimkov <anisimko@adacore.com> 2019-03-22 Dmitriy Anisimkov <anisimko@adacore.com>
PR ada/89583 PR ada/89583
......
...@@ -74,7 +74,7 @@ package Interfaces.C.Extensions is ...@@ -74,7 +74,7 @@ package Interfaces.C.Extensions is
for Signed_128'Alignment use unsigned_long_long'Alignment * 2; for Signed_128'Alignment use unsigned_long_long'Alignment * 2;
-- 128-bit floating-point type available on x86: -- 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 type Float_128 is record
low, high : unsigned_long_long; low, high : unsigned_long_long;
...@@ -82,6 +82,14 @@ package Interfaces.C.Extensions is ...@@ -82,6 +82,14 @@ package Interfaces.C.Extensions is
pragma Convention (C_Pass_By_Copy, Float_128); pragma Convention (C_Pass_By_Copy, Float_128);
for Float_128'Alignment use unsigned_long_long'Alignment * 2; 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 -- Types for bitfields
type Unsigned_1 is mod 2 ** 1; 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> 2019-04-05 David Malcolm <dmalcolm@redhat.com>
PR c/89985 PR c/89985
......
...@@ -2014,6 +2014,22 @@ dump_ada_enum_type (pretty_printer *buffer, tree node, int spc) ...@@ -2014,6 +2014,22 @@ dump_ada_enum_type (pretty_printer *buffer, tree node, int spc)
} }
} }
/* 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; static bool bitfield_used = false;
/* Recursively dump in BUFFER Ada declarations corresponding to NODE of type /* Recursively dump in BUFFER Ada declarations corresponding to NODE of type
...@@ -2067,7 +2083,13 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc, ...@@ -2067,7 +2083,13 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
break; break;
case COMPLEX_TYPE: 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; break;
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
...@@ -2078,11 +2100,7 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc, ...@@ -2078,11 +2100,7 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
break; break;
case REAL_TYPE: case REAL_TYPE:
if (TYPE_NAME (node) if (is_float128 (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")))
{ {
append_withs ("Interfaces.C.Extensions", false); append_withs ("Interfaces.C.Extensions", false);
pp_string (buffer, "Extensions.Float_128"); pp_string (buffer, "Extensions.Float_128");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment