diff mbox series

pylibfdt: Rework "avoid unused variable warning" lines

Message ID 20210524154727.30163-1-trini@konsulko.com
State Accepted
Commit a2cfad8ecc28923db6f826c01359c768980085e7
Headers show
Series pylibfdt: Rework "avoid unused variable warning" lines | expand

Commit Message

Tom Rini May 24, 2021, 3:47 p.m. UTC
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@konsulko.com>
---
 scripts/dtc/pylibfdt/libfdt.i_shipped | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tom Rini May 25, 2021, 12:58 a.m. UTC | #1
On Mon, May 24, 2021 at 11:47:27AM -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@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped b/scripts/dtc/pylibfdt/libfdt.i_shipped
index 1d69ad38e2e3..27c29ea2603a 100644
--- a/scripts/dtc/pylibfdt/libfdt.i_shipped
+++ b/scripts/dtc/pylibfdt/libfdt.i_shipped
@@ -1010,7 +1010,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 * */
@@ -1021,7 +1021,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() */