This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH 6/8] Addition of clang nullability qualifiers.
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Cc: pfg <pfg at FreeBSD dot org>
- Date: Tue, 4 Apr 2017 09:04:57 +0200
- Subject: [PATCH 6/8] Addition of clang nullability qualifiers.
- Authentication-results: sourceware.org; auth=none
- References: <1491289499-30548-1-git-send-email-sebastian.huber@embedded-brains.de>
From: pfg <pfg@FreeBSD.org>
For consistency with the qualifiers added in r310977, define a new
qualifier _Null_unspecified which is also defined in clang 3.7+.
Add two new macros:
__NULLABILITY_PRAGMA_PUSH
__NULLABILITY_PRAGMA_POP
These are for use in headers when we want avoid noisy warnings if
some pointers are left without nullability annotations.
These are added with way ahead of their first use to teach the GCC
ports headers of their existance before their first use.
---
newlib/libc/include/sys/cdefs.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index 679425a..fa1692c 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -634,6 +634,13 @@
#if !(defined(__clang__) && __has_feature(nullability))
#define _Nonnull
#define _Nullable
+#define _Null_unspecified
+#define __NULLABILITY_PRAGMA_PUSH
+#define __NULLABILITY_PRAGMA_POP
+#else
+#define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"")
+#define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop")
#endif
/*
--
1.8.4.5