diff options
author | kan <kan@FreeBSD.org> | 2015-08-27 14:00:23 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2015-08-27 14:00:23 +0000 |
commit | 0c147f0a462550ec2f9d349406c5cdb2b0de59da (patch) | |
tree | fc515027f572c4668ee4fcfb5ef928903f545cc4 /sys/sys/cdefs.h | |
parent | 7da6a7a55a185157c5aa27f2f62516852afdfa05 (diff) | |
download | FreeBSD-src-0c147f0a462550ec2f9d349406c5cdb2b0de59da.zip FreeBSD-src-0c147f0a462550ec2f9d349406c5cdb2b0de59da.tar.gz |
Repair sys/cdefs.h enough to be usable with GCC 5.x
The __alloc_size and __alloc_align need to be defined to
nothingness for lint, but the existing check is deficient
and allows attributes with working __has_attrubute() to
slip through.
Diffstat (limited to 'sys/sys/cdefs.h')
-rw-r--r-- | sys/sys/cdefs.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 5b3d2cf..f9095e8 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -39,7 +39,6 @@ /* * Testing against Clang-specific extensions. */ - #ifndef __has_attribute #define __has_attribute(x) 0 #endif @@ -212,6 +211,8 @@ #define __unused #define __packed #define __aligned(x) +#define __alloc_align(x) +#define __alloc_size(x) #define __section(x) #define __weak_symbol #else @@ -236,6 +237,16 @@ #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((__section__(x))) #endif +#if __has_attribute(alloc_size) || __GNUC_PREREQ__(4, 3) +#define __alloc_size(x) __attribute__((__alloc_size__(x))) +#else +#define __alloc_size(x) +#endif +#if __has_attribute(alloc_align) || __GNUC_PREREQ__(4, 9) +#define __alloc_align(x) __attribute__((__alloc_align__(x))) +#else +#define __alloc_align(x) +#endif #endif /* lint */ #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 - #if __has_builtin(__builtin_unreachable) || __GNUC_PREREQ__(4, 6) #define __unreachable() __builtin_unreachable() #else #define __unreachable() ((void)0) #endif -#if __has_attribute(alloc_align) || __GNUC_PREREQ__(4, 9) -#define __alloc_align(x) __attribute__((__alloc_align__(x))) -#else -#define __alloc_align(x) -#endif - /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) #define __func__ NULL |