From owner-svn-src-all@freebsd.org Thu Aug 27 21:16:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 743FE9C4891 for ; Thu, 27 Aug 2015 21:16:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm18-vm0.bullet.mail.bf1.yahoo.com (nm18-vm0.bullet.mail.bf1.yahoo.com [98.139.213.138]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3398112F1 for ; Thu, 27 Aug 2015 21:16:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1440710154; bh=RWLk1injvQpKmV0d4APHD0mFOxy9/DSVp9TvmKwPFuY=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=HU3QyeZVmtWYEvsSFztlLH43G1xOxt3eR1OK0IrIDvwlVWcoA+lxGSTC/ZzEFxVOlVMUQkY5acnnnK6vGoOcUnOkgUo8YnHOH70PKN8z5aD0+Uav4Y2o6pZSuu0iZAXKuOIKb69Kfns+5quG9aIbW/S9QVT8e/Le82wMKwh38oxaGNXPXoxAqRmPdETOV30hLh/UbGADkhZC4fFwOka5rGY96NiaMDFUhbn2NKluV3mWHw4tnKmw+67yqjwUs4hNj7Arl9K/3oNL80i//x+iHoFLk788TbuPXzgPERBYPQZqs/Vv9ZCKaCsK6lSQ2sfmfEjcAZPF1UqATAk2NdOh1A== Received: from [98.139.170.180] by nm18.bullet.mail.bf1.yahoo.com with NNFMP; 27 Aug 2015 21:15:54 -0000 Received: from [98.139.211.203] by tm23.bullet.mail.bf1.yahoo.com with NNFMP; 27 Aug 2015 21:15:54 -0000 Received: from [127.0.0.1] by smtp212.mail.bf1.yahoo.com with NNFMP; 27 Aug 2015 21:15:54 -0000 X-Yahoo-Newman-Id: 320776.95142.bm@smtp212.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: bItXhFMVM1l7KIQsg77QTHd8d0o4A15ZsVWTzXOT5AZ1mau rKtNrEfVcaPO4z_Lk1Sd.qIrN_liVh8EwMZIiGD0wLlxSX.KmSNLgTqoxqaf 5.VCtfOKZI0Yt2F0w9UABra21f4qTZ7Qvg41V3k.y7zqxPcSTAYfe9rCAfVR cNmLtaT2NFwcPNOge2hXrb9136KQpNC2t9wSN41YSmVRjy_P12P45IGyNEkA 6A6UXXg3MTInH54tP0.2EpKCartQnBnFSL2p0x1Qi1A7BQpM1K6tLMH0wIvZ v3Rm7fwi8rfjIbKDFnDua2uK45LnX1qYFzdhB3XzhSuida3voUqLu8hS65lz R4MU9tronGh_8_jljYT63ANQHOvRfCes_1oRb5eHP9hAscMkklEXbz5uHKay Us2AIhsEmfMvPtFcQsVh1djWbTutNWc5teFhERe_d.uHtH.UtFylYnj5zsqO jABeVj0UXZqYHL0G_jLGFcNsYX66sM1MWDaBvX_rpIJR7dvkZSmDf8ZiMVV7 PdTtEmXZZKCULSEK0lzVhoMltVYWZ26PA X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r287206 - head/sys/sys To: Alexander Kabaev References: <201508271400.t7RE0Nbc071389@repo.freebsd.org> <55DF3519.1000106@FreeBSD.org> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Pedro Giffuni Message-ID: <55DF7E0E.6030007@FreeBSD.org> Date: Thu, 27 Aug 2015 16:15:58 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2015 21:16:01 -0000 On 08/27/15 12:41, Alexander Kabaev wrote: ... > The existing conditional is not working for lint and I had to shuffle it > under bigger > '#ifdef lint' protection. And other BSDs are just getting rid of lint. I have no opinion on that though. > ... Nor is the condition even well formed enough > to work with any > recent GCC and using __has_attribute in naked form is a mistake: > > % cat t.c > #if __has_attribute(alloc_size) > # error Has attribute > #endif > We are not really using __has_attribute() in it's naked form: we are following the official clang procedure: http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros In cdefs.h that corresponds to lines 42-44. ... > % mips-portbld-freebsd11.0-gcc --version > mips-portbld-freebsd11.0-gcc (FreeBSD Ports Collection for mips) 5.2.0 > Copyright (C) 2015 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > % mips-portbld-freebsd11.0-gcc -E t.c > # 1 "t.c" > # 1 "" > # 1 "" > # 1 "t.c" > t.c:2:3: error: #error Has attribute > # error Has attribute > ^ > > % gcc48 --version > gcc48 (FreeBSD Ports Collection) 4.8.5 > Copyright (C) 2015 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > % gcc48 -E t.c > # 1 "t.c" > # 1 "" > # 1 "" > # 1 "t.c" > t.c:1:20: error: missing binary operator before token "(" > #if __has_attribute(alloc_size) > > Modified: > head/sys/sys/cdefs.h > > .. > > > #if !__GNUC_PREREQ__(2, 95) > @@ -371,24 +382,12 @@ > #define __returns_twice > #endif > > -#if __has_attribute(alloc_size) || __GNUC_PREREQ__(4, 3) > -#define __alloc_size(x) __attribute__((__alloc_size__(x))) > -#else > -#define __alloc_size(x) > -#endif > - > > > This surely got through in GCC's case through the __GNUC_PREREQ__. > Of course gcc 4.2 has neither attribute but clang has alloc_size > so I wonder why it hasn't affected the lint builds. > > Just curiosity, the change is OK but it will be getting ugly if we > have to add all the new attributes in the !lint section. > > Regards, > > Pedro. > > > clang in tree does not have the slightest idea about the alloc_size > attribute, and that is why it worked, as demonstrated by the test below: > Ugh yes, it appears it's unsupported still. I though I had seen a bug report with a patch but I can't find it anymore. Grepping it in contrib doesn't show anything. ... > The original change to cdefs.h appears to be plain wrong. > Not really, it may appear some day. Pedro.