From patchwork Fri Jan 13 21:16:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 43613 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp485525wrt; Fri, 13 Jan 2023 13:17:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXs5kN19TGm7SLf7hUCjIvY4E4uo94IWLk13mONoRWU7/CuRtRUQH6nv2r3a/WCSquTiPPfJ X-Received: by 2002:a50:fe81:0:b0:479:96c2:61be with SMTP id d1-20020a50fe81000000b0047996c261bemr1092716edt.10.1673644622593; Fri, 13 Jan 2023 13:17:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673644622; cv=none; d=google.com; s=arc-20160816; b=X/T/33x2ya6WgjqZ/L38l0WdsJ0I9JADcfZyClmdJZLBOzLZQngpljqHVyCS1Eb8tB Zwps7C6t+N6l1TOY7L7/jIJ1KgX8W2yQ38WKoagNL/XE7fub9xU04GHq9F1pginhjsbE 9q+65Q8seTiV2UiVJFZ6gVs7uk2f33CEZtXUYx8t6pGEXKPkCM4XHnyxRXRb7pWxJQFD 2+kDnZDzNUB/GWkjnnUnZPCPiih0MAIivjyqbYOr8H3esRtwMd5jRFB6PCRNH5JVEoD1 1Iw7BNLsLOMc8gNLaaSerfGJuIXbpKKXw3gfxuKlXd2E7sb47TLV+VBYkc5GPKuf/AuD dptA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=VuXurglGGlhaZRK0wOTfTdzUCsPLw0WGJflzGu0xJWk=; b=R+XumghxyJuPzic1GhlZ7ZH94BFanBBpW7081oBKg5fuQBbd9v3bTcOM2naq7DuSKg rV7ONwYgmN33qxapejDB4EqdKKL3sMzjdrJVkGZmLPzq/OsvlX8WSyGKc9f+b3S6ZEJM QJwhXG4e4DVyV3xKCfj8DVbiLgLxptVTLsCnFVLj+KZMg1VCTkmcEanfPJNMetsIpNh2 jAJJOIlN+nksqn+sL+CckgMk0vgHelBQnkDdlzYXkWQspNZPPUKs/6zW25VpgNRA+zG2 AR6wiwEhoxmusxZikUKYfAeLzzAdQrx8kWo5VHw6USivbAcBvhKQVsCRjdGKwlQzlJjy HIog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=TWhdvv+Y; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b5-20020a056402084500b0048bfc2985basi26045606edz.304.2023.01.13.13.17.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 13:17:02 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=TWhdvv+Y; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 523AE38654B0 for ; Fri, 13 Jan 2023 21:16:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 523AE38654B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673644609; bh=VuXurglGGlhaZRK0wOTfTdzUCsPLw0WGJflzGu0xJWk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=TWhdvv+YQzL6rHtA+8x9lZyp5/+FQBRQze7koLKdcxjRVgopc2xcFLHuhgqXAN+aB o75sqJbgaKwOIZ0jm4YcXdGwpxYMA60YueSupWHHTuDbnonEgx+9RKK2ZesSrWo/dX da2nXmUYN6boBsWBcE+jp8VoSjgHDPBeS9RAD3XI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 2BDB138493CB for ; Fri, 13 Jan 2023 21:16:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2BDB138493CB Received: by mail-wm1-x332.google.com with SMTP id q8so4263420wmo.5 for ; Fri, 13 Jan 2023 13:16:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VuXurglGGlhaZRK0wOTfTdzUCsPLw0WGJflzGu0xJWk=; b=hzcJ0MKxTgm2jk4KEpxWPqGg5nq5ud1jXrkmsY3ikV5QCJd5E3TZOYvETyMO/acuxx MJt4jGmV8mNNl/jqIA3Sk0vflIH9dTkcdfJsaR33irfGxpy5dV0lQHya5VPnbVpZVuCo pIfng8nlNGm1d99GC0M63/M2tB5z/vIT08oVkcZreZBMg4M1cZcljvKKHxfRHetyy+dL DZlT+NfGp/Z5s/HHd1qGgi+HMrRtoAvbX6Br/Glg0m8haZDwfcn31nTD0/EnkGRG5BX2 fMMaE/fbCicYuPtT/TXSDyrAp77eNN9YBU6ALoss0Uy2v9GZLKhF9zuxordJVQE5mZW0 CfAQ== X-Gm-Message-State: AFqh2kqfDTQFT/ISuKCe5ysCDAxCUcqoV2s5V1/qXCUmwIJYJltnUhzh YhZe5g+d0YEc+Ehyddu+QJBXFl5jyuJULVUs X-Received: by 2002:a05:600c:2292:b0:3d3:50b9:b1a1 with SMTP id 18-20020a05600c229200b003d350b9b1a1mr950005wmf.1.1673644563763; Fri, 13 Jan 2023 13:16:03 -0800 (PST) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id p9-20020a05600c358900b003cffd3c3d6csm28541228wmq.12.2023.01.13.13.16.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 13:16:03 -0800 (PST) X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [c-family] Small fix for -fdump-ada-spec Date: Fri, 13 Jan 2023 22:16:02 +0100 Message-ID: <2211088.iZASKD2KPV@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Eric Botcazou via Gcc-patches From: Eric Botcazou Reply-To: Eric Botcazou Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754943583977039659?= X-GMAIL-MSGID: =?utf-8?q?1754943583977039659?= This is needed to support the _Float32 and _Float64 types. Tested on x86-64/Linux, applied on the mainline. 2023-01-13 Eric Botcazou 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 --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");