From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id 913DF383FB97; Fri, 13 Jan 2023 21:15:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 913DF383FB97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673644557; bh=LGKMdbYCqvr0QrBEEcAK4ehhz1k1SJy9uMKfugleo7Y=; h=From:To:Subject:Date:From; b=kAX/e5eGF+wHIFHgYb9Ix81yf0XyG5S7co3x6aVPMZnikwtnLJ+ofwV217FivtyWD whihY9wz6QwbBFPDFBWbokqeN8xa6BBJ9ZCUksOq6irbDGPER4JKBPpCKwcSNQ7TDv y00rP+fNFERR82H3prjs38EVcLv8mEktSqnB0ZmI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Eric Botcazou To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5158] Small fix for -fdump-ada-spec X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/master X-Git-Oldrev: 4fa6845b4b29f33cc7ea3d8ff49b61bb1f460561 X-Git-Newrev: 6071e495e5802a8949d2b02df6aa31a5f40f2af9 Message-Id: <20230113211557.913DF383FB97@sourceware.org> Date: Fri, 13 Jan 2023 21:15:57 +0000 (GMT) List-Id: https://gcc.gnu.org/g:6071e495e5802a8949d2b02df6aa31a5f40f2af9 commit r13-5158-g6071e495e5802a8949d2b02df6aa31a5f40f2af9 Author: Eric Botcazou Date: Fri Jan 13 22:11:32 2023 +0100 Small fix for -fdump-ada-spec 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) : Call them to recognize more types. Diff: --- gcc/c-family/c-ada-spec.cc | 50 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) 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");