summaryrefslogtreecommitdiff
path: root/Xfuncproto.h.in
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-04-27 17:25:53 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-04-28 18:23:56 -0700
commit217d1dae0093ccaaac59a4fa42000e732492cb66 (patch)
treeb441298358f3ae97fb5a2c7041c8b3b47af674e0 /Xfuncproto.h.in
parent6648db8f910fb74c100cf24436bf0df12cba7fd7 (diff)
Add _X_NONNULL macro to annotate when a function expects arguments to be non-null
This will allow with compiler optimization and better static analysis. Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'Xfuncproto.h.in')
-rw-r--r--Xfuncproto.h.in6
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