From: Ian Jackson Date: Fri, 20 Oct 2017 10:42:42 +0000 (+0100) Subject: libxl: Replace open-coded __attribute__ with NN() macro X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1f2c7894dfe3d52f33655de202bd474999a1637b;p=people%2Fiwj%2Fxen.git libxl: Replace open-coded __attribute__ with NN() macro Inspired by #define __nonnull(...) __attribute__((__nonnull__(__VA_ARGS__))) which is used in the hypervisor. These annotations may well become very common in libxl, so we choose a short name. Signed-off-by: Ian Jackson Release-acked-by: Julien Grall Acked-by: Wei Liu CC: Andrew Cooper --- diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 9fe472efe3..bfa95d8619 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -635,6 +635,7 @@ static inline int libxl__gc_is_real(const libxl__gc *gc) */ /* register ptr in gc for free on exit from outermost libxl callframe. */ +#define NN(...) __attribute__((nonnull(__VA_ARGS__))) #define NN1 __attribute__((nonnull(1))) /* It used to be legal to pass NULL for gc_opt. Get the compiler to * warn about this if any slip through. */ @@ -1711,7 +1712,7 @@ _hidden char *libxl__domid_to_name(libxl__gc *gc, uint32_t domid); _hidden char *libxl__cpupoolid_to_name(libxl__gc *gc, uint32_t poolid); _hidden int libxl__enum_from_string(const libxl_enum_string_table *t, - const char *s, int *e) __attribute__((nonnull(2))); + const char *s, int *e) NN(2); _hidden yajl_gen_status libxl__yajl_gen_asciiz(yajl_gen hand, const char *str);