X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fcompiler%2Fcompiler.h;fp=ccan%2Fcompiler%2Fcompiler.h;h=562b29ec71cc13969ab0d111477608cdbc9d9c36;hb=ec95c3c5f795ce9019809fec5578fabb22ec8c56;hp=1bbb3b8b61c6cb4a0fd44ab39e5bf7505eaa91bd;hpb=f32693837ff62d438e52fd55f9318e0123fc1cfa;p=ccan diff --git a/ccan/compiler/compiler.h b/ccan/compiler/compiler.h index 1bbb3b8b..562b29ec 100644 --- a/ccan/compiler/compiler.h +++ b/ccan/compiler/compiler.h @@ -271,6 +271,19 @@ #define NON_NULL_ARGS(...) #endif +#if HAVE_ATTRIBUTE_RETURNS_NONNULL +/** + * RETURNS_NONNULL - specify that this function cannot return NULL. + * + * Mainly an optimization opportunity, but can also suppress warnings. + * + * Example: + * RETURNS_NONNULL char *my_copy(char *buf); + */ +#define RETURNS_NONNULL __attribute__((__returns_nonnull__)) +#else +#define RETURNS_NONNULL +#endif #if HAVE_ATTRIBUTE_SENTINEL /**