clang 3.3/3.4 fails to build items that use stdlib.h because of __alloc_size attribute assigned to posix_memalign

Ngie Cooper (yaneurabeya) yaneurabeya at gmail.com
Tue Jul 5 20:07:03 UTC 2016


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) */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20160705/9ef46eb1/attachment.sig>


More information about the freebsd-current mailing list