* [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; 4+ 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] 4+ messages in thread
* 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; 4+ 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] 4+ messages in thread
* Re: [PATCH] pylibfdt: Rework "avoid unused variable warning" lines
2021-05-24 15:47 Tom Rini
@ 2021-05-25 0:58 ` Tom Rini
0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2021-05-25 0:58 UTC (permalink / raw)
To: u-boot
[-- Attachment #1: Type: text/plain, Size: 527 bytes --]
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!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] pylibfdt: Rework "avoid unused variable warning" lines
@ 2021-05-24 15:47 Tom Rini
2021-05-25 0:58 ` Tom Rini
0 siblings, 1 reply; 4+ messages in thread
From: Tom Rini @ 2021-05-24 15:47 UTC (permalink / raw)
To: u-boot
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(-)
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() */
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-25 3:27 UTC | newest]
Thread overview: 4+ 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
-- strict thread matches above, loose matches on Subject: below --
2021-05-24 15:47 Tom Rini
2021-05-25 0:58 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.