svn commit: r287254 - head/sys/sys

Tijl Coosemans tijl at FreeBSD.org
Fri Aug 28 15:23:26 UTC 2015


On Fri, 28 Aug 2015 14:06:29 +0000 (UTC) "Pedro F. Giffuni" <pfg at FreeBSD.org> wrote:
> Author: pfg
> Date: Fri Aug 28 14:06:28 2015
> New Revision: 287254
> URL: https://svnweb.freebsd.org/changeset/base/287254
> 
> Log:
>   Be more GCC-friendly with attributes
>   
>   Being clang the default compiler, we were always giving precedence to
>   the __has_attribute check. Unfortunately clang generally doesn't support
>   the new attributes (alloc_size was briefly supported and then reverted)
>   so we were always doing both checks. Give the precedence to GCC as that is
>   the working case now.
>   
>   Do the same for  __has_builtin() for consistency.
> 
> Modified:
>   head/sys/sys/cdefs.h
> 
> Modified: head/sys/sys/cdefs.h
> ==============================================================================
> --- head/sys/sys/cdefs.h	Fri Aug 28 13:57:30 2015	(r287253)
> +++ head/sys/sys/cdefs.h	Fri Aug 28 14:06:28 2015	(r287254)
> @@ -237,12 +237,12 @@
>  #define	__aligned(x)	__attribute__((__aligned__(x)))
>  #define	__section(x)	__attribute__((__section__(x)))
>  #endif
> -#if __has_attribute(alloc_size) || __GNUC_PREREQ__(4, 3)
> +#if __GNUC_PREREQ__(4, 3) || __has_attribute(alloc_size)

I think you have to add underscores to the __has_attribute argument,
like __alloc_size__ here, because user code is allowed to use
alloc_size.


More information about the svn-src-all mailing list