From patchwork Sun Apr 7 10:35:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1080001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-498929-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="oWxysoJ8"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44cVLh2vgLz9sPJ for ; Sun, 7 Apr 2019 20:35:18 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=wbxG+mHkPGYMMKVU kCQ0bFNzoJPrTTp54WGhKWMuJV3Xg1NJ84ZTMGjGAsNnJrXUxq+x9oQLWc8ft3Wa kgif0Ey006ZTWeeAgPnwnWQmkBGI9I45QAcHiigb4z2Rbp0uRvVJAhGFnD05TJwE bWCppWMNG2ajwpSDRl/c55CaMdw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=DWuerZpZm2Qgs4qaUON9Ms 0ExVk=; b=oWxysoJ80cSWoCVUAVqYjkc1flKU/E6V4pQ5d+BFtRAWEuH7+gykXT uQTHRNuZB7sFlvcBQVGh7r936HHyKxYwvF+y8RnKYuKnJupYpK06lboimKAaaWyt HgckFOhjxdTIFzKaODBxtNe6rigdH4SnRdXmPNmIbhYyqaQ0ZVrro= Received: (qmail 86731 invoked by alias); 7 Apr 2019 10:35:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 86639 invoked by uid 89); 7 Apr 2019 10:35:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=mod, sk:ebotcaz, U*ebotcazou X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 07 Apr 2019 10:35:08 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 390A38138A for ; Sun, 7 Apr 2019 12:35:06 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nv41E47xxTWR for ; Sun, 7 Apr 2019 12:35:06 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 05F0081380 for ; Sun, 7 Apr 2019 12:35:05 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Small -fdump-ada-spec fix for recent glibc Date: Sun, 07 Apr 2019 12:35:03 +0200 Message-ID: <26807043.i5gRutv0AG@polaris> MIME-Version: 1.0 This fixes a small issue that may be present when you use -fdump-ada-spec with very recent glibc releases. Tested on Ubuntu 18.04, applied on the mainline. 2019-04-07 Eric Botcazou c-family/ * c-ada-spec.c (is_float128): New predicate extracted from... (dump_ada_node) : Use it to recognize __cfloat128. : ...here. Call it. 2019-04-07 Eric Botcazou ada/ * libgnat/i-cexten.ads (CFloat_128): New type. Index: ada/libgnat/i-cexten.ads =================================================================== --- ada/libgnat/i-cexten.ads (revision 270181) +++ ada/libgnat/i-cexten.ads (working copy) @@ -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; Index: c-family/c-ada-spec.c =================================================================== --- c-family/c-ada-spec.c (revision 270181) +++ c-family/c-ada-spec.c (working copy) @@ -2014,6 +2014,22 @@ dump_ada_enum_type (pretty_printer *buff } } +/* 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, t break; case COMPLEX_TYPE: - pp_string (buffer, ""); + if (is_float128 (TREE_TYPE (node))) + { + append_withs ("Interfaces.C.Extensions", false); + pp_string (buffer, "Extensions.CFloat_128"); + } + else + pp_string (buffer, ""); break; case ENUMERAL_TYPE: @@ -2078,11 +2100,7 @@ dump_ada_node (pretty_printer *buffer, t 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");