From patchwork Wed Feb 28 14:31:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 879160 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-474016-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="pLikOoJx"; 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 3zryfy0KNcz9s06 for ; Thu, 1 Mar 2018 01:31:21 +1100 (AEDT) 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=VMxuUgcoPtJmsyC3 lxMQyiNmwlSpd6tRoIYaH4QTVMd7y8yzUamP8g+aanDqaHzCgyazi5YtlnI5EiGJ zUgw9j6vxn790wetvkf1qqLRz8NIxjYaLgpP/ejfxY24TN3bXNs0+RHdIWYLxfg8 WF6wMemEqgn2VoRGT5PSgGzQbnk= 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=yQkZQfTIBoD2W0eXcR0tOu NaXEE=; b=pLikOoJxxj/40cbfOgNjV6GomCtmoB23nkPucKCdvpkDDqO2Z8Lg3L LtkwfKIpid4jsIRUYe6GEAUfc6CGMMCF4/Pv2eG2qjna7v43Ng9b3jJOa2VHwoTa 1uSO2Tz9bGbSCcNDuZhkMtyiPgvI49jz2xl6ap8XMoUWvM6aRtAns= Received: (qmail 130992 invoked by alias); 28 Feb 2018 14:31:14 -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 130982 invoked by uid 89); 28 Feb 2018 14:31:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.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.2 spammy=_Float128, __float128, _float128 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; Wed, 28 Feb 2018 14:31:12 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 23E3A8139B for ; Wed, 28 Feb 2018 15:31:09 +0100 (CET) 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 W3bDQOhmVl25 for ; Wed, 28 Feb 2018 15:31:09 +0100 (CET) Received: from arcturus.home (ADijon-653-1-18-212.w90-39.abo.wanadoo.fr [90.39.175.212]) (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 0166981399 for ; Wed, 28 Feb 2018 15:31:08 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Generate minimally correct C/C++ binding for stddef.h Date: Wed, 28 Feb 2018 15:31:07 +0100 Message-ID: <11793214.ApSfGmZ2J8@arcturus.home> MIME-Version: 1.0 This was broken when the default was changed to C11/C++11. Tested on x86_64-suse-linux, applied on the mainline. 2018-02-28 Eric Botcazou ada/ * libgnat/i-cexten.ads (Float_128): New type. c-family/ * c-ada-spec.c (dump_ada_node) : New case. : Deal specifically with _Float128/__float128. Index: ada/libgnat/i-cexten.ads =================================================================== --- ada/libgnat/i-cexten.ads (revision 257983) +++ ada/libgnat/i-cexten.ads (working copy) @@ -72,6 +72,15 @@ package Interfaces.C.Extensions is pragma Convention (C_Pass_By_Copy, Signed_128); 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))); + + type Float_128 is record + low, high : unsigned_long_long; + end record; + pragma Convention (C_Pass_By_Copy, Float_128); + for Float_128'Alignment use unsigned_long_long'Alignment * 2; + -- Types for bitfields type Unsigned_1 is mod 2 ** 1; Index: c-family/c-ada-spec.c =================================================================== --- c-family/c-ada-spec.c (revision 258067) +++ c-family/c-ada-spec.c (working copy) @@ -2126,6 +2126,7 @@ dump_ada_node (pretty_printer *buffer, tree node, pp_string (buffer, "--- unexpected node: TREE_VEC"); return 0; + case NULLPTR_TYPE: case VOID_TYPE: if (package_prefix) { @@ -2151,8 +2152,20 @@ dump_ada_node (pretty_printer *buffer, tree node, dump_ada_enum_type (buffer, node, type, spc, true); 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"))) + { + append_withs ("Interfaces.C.Extensions", false); + pp_string (buffer, "Extensions.Float_128"); + break; + } + /* fallthrough */ + case INTEGER_TYPE: - case REAL_TYPE: case FIXED_POINT_TYPE: case BOOLEAN_TYPE: if (TYPE_NAME (node)) @@ -2233,9 +2246,8 @@ dump_ada_node (pretty_printer *buffer, tree node, { if (TREE_CODE (node) == POINTER_TYPE && TREE_CODE (TREE_TYPE (node)) == INTEGER_TYPE - && !strcmp - (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME - (TREE_TYPE (node)))), "char")) + && id_equal (DECL_NAME (TYPE_NAME (TREE_TYPE (node))), + "char")) { if (!name_only) pp_string (buffer, "new ");