diff options
author | pfg <pfg@FreeBSD.org> | 2017-01-06 16:16:30 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2017-01-06 16:16:30 +0000 |
commit | cda0a8add8c57e964a0e87127decd1b055460949 (patch) | |
tree | 3c41188429efb6ca96ec3b9ef4e83a9c366218aa /sys | |
parent | d7631278ca66862889a9567453e14c109ac600d7 (diff) | |
download | FreeBSD-src-cda0a8add8c57e964a0e87127decd1b055460949.zip FreeBSD-src-cda0a8add8c57e964a0e87127decd1b055460949.tar.gz |
MFC r310977:
Addition of clang nullability qualifiers.
Add two new qualifiers for use by the static checkers:
_Nonnull
The _Nonnull nullability qualifier indicates that null is not a meaningful
value for a value of the _Nonnull pointer type.
_Nullable
The _Nullable nullability qualifier indicates that a value of the
_Nullable pointer type can be null.
These were introduced in Clang 3.7. For more information, see:
http://clang.llvm.org/docs/AttributeReference.html#nonnull
We add these now without using them so that the GCC ports have time to
pick up the header change.
Hinted by: Android Bionic libc
Also seen in: Apple's Libc-1158.20.4
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/cdefs.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index dd18784..453b395 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -804,6 +804,14 @@ #endif /* + * Nullability qualifiers: currently only supported by Clang. + */ +#if !(defined(__clang__) && __has_feature(nullability)) +#define _Nonnull +#define _Nullable +#endif + +/* * Type Safety Checking * * Clang provides additional attributes to enable checking type safety |