From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20185 invoked by alias); 16 Jul 2012 13:58:55 -0000 Received: (qmail 20177 invoked by uid 22791); 16 Jul 2012 13:58:54 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-wi0-f179.google.com (HELO mail-wi0-f179.google.com) (209.85.212.179) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Jul 2012 13:58:32 +0000 Received: by wibhq4 with SMTP id hq4so2295367wib.8 for ; Mon, 16 Jul 2012 06:58:31 -0700 (PDT) Received: by 10.180.107.103 with SMTP id hb7mr18508397wib.3.1342447110960; Mon, 16 Jul 2012 06:58:30 -0700 (PDT) Received: from [192.168.20.187] ([217.170.8.39]) by mx.google.com with ESMTPS id el6sm21671516wib.8.2012.07.16.06.58.29 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jul 2012 06:58:29 -0700 (PDT) Message-ID: <50041E04.8070009@free.fr> Date: Mon, 16 Jul 2012 13:58:00 -0000 From: Duncan Sands User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Tristan Gingold CC: gcc-patches@gcc.gnu.org Subject: Re: [Ada] Ease interface with builtins that returns void * References: <20120716131054.GA5416@adacore.com> <50041411.1050302@free.fr> <50041604.20702@free.fr> <5BFC03FE-26B2-4932-8BAD-29380D188370@adacore.com> In-Reply-To: <5BFC03FE-26B2-4932-8BAD-29380D188370@adacore.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-07/txt/msg00653.txt.bz2 Hi Tristan, >> indeed, for two years already. Is there any reason not to do this for all >> functions, rather than just limiting it to builtins? > > I don't understand what do you mean. We need to do this implicit conversion for builtins because they are known by the compiler. Which other functions (that aren't builtins) are you referring to ? all of them! First off, the LLVM optimizers do a better job if an argument of a user defined function that is really a pointer is declared as such, rather than declared as an integer then cast to a pointer before being used. I don't know if the GCC optimizers are sensitive to this too. Also, the LLVM optimizers recognize some standard library functions that the gcc optimizers do not, but fail to recognize them when called from Ada because they have the wrong prototype: an integer rather than a pointer argument. Finally I would argue that as System.Address is really a pointer, playing pretty much exactly the same role as void* in C, it is more philosophically correct to express it as a void*. That said, it should probably just be declared as a pointer in the System package rather than doing all this mucking around in the gcc interface. Ciao, Duncan.