From: Eric Botcazou <botcazou@adacore.com>
To: gcc-patches@gcc.gnu.org
Subject: [c-family] Small fix for -fdump-ada-spec
Date: Fri, 13 Jan 2023 22:16:02 +0100 [thread overview]
Message-ID: <2211088.iZASKD2KPV@fomalhaut> (raw)
[-- Attachment #1: Type: text/plain, Size: 349 bytes --]
This is needed to support the _Float32 and _Float64 types.
Tested on x86-64/Linux, applied on the mainline.
2023-01-13 Eric Botcazou <ebotcazou@adacore.com>
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.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 2038 bytes --]
diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc
index faf71742522..1e011d52825 100644
--- a/gcc/c-family/c-ada-spec.cc
+++ b/gcc/c-family/c-ada-spec.cc
@@ -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");
next reply other threads:[~2023-01-13 21:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-13 21:16 Eric Botcazou [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-10-01 9:39 Eric Botcazou
2012-10-18 19:26 Eric Botcazou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2211088.iZASKD2KPV@fomalhaut \
--to=botcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).