diff options
author | pfg <pfg@FreeBSD.org> | 2015-08-28 14:06:28 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2015-08-28 14:06:28 +0000 |
commit | 1b6f34126ead11e8584b6afc9e4dfeee68bb7a90 (patch) | |
tree | d46a8b889cd3ece4872c72f45928f071c78408c2 /sys/sys/cdefs.h | |
parent | 6a6ecc2475486cfbe02473a560f23b626f3777e3 (diff) | |
download | FreeBSD-src-1b6f34126ead11e8584b6afc9e4dfeee68bb7a90.zip FreeBSD-src-1b6f34126ead11e8584b6afc9e4dfeee68bb7a90.tar.gz |
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.
Diffstat (limited to 'sys/sys/cdefs.h')
-rw-r--r-- | sys/sys/cdefs.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index f9095e8..f523cf6 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -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) #define __alloc_size(x) __attribute__((__alloc_size__(x))) #else #define __alloc_size(x) #endif -#if __has_attribute(alloc_align) || __GNUC_PREREQ__(4, 9) +#if __GNUC_PREREQ__(4, 9) || __has_attribute(alloc_align) #define __alloc_align(x) __attribute__((__alloc_align__(x))) #else #define __alloc_align(x) @@ -382,7 +382,7 @@ #define __returns_twice #endif -#if __has_builtin(__builtin_unreachable) || __GNUC_PREREQ__(4, 6) +#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable) #define __unreachable() __builtin_unreachable() #else #define __unreachable() ((void)0) @@ -535,7 +535,7 @@ * well enough to use them in limited cases. */ #if defined(__GNUC_GNU_INLINE__) || defined(__GNUC_STDC_INLINE__) -#if __has_attribute(artificial) || __GNUC_PREREQ__(4, 3) +#if __GNUC_PREREQ__(4, 3) || __has_attribute(artificial) #define __gnu_inline __attribute__((__gnu_inline__, __artificial__)) #else #define __gnu_inline __attribute__((__gnu_inline__)) |