diff options
author | Ian Campbell <Ian.Campbell@citrix.com> | 2012-09-17 11:17:00 +0100 |
---|---|---|
committer | Ian Campbell <Ian.Campbell@citrix.com> | 2012-09-17 11:17:00 +0100 |
commit | 4de237a42e0b79c87aeaf37792be6458b5437f7b (patch) | |
tree | 0f1b0d38881aee575bdcd3ee65a0ebe500db5f81 /tools/libxc/xenctrl.h | |
parent | 5e61076e8f6e48856dacbd65499d6cb69d31976b (diff) | |
download | xen-4de237a42e0b79c87aeaf37792be6458b5437f7b.tar.gz xen-4de237a42e0b79c87aeaf37792be6458b5437f7b.tar.bz2 xen-4de237a42e0b79c87aeaf37792be6458b5437f7b.zip |
libxl: Enable -Wshadow.
It was convenient to invent $(CFLAGS_LIBXL) to do this.
Various renamings to avoid shadowing standard functions:
- index(3)
- listen(2)
- link(2)
- abort(3)
- abs(3)
Reduced the scope of some variables to avoid conflicts.
Change to libxc is due to the nested hypercall buf macros in
set_xen_guest_handle (used in libxl) using the same local private vars.
Build tested only.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxc/xenctrl.h')
-rw-r--r-- | tools/libxc/xenctrl.h | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 3254537dce..7eb57430c3 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -235,11 +235,13 @@ typedef struct xc_hypercall_buffer xc_hypercall_buffer_t; /* * Returns the hypercall_buffer associated with a variable. */ -#define HYPERCALL_BUFFER(_name) \ - ({ xc_hypercall_buffer_t _val1; \ - typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_val2 = &XC__HYPERCALL_BUFFER_NAME(_name); \ - (void)(&_val1 == _val2); \ - (_val2)->param_shadow ? (_val2)->param_shadow : (_val2); \ +#define HYPERCALL_BUFFER(_name) \ + ({ xc_hypercall_buffer_t _hcbuf_buf1; \ + typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_hcbuf_buf2 = \ + &XC__HYPERCALL_BUFFER_NAME(_name); \ + (void)(&_hcbuf_buf1 == _hcbuf_buf2); \ + (_hcbuf_buf2)->param_shadow ? \ + (_hcbuf_buf2)->param_shadow : (_hcbuf_buf2); \ }) #define HYPERCALL_BUFFER_INIT_NO_BOUNCE .dir = 0, .sz = 0, .ubuf = (void *)-1 @@ -273,11 +275,12 @@ typedef struct xc_hypercall_buffer xc_hypercall_buffer_t; * Get the hypercall buffer data pointer in a form suitable for use * directly as a hypercall argument. */ -#define HYPERCALL_BUFFER_AS_ARG(_name) \ - ({ xc_hypercall_buffer_t _val1; \ - typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_val2 = HYPERCALL_BUFFER(_name); \ - (void)(&_val1 == _val2); \ - (unsigned long)(_val2)->hbuf; \ +#define HYPERCALL_BUFFER_AS_ARG(_name) \ + ({ xc_hypercall_buffer_t _hcbuf_arg1; \ + typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_hcbuf_arg2 = \ + HYPERCALL_BUFFER(_name); \ + (void)(&_hcbuf_arg1 == _hcbuf_arg2); \ + (unsigned long)(_hcbuf_arg2)->hbuf; \ }) /* @@ -285,12 +288,13 @@ typedef struct xc_hypercall_buffer xc_hypercall_buffer_t; * data pointer has been correctly allocated. */ #undef set_xen_guest_handle -#define set_xen_guest_handle(_hnd, _val) \ - do { \ - xc_hypercall_buffer_t _val1; \ - typeof(XC__HYPERCALL_BUFFER_NAME(_val)) *_val2 = HYPERCALL_BUFFER(_val); \ - (void) (&_val1 == _val2); \ - set_xen_guest_handle_raw(_hnd, (_val2)->hbuf); \ +#define set_xen_guest_handle(_hnd, _val) \ + do { \ + xc_hypercall_buffer_t _hcbuf_hnd1; \ + typeof(XC__HYPERCALL_BUFFER_NAME(_val)) *_hcbuf_hnd2 = \ + HYPERCALL_BUFFER(_val); \ + (void) (&_hcbuf_hnd1 == _hcbuf_hnd2); \ + set_xen_guest_handle_raw(_hnd, (_hcbuf_hnd2)->hbuf); \ } while (0) /* Use with set_xen_guest_handle in place of NULL */ |