diff options
author | pfg <pfg@FreeBSD.org> | 2015-03-29 03:16:52 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2015-03-29 03:16:52 +0000 |
commit | bb533aa7de070c81cd440f3c7c42d245579adf54 (patch) | |
tree | ff1533e40c70bdbc2ec6e160af07ba8edc59f71b /sys/sys/cdefs.h | |
parent | 072137beb0875b28d46247857713d776117bc3f0 (diff) | |
download | FreeBSD-src-bb533aa7de070c81cd440f3c7c42d245579adf54.zip FreeBSD-src-bb533aa7de070c81cd440f3c7c42d245579adf54.tar.gz |
cdefs.h: Fix macros for pre-C99 compilers.
Older compilers, and compatibility modes, may not support variadic macros.
I normally wouldn't go out of my way to support those old compilers but
there is a prescendent in other system headers for using the same macro
multiple times, and the solution (although non-elegant IMHO) works.
Requested by: bde
Solution by: tijl
Diffstat (limited to 'sys/sys/cdefs.h')
-rw-r--r-- | sys/sys/cdefs.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 95f3699..fa0caa5 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -359,9 +359,11 @@ #endif #if __GNUC_PREREQ__(3, 3) -#define __nonnull(...) __attribute__((__nonnull__(__VA_ARGS__))) +#define __nonnull(x) __attribute__((__nonnull__(x))) +#define __nonnull_all __attribute__((__nonnull__)) #else -#define __nonnull(...) +#define __nonnull(x) +#define __nonnull_all #endif #if __GNUC_PREREQ__(3, 4) @@ -379,9 +381,9 @@ #endif #if __has_attribute(alloc_size) || __GNUC_PREREQ__(4, 3) -#define __alloc_size(...) __attribute__((__alloc_size__(__VA_ARGS__))) +#define __alloc_size(x) __attribute__((__alloc_size__(x))) #else -#define __alloc_size(...) +#define __alloc_size(x) #endif /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ |