* [PATCH 0/2] libfdt: Fix -Wextra -Wpedantic warnings
@ 2024-11-16 10:12 Bingwu Zhang
2024-11-16 10:12 ` [PATCH 1/2] libfdt: Suppress a unused parameter warning in overlay_fixup_one_phandle Bingwu Zhang
2024-11-16 10:12 ` [PATCH 2/2] libfdt: Remove extra semi-colons outside functions Bingwu Zhang
0 siblings, 2 replies; 7+ messages in thread
From: Bingwu Zhang @ 2024-11-16 10:12 UTC (permalink / raw)
To: David Gibson, devicetree-compiler; +Cc: Bingwu Zhang, devicetree, ~xtex/staging
From: Bingwu Zhang <xtexchooser@duck.com>
This fixes several warning when compiling with CFLAGS='-Wall -Wextra
-Wpedantic'. When using together with '-Werror' flag, these warnings becomes
fatal errors that fails the build.
Both of the original errors and fixes for them are tested with GCC 13
and clang 18.
Bingwu Zhang (2):
libfdt: Suppress a unused parameter warning in
overlay_fixup_one_phandle
libfdt: Remove extra semi-colons outside functions
libfdt/fdt_overlay.c | 3 ++-
libfdt/libfdt.h | 20 ++++++++++----------
2 files changed, 12 insertions(+), 11 deletions(-)
base-commit: 2d10aa2afe35527728db30b35ec491ecb6959e5c
--
2.47.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/2] libfdt: Suppress a unused parameter warning in overlay_fixup_one_phandle 2024-11-16 10:12 [PATCH 0/2] libfdt: Fix -Wextra -Wpedantic warnings Bingwu Zhang @ 2024-11-16 10:12 ` Bingwu Zhang 2024-11-18 3:25 ` David Gibson 2024-11-16 10:12 ` [PATCH 2/2] libfdt: Remove extra semi-colons outside functions Bingwu Zhang 1 sibling, 1 reply; 7+ messages in thread From: Bingwu Zhang @ 2024-11-16 10:12 UTC (permalink / raw) To: David Gibson, devicetree-compiler; +Cc: Bingwu Zhang, devicetree, ~xtex/staging From: Bingwu Zhang <xtexchooser@duck.com> When compiling with -Wall -Wextra, the unused fdt parameter becomes a warning. With -Werror, it becomes an error that fails the build. Thanks to Icenowy Zheng for pointing out the solution. Signed-off-by: Bingwu Zhang <xtexchooser@duck.com> --- libfdt/fdt_overlay.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c index 28b667ffc490..f9be13865807 100644 --- a/libfdt/fdt_overlay.c +++ b/libfdt/fdt_overlay.c @@ -334,6 +334,7 @@ static int overlay_fixup_one_phandle(void *fdt, void *fdto, const char *name, uint32_t name_len, int poffset, uint32_t phandle) { + (void)fdt; fdt32_t phandle_prop; int fixup_off; -- 2.47.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] libfdt: Suppress a unused parameter warning in overlay_fixup_one_phandle 2024-11-16 10:12 ` [PATCH 1/2] libfdt: Suppress a unused parameter warning in overlay_fixup_one_phandle Bingwu Zhang @ 2024-11-18 3:25 ` David Gibson 2024-11-18 10:15 ` xtex 2024-11-18 10:15 ` xtex 0 siblings, 2 replies; 7+ messages in thread From: David Gibson @ 2024-11-18 3:25 UTC (permalink / raw) To: Bingwu Zhang; +Cc: devicetree-compiler, Bingwu Zhang, devicetree, ~xtex/staging [-- Attachment #1: Type: text/plain, Size: 1237 bytes --] On Sat, Nov 16, 2024 at 06:12:27PM +0800, Bingwu Zhang wrote: > From: Bingwu Zhang <xtexchooser@duck.com> > > When compiling with -Wall -Wextra, the unused fdt parameter becomes a > warning. With -Werror, it becomes an error that fails the build. > > Thanks to Icenowy Zheng for pointing out the solution. > > Signed-off-by: Bingwu Zhang <xtexchooser@duck.com> AFAICT this parameter is *really* unused, it's not just the compiled being confused. So I'd prefer to actually remove the parameter, rather than suppress the warning. > --- > libfdt/fdt_overlay.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c > index 28b667ffc490..f9be13865807 100644 > --- a/libfdt/fdt_overlay.c > +++ b/libfdt/fdt_overlay.c > @@ -334,6 +334,7 @@ static int overlay_fixup_one_phandle(void *fdt, void *fdto, > const char *name, uint32_t name_len, > int poffset, uint32_t phandle) > { > + (void)fdt; > fdt32_t phandle_prop; > int fixup_off; > -- David Gibson (he or they) | 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] 7+ messages in thread
* Re: [PATCH 1/2] libfdt: Suppress a unused parameter warning in overlay_fixup_one_phandle 2024-11-18 3:25 ` David Gibson @ 2024-11-18 10:15 ` xtex 2024-11-18 10:15 ` xtex 1 sibling, 0 replies; 7+ messages in thread From: xtex @ 2024-11-18 10:15 UTC (permalink / raw) To: david; +Cc: devicetree-compiler, xtexchooser, devicetree, ~xtex/staging >AFAICT this parameter is *really* unused, it's not just the compiled >being confused. So I'd prefer to actually remove the parameter, >rather than suppress the warning. Acknowledged, I will make a v2 patch this weekend, as soon as I am back at home. -- xtex @ Nov 18, 2024 18:15 UTC ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] libfdt: Suppress a unused parameter warning in overlay_fixup_one_phandle 2024-11-18 3:25 ` David Gibson 2024-11-18 10:15 ` xtex @ 2024-11-18 10:15 ` xtex 1 sibling, 0 replies; 7+ messages in thread From: xtex @ 2024-11-18 10:15 UTC (permalink / raw) To: david; +Cc: devicetree-compiler, xtexchooser, devicetree, ~xtex/staging >AFAICT this parameter is *really* unused, it's not just the compiled >being confused. So I'd prefer to actually remove the parameter, >rather than suppress the warning. Acknowledged, I will make a v2 patch this weekend, as soon as I am back at home. -- xtex @ Nov 18, 2024 18:15 UTC ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] libfdt: Remove extra semi-colons outside functions 2024-11-16 10:12 [PATCH 0/2] libfdt: Fix -Wextra -Wpedantic warnings Bingwu Zhang 2024-11-16 10:12 ` [PATCH 1/2] libfdt: Suppress a unused parameter warning in overlay_fixup_one_phandle Bingwu Zhang @ 2024-11-16 10:12 ` Bingwu Zhang 2024-11-18 3:32 ` David Gibson 1 sibling, 1 reply; 7+ messages in thread From: Bingwu Zhang @ 2024-11-16 10:12 UTC (permalink / raw) To: David Gibson, devicetree-compiler; +Cc: Bingwu Zhang, devicetree, ~xtex/staging From: Bingwu Zhang <xtexchooser@duck.com> When compiling with -Werror -Wpedantic, both GCC and Clang fails, saying that these semi-colons are redundant, so remove them. Signed-off-by: Bingwu Zhang <xtexchooser@duck.com> --- libfdt/fdt_overlay.c | 2 +- libfdt/libfdt.h | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c index f9be13865807..1b098e61c270 100644 --- a/libfdt/fdt_overlay.c +++ b/libfdt/fdt_overlay.c @@ -352,7 +352,7 @@ static int overlay_fixup_one_phandle(void *fdt, void *fdto, name, name_len, poffset, &phandle_prop, sizeof(phandle_prop)); -}; +} /** * overlay_fixup_phandle - Set an overlay phandle to the base one diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h index 96782bc57b84..2e182ea3314d 100644 --- a/libfdt/libfdt.h +++ b/libfdt/libfdt.h @@ -263,16 +263,16 @@ int fdt_next_subnode(const void *fdt, int offset); struct fdt_header *fdth = (struct fdt_header *)fdt; \ fdth->name = cpu_to_fdt32(val); \ } -fdt_set_hdr_(magic); -fdt_set_hdr_(totalsize); -fdt_set_hdr_(off_dt_struct); -fdt_set_hdr_(off_dt_strings); -fdt_set_hdr_(off_mem_rsvmap); -fdt_set_hdr_(version); -fdt_set_hdr_(last_comp_version); -fdt_set_hdr_(boot_cpuid_phys); -fdt_set_hdr_(size_dt_strings); -fdt_set_hdr_(size_dt_struct); +fdt_set_hdr_(magic) +fdt_set_hdr_(totalsize) +fdt_set_hdr_(off_dt_struct) +fdt_set_hdr_(off_dt_strings) +fdt_set_hdr_(off_mem_rsvmap) +fdt_set_hdr_(version) +fdt_set_hdr_(last_comp_version) +fdt_set_hdr_(boot_cpuid_phys) +fdt_set_hdr_(size_dt_strings) +fdt_set_hdr_(size_dt_struct) #undef fdt_set_hdr_ /** -- 2.47.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] libfdt: Remove extra semi-colons outside functions 2024-11-16 10:12 ` [PATCH 2/2] libfdt: Remove extra semi-colons outside functions Bingwu Zhang @ 2024-11-18 3:32 ` David Gibson 0 siblings, 0 replies; 7+ messages in thread From: David Gibson @ 2024-11-18 3:32 UTC (permalink / raw) To: Bingwu Zhang; +Cc: devicetree-compiler, Bingwu Zhang, devicetree, ~xtex/staging [-- Attachment #1: Type: text/plain, Size: 2116 bytes --] On Sat, Nov 16, 2024 at 06:12:28PM +0800, Bingwu Zhang wrote: > From: Bingwu Zhang <xtexchooser@duck.com> > > When compiling with -Werror -Wpedantic, both GCC and Clang fails, saying > that these semi-colons are redundant, so remove them. > > Signed-off-by: Bingwu Zhang <xtexchooser@duck.com> Applied, thanks. > --- > libfdt/fdt_overlay.c | 2 +- > libfdt/libfdt.h | 20 ++++++++++---------- > 2 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c > index f9be13865807..1b098e61c270 100644 > --- a/libfdt/fdt_overlay.c > +++ b/libfdt/fdt_overlay.c > @@ -352,7 +352,7 @@ static int overlay_fixup_one_phandle(void *fdt, void *fdto, > name, name_len, poffset, > &phandle_prop, > sizeof(phandle_prop)); > -}; > +} > > /** > * overlay_fixup_phandle - Set an overlay phandle to the base one > diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h > index 96782bc57b84..2e182ea3314d 100644 > --- a/libfdt/libfdt.h > +++ b/libfdt/libfdt.h > @@ -263,16 +263,16 @@ int fdt_next_subnode(const void *fdt, int offset); > struct fdt_header *fdth = (struct fdt_header *)fdt; \ > fdth->name = cpu_to_fdt32(val); \ > } > -fdt_set_hdr_(magic); > -fdt_set_hdr_(totalsize); > -fdt_set_hdr_(off_dt_struct); > -fdt_set_hdr_(off_dt_strings); > -fdt_set_hdr_(off_mem_rsvmap); > -fdt_set_hdr_(version); > -fdt_set_hdr_(last_comp_version); > -fdt_set_hdr_(boot_cpuid_phys); > -fdt_set_hdr_(size_dt_strings); > -fdt_set_hdr_(size_dt_struct); > +fdt_set_hdr_(magic) > +fdt_set_hdr_(totalsize) > +fdt_set_hdr_(off_dt_struct) > +fdt_set_hdr_(off_dt_strings) > +fdt_set_hdr_(off_mem_rsvmap) > +fdt_set_hdr_(version) > +fdt_set_hdr_(last_comp_version) > +fdt_set_hdr_(boot_cpuid_phys) > +fdt_set_hdr_(size_dt_strings) > +fdt_set_hdr_(size_dt_struct) > #undef fdt_set_hdr_ > > /** -- David Gibson (he or they) | 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] 7+ messages in thread
end of thread, other threads:[~2024-11-18 10:15 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-11-16 10:12 [PATCH 0/2] libfdt: Fix -Wextra -Wpedantic warnings Bingwu Zhang 2024-11-16 10:12 ` [PATCH 1/2] libfdt: Suppress a unused parameter warning in overlay_fixup_one_phandle Bingwu Zhang 2024-11-18 3:25 ` David Gibson 2024-11-18 10:15 ` xtex 2024-11-18 10:15 ` xtex 2024-11-16 10:12 ` [PATCH 2/2] libfdt: Remove extra semi-colons outside functions Bingwu Zhang 2024-11-18 3:32 ` 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).