From owner-freebsd-current@freebsd.org Tue Jul 5 20:31:22 2016 Return-Path: Delivered-To: freebsd-current@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 C58C9B71AAD for ; Tue, 5 Jul 2016 20:31:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm32-vm0.bullet.mail.bf1.yahoo.com (nm32-vm0.bullet.mail.bf1.yahoo.com [72.30.239.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B8FA11D8 for ; Tue, 5 Jul 2016 20:31:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1467750264; bh=WqrPH5Bn6giVnluM+R0mq/lUKA6AFHY1vfwp1Vm6p1Q=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=MR/URyJVmvmjBqVFAaN18sTctCDKQFOfY8mfsps7Yccwb/EN9bXVq6Q0vUZ4EPlBi2TriP0pvooe19a2uHs4jVdBpbtSiDdsYPJUJANAbh6lVSw8Iv9l1NCj76fqSO7iCuJHWn0CTNcrQdV1ZV5bQdymFDc9TTD7v8Qzv7QEFc9A6ltzEXMldaxeNwfmCZIIiguZc22R1guezP5R6fwZyQTmdiXddPVK3vtnREGakzAMp9QInAnjK4kLfYHVDLK4OU/3hxUpwQJbfYxpka8Gz3wmWC7mjYOlROZjzNkJmQPTfmi4ry/vgw166fVT9WarrISv2xWlxMfgnm0uohN/OA== Received: from [98.139.215.143] by nm32.bullet.mail.bf1.yahoo.com with NNFMP; 05 Jul 2016 20:24:24 -0000 Received: from [68.142.230.75] by tm14.bullet.mail.bf1.yahoo.com with NNFMP; 05 Jul 2016 20:24:24 -0000 Received: from [127.0.0.1] by smtp232.mail.bf1.yahoo.com with NNFMP; 05 Jul 2016 20:24:24 -0000 X-Yahoo-Newman-Id: 202432.90731.bm@smtp232.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: rulgU90VM1mjuNTw7n2BZzOyBTL3dB0o3mviZ5ZPQcmibl3 kEW8D8xLYl3GHsMniOORGHpMBIvx4vHXwB7VVEc7lGaDgeeeujdSC30WnePr yOQfCmBXMpB9HaoP5MBN1qJxec0iWh15bkEkUbk4LXkGIb.ajMlVZo5mQDmJ JzuN73fXy0GHYM1RToqbaXjwDQaUw139hrqx0x1lB57t6jQo8RE1fwiROMPV 7p40qZcg7oKIMv_nvfD.wVEi9PVeKLaeLvNKyu3gyzBw16CYiliWk._xKGN2 8YZ51O_ge7A.kgQPC6nwHSJSWliUFm0F1I4EvSe8I6jVgMWOLxrtqymLZypt 41lVYuH2PkDCPdAHTvzAOW642B4C85vBeAA786NtOji9gvGEvO6fbzIzUat3 xO_vmM4ZnloH8ffs33HpRbUGov4Meo.QDOBVkVhihne9qMU8ALU3c9Oqi1tO mBu3r7zfcQ7aL1CRa_vzaHPRfhZ3SvLHhrR8u.Onz.3L9kup.s_F4XYrkg.W DAaVUR02yyFAq_VGX9ZvJa8kjEGTAazt6u1bfaPh81DRZHQ-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: clang 3.3/3.4 fails to build items that use stdlib.h because of __alloc_size attribute assigned to posix_memalign To: cem@freebsd.org, "Ngie Cooper (yaneurabeya)" References: <838A69F7-343D-4398-928B-E54FB966B574@gmail.com> Cc: Dimitry Andric , Roman Divacky , FreeBSD current From: Pedro Giffuni Message-ID: <3a288119-81f5-9199-b9d4-0f4649a7b8eb@FreeBSD.org> Date: Tue, 5 Jul 2016 15:24:28 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2016 20:31:22 -0000 Hmm ... On 07/05/16 15:14, Conrad Meyer wrote: > Whoops, missed reply-all the first time. > > It seems pretty clear that alloc_size (return value is a memory > allocation of size from parameter N) does not apply to posix_memalign, > because posix_memalign's allocation is stored via a pointer argument > rather than return value. > > https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes > > IMO the attribute should be removed from posix_memalign in stdlib.h > > Best, > Conrad > - I am wondering why it hasn't affected -current if it is wrong. - I am also wondering if we shouldn't just get rid of the attribute. I will answer to myself those doubts and fix the issue. Thanks! Pedro. > On Tue, Jul 5, 2016 at 1:07 PM, Ngie Cooper (yaneurabeya) > wrote: >> Hi, >> It looks like clang 3.3/3.4 from ports both don’t like __alloc_size being attached to posix_memalign. This only concerns me because it might make the src upgrade path from 9.3/10.3 to 11.0 painful. >> Thoughts on how this should be fixed or whether or not we care? >> Thanks, >> -Ngie >> >> $ cd usr.sbin/bhyve; make clean; script ts make all CC=clang34 >> ... >> In file included from /usr/src/svn/usr.sbin/bhyve/atkbdc.c:40: >> /usr/include/stdlib.h:176:6: error: '__alloc_size__' attribute only applies to functions that return a pointer [-Werror,-Wignored-attributes] >> __alloc_size(3); /* (ADV) */ >> ^ >> /usr/include/sys/cdefs.h:241:40: note: expanded from macro '__alloc_size' >> #define __alloc_size(x) __attribute__((__alloc_size__(x))) >> ^ >> 1 error generated. >> *** Error code 1 >> >> Stop. >> make: stopped in /usr/src/svn/usr.sbin/bhyve >> $ (set -x; clang33 --version; clang34 --version) >> + clang33 --version >> clang version 3.3 (tags/RELEASE_33/final) >> Target: x86_64-portbld-freebsd11.0 >> Thread model: posix >> + clang34 --version >> clang version 3.4.2 (tags/RELEASE_34/dot2-final) >> Target: x86_64-portbld-freebsd11.0 >> Thread model: posix >> >> 282988 pfg int posix_memalign(void **, size_t, size_t) __nonnull(1) __alloc_align(2) >> 281130 pfg __alloc_size(3); /* (ADV) */