]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
libxl: Replace open-coded __attribute__ with NN() macro
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 20 Oct 2017 10:42:42 +0000 (11:42 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 23 Oct 2017 14:23:32 +0000 (15:23 +0100)
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 <Ian.Jackson@eu.citrix.com>
Release-acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
tools/libxl/libxl_internal.h

index 9fe472efe3c8588152196517d02895c722ea7a45..bfa95d861901ffcc42ac00f62ea71700236cbbe5 100644 (file)
@@ -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);