From: Ian Jackson <Ian.Jackson@eu.citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH] libxl: Enable -Wshadow
Date: Fri, 14 Sep 2012 15:42:20 +0100 [thread overview]
Message-ID: <20563.16972.124870.221950@mariner.uk.xensource.com> (raw)
In-Reply-To: <58ab3fb73d13e250f334.1347620998@cosworth.uk.xensource.com>
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.
next prev parent reply other threads:[~2012-09-14 14:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-14 11:09 [PATCH] libxl: Enable -Wshadow Ian Campbell
2012-09-14 14:41 ` Ian Jackson
2012-09-14 14:42 ` Ian Jackson [this message]
2012-09-14 15:34 ` Ian Campbell
2012-09-14 15:41 ` Ian Jackson
2012-09-17 10:18 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20563.16972.124870.221950@mariner.uk.xensource.com \
--to=ian.jackson@eu.citrix.com \
--cc=ian.campbell@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).