[PATCH 2/2] Add _X_NONNULL macro to annotate when a function expects arguments to be non-null

Jeremy Huddleston jeremyhu at apple.com
Wed Apr 27 17:25:53 PDT 2011


This will allow with compiler optimization and better static analysis.

Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
---

Alan, what SunCC magic needs to go here?

 Xfuncproto.h.in |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in
index 88d91c0..39ca3b2 100644
--- a/Xfuncproto.h.in
+++ b/Xfuncproto.h.in
@@ -122,6 +122,12 @@ in this Software without prior written authorization from The Open Group.
 # define _X_ATTRIBUTE_PRINTF(x,y)
 #endif
 
+#if defined(__GNUC__) &&  ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
+#define _X_NONNULL(args...)  __attribute__((nonnull(args)))
+#else
+#define _X_NONNULL(...)  /* */
+#endif
+
 #if defined(__GNUC__) &&  ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
 #define _X_UNUSED  __attribute__((__unused__))
 #else
-- 
1.7.4.1




More information about the xorg-devel mailing list