From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103821 invoked by alias); 15 May 2015 16:09:41 -0000 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 Received: (qmail 103805 invoked by uid 89); 15 May 2015 16:09:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 May 2015 16:09:39 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-18.uk.mimecast.lan; Fri, 15 May 2015 17:09:36 +0100 Received: from [10.2.206.56] ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 15 May 2015 17:09:36 +0100 Message-ID: <55561A40.4080202@arm.com> Date: Fri, 15 May 2015 16:12:00 -0000 From: Szabolcs Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "H.J. Lu" CC: "gcc-patches@gcc.gnu.org" , Gregor Richards , Rich Felker , Szabolcs Nagy Subject: Re: [PATCH 13/13] fix incompatible posix_memalign declaration on x86 References: <55354A4A.4060702@arm.com> <55354CC3.6070103@arm.com> In-Reply-To: X-MC-Unique: -zWn4aNeS0q69RYUgV78Ug-1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg01426.txt.bz2 On 15/05/15 16:05, H.J. Lu wrote: > On Mon, Apr 20, 2015 at 12:00 PM, Szabolcs Nagy w= rote: >> The posix_memalign declaration is incompatible with musl for C++, >> because of the exception specification. It also pollutes the >> namespace and lacks protection against a potential macro definition >> that is allowed by POSIX. The fix avoids source level namespace >> pollution but retains the dependency on the posix_memalign extern >> libc symbol. >> >> The fix is ugly, but it is not possible to correctly redeclare a >> libc function in a public gcc header for C++. >> >> >> gcc/Changelog: >> >> 2015-04-16 Szabolcs Nagy >> >> * config/i386/pmm_malloc.h (posix_memalign): Renamed to ... >> (__gcc_posix_memalign): This. Use posix_memalign as extern >> symbol only. >=20 > What does this try to achieve? Do you have a testcase which > fails before and passes with this patch? if posix_memalign is defined in stdlib.h according to posix then the exception specifier used in mm_malloc.h is incompatible: $ echo "#include " | ./x86_64-linux-musl-g++ -pedantic -c -xc+= + -D_POSIX_C_SOURCE=3D200809L - In file included from :1:0: /data/cross/x86_64-linux-musl/lib/gcc/x86_64-linux-musl/6.0.0/include/mm_ma= lloc.h:34:64: error: declaration of 'int posix_memalign(void**, size_t, size_t) throw ()' has a different exception specifier extern "C" int posix_memalign (void **, size_t, size_t) throw () ^ In file included from /data/cross/x86_64-linux-musl/lib/gcc/x86_64-linux-mu= sl/6.0.0/include/mm_malloc.h:27:0, from :1: /data/cross/x86_64-linux-musl/x86_64-linux-musl/include/stdlib.h:98:5: erro= r: from previous declaration 'int posix_memalign(void**, size_t, size_t)' int posix_memalign (void **, size_t, size_t); ^ however it seems without -pedantic there is no error anymore, the code is accepted even in standard conforming mode. (it used to be an error that could not be silenced). this means the patch is no longer critical for musl support.