From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x332.google.com with SMTP id q8so4263420wmo.5 for ; Fri, 13 Jan 2023 13:16:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=VuXurglGGlhaZRK0wOTfTdzUCsPLw0WGJflzGu0xJWk=; b=P3uNULuSbjSQxoLBY/AbM34hx9d9oxrq8tQWuUEf2UlbLjXDHKmKuk2FP+T62PfMld ujYeNu2ahboDJuW3DiLbUPvSLmyKjCR9h+/56f7Huhl8NzHTDqSdsDF9mGWGYwKvSLrz ANgPHycU1Phe1ZcGc/XAJrJLgse5lF8G2A0Dg0mlJsRz2o81Y1naBK+nxFnMcIzMSlCs CnCh8reoqNTBMEjflBkDLpxH/z5pDeUA2dxnsC9n8B2H/xjJMXsLZ5liIO9B0C2GfEWv FHXcT5+K196/B0CxCfAjKHIKpA6CNSH/Wga0jXP6Dr2FrKKZvLWYDPG2h++8mdpwfoJ8 CpSQ== 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-Google-Smtp-Source: AMrXdXtnbvWyEyn2XWfOA+6h0osbUr9KTijq5x/SEV9eU8AlZBJVoN26GXNeMZbVEhNH4h+z1jDj7A== 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) From: Eric Botcazou 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 Content-Type: multipart/mixed; boundary="nextPart1918039.PYKUYFuaPT" Content-Transfer-Encoding: 7Bit 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 List-Id: This is a multi-part message in MIME format. --nextPart1918039.PYKUYFuaPT Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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. -- Eric Botcazou --nextPart1918039.PYKUYFuaPT Content-Disposition: attachment; filename="p.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="utf-8"; name="p.diff" 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"); --nextPart1918039.PYKUYFuaPT--