summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2017-04-04 09:04:55 +0200
committerCorinna Vinschen <corinna@vinschen.de>2017-04-04 11:44:03 +0200
commit81c121c48739df247ade660659cd6672a9a2c7dd (patch)
treefab8cbfd5f5a7a24154f2461c1a02dfa479710ba
parent84a6dba57ed351a275889a3e8c87f566e3b3e508 (diff)
downloadcygnal-81c121c48739df247ade660659cd6672a9a2c7dd.tar.gz
cygnal-81c121c48739df247ade660659cd6672a9a2c7dd.tar.bz2
cygnal-81c121c48739df247ade660659cd6672a9a2c7dd.zip
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 [1] Also seen in: Apple's Libc-1158.20.4 [1] https://github.com/android/platform_bionic/commit/baa2a973bd776a51bb05a8590ab05d86eea7b321
-rw-r--r--newlib/libc/include/sys/cdefs.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index 68172ad65..ad2323264 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -645,6 +645,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