svn commit: r310977 - head/sys/sys

Pedro F. Giffuni pfg at FreeBSD.org
Sat Dec 31 15:58:16 UTC 2016


Author: pfg
Date: Sat Dec 31 15:58:15 2016
New Revision: 310977
URL: https://svnweb.freebsd.org/changeset/base/310977

Log:
  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

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==============================================================================
--- head/sys/sys/cdefs.h	Sat Dec 31 15:30:00 2016	(r310976)
+++ head/sys/sys/cdefs.h	Sat Dec 31 15:58:15 2016	(r310977)
@@ -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


More information about the svn-src-head mailing list