[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-4.10] libxl: annotate s to be nonnull in libxl__enum_from_string



Hi,

On 20/10/17 11:47, Ian Jackson wrote:
Julien Grall writes ("Re: [Xen-devel] [PATCH for-4.10] libxl: annotate s to be 
nonnull in libxl__enum_from_string"):
Release-acked-by: Julien Grall <julien.grall@xxxxxxxxxx>

Thanks, I have applied this.  Not sure whether this followup is 4.10
material, but IMO it is if we would otherwise want to add another
open-coded __attribute__.

I would be ok with that. Wei do you have any opinion?

Cheers,


Ian.

 From b15e10f24a0d3c35033c26832e91aa14d40fc437 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date: Fri, 20 Oct 2017 11:42:42 +0100
Subject: [PATCH] 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 <Ian.Jackson@xxxxxxxxxxxxx>
CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>
---
  tools/libxl/libxl_internal.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 9fe472e..bfa95d8 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);

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.