* [PATCH] pylibfdt: Rework "avoid unused variable warning" lines
@ 2021-05-24 15:49 Tom Rini
[not found] ` <20210524154910.30523-1-trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Tom Rini @ 2021-05-24 15:49 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
Cc: Simon Glass, David Gibson, Jon Loeliger
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>
---
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() */
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <20210524154910.30523-1-trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH] pylibfdt: Rework "avoid unused variable warning" lines [not found] ` <20210524154910.30523-1-trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> @ 2021-05-25 3:27 ` David Gibson 0 siblings, 0 replies; 2+ messages in thread From: David Gibson @ 2021-05-25 3:27 UTC (permalink / raw) To: Tom Rini Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, Simon Glass, Jon Loeliger [-- 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 --] ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-25 3:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).