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

Re: [Xen-devel] [PATCH] libxl: Enable -Wshadow



Ian Campbell writes ("[PATCH] libxl: Enable -Wshadow"):
> libxl: Enable -Wshadow.

Oh I just thought of this:

> diff -r 0547430886c5 -r 58ab3fb73d13 tools/libxc/xenctrl.h
> --- a/tools/libxc/xenctrl.h     Fri Sep 14 11:00:40 2012 +0100
> +++ b/tools/libxc/xenctrl.h     Fri Sep 14 12:09:43 2012 +0100
> @@ -236,10 +236,10 @@ typedef struct xc_hypercall_buffer xc_hy
>   * 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);             
>                 \
> +    ({  xc_hypercall_buffer_t _buf1;                                         
>                 \
> +        typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_buf2 = 
> &XC__HYPERCALL_BUFFER_NAME(_name); \
> +        (void)(&_buf1 == _buf2);                                             
>                 \
> +        (_buf2)->param_shadow ? (_buf2)->param_shadow : (_buf2);             
>                 \
>       })

This should be something like

> +    ({  xc_hypercall_buffer_t _hcbuf_buf1;

surely ?  As there is (and can be) no reasonable rule requiring users
of this macro to avoid using the name _val1 or whatever.

If we're doing -Wshadow then macros which introduce local variables
like this should give them names qualified somehow for the macro.

Ian.

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


 


Rackspace

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