aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-04-07 10:34:19 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2019-04-07 10:34:19 +0000
commit22be58735992f08020817687378d0004ac1ab680 (patch)
treef7685048ade4a559854dcf189e5653bf957c7bcc /gcc
parentdb9860b1dfce8d2ee7ada8defcff94315dce21c6 (diff)
downloadgcc-22be58735992f08020817687378d0004ac1ab680.zip
gcc-22be58735992f08020817687378d0004ac1ab680.tar.gz
gcc-22be58735992f08020817687378d0004ac1ab680.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog4
-rw-r--r--gcc/ada/libgnat/i-cexten.ads10
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-ada-spec.c30
4 files changed, 43 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 81b5db9..7e36b01 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2019-04-07 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/i-cexten.ads (CFloat_128): New type.
+
2019-03-22 Dmitriy Anisimkov <anisimko@adacore.com>
PR ada/89583
diff --git a/gcc/ada/libgnat/i-cexten.ads b/gcc/ada/libgnat/i-cexten.ads
index bf396a4..d0a0747 100644
--- a/gcc/ada/libgnat/i-cexten.ads
+++ b/gcc/ada/libgnat/i-cexten.ads
@@ -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;
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index f941403..c62395f 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index e3ad866..2ca8bda 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -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;
/* 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,
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, tree node, tree type, int spc,
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");