From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Tom Rini <trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Jon Loeliger <loeliger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] pylibfdt: Rework "avoid unused variable warning" lines
Date: Tue, 25 May 2021 13:27:18 +1000 [thread overview]
Message-ID: <YKxuloEGeFdDZCUY@yekko> (raw)
In-Reply-To: <20210524154910.30523-1-trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1594 bytes --]
On Mon, May 24, 2021 at 11:49:10AM -0400, Tom Rini wrote:
> Clang has -Wself-assign enabled by default under -Wall and so when
> building with -Werror we would get an error here. Inspired by Linux
> kernel git commit a21151b9d81a ("tools/build: tweak unused value
> workaround") make use of the fact that both Clang and GCC support
> casting to `void` as the method to note that something is intentionally
> unused.
>
> Signed-off-by: Tom Rini <trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
Applied, thanks.
> ---
> pylibfdt/libfdt.i | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
> index 3e09d3a7eedc..51ee8014d17c 100644
> --- a/pylibfdt/libfdt.i
> +++ b/pylibfdt/libfdt.i
> @@ -1009,7 +1009,7 @@ typedef uint32_t fdt32_t;
> }
> $1 = (void *)PyByteArray_AsString($input);
> fdt = $1;
> - fdt = fdt; /* avoid unused variable warning */
> + (void)fdt; /* avoid unused variable warning */
> }
>
> /* Some functions do change the device tree, so use void * */
> @@ -1020,7 +1020,7 @@ typedef uint32_t fdt32_t;
> }
> $1 = PyByteArray_AsString($input);
> fdt = $1;
> - fdt = fdt; /* avoid unused variable warning */
> + (void)fdt; /* avoid unused variable warning */
> }
>
> /* typemap used for fdt_get_property_by_offset() */
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2021-05-25 3:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-24 15:49 [PATCH] pylibfdt: Rework "avoid unused variable warning" lines Tom Rini
[not found] ` <20210524154910.30523-1-trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2021-05-25 3:27 ` David Gibson [this message]
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=YKxuloEGeFdDZCUY@yekko \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=loeliger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.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 read-only IMAP folder(s) and NNTP newsgroup(s).