public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] tools/atmelimage: add const qualifier to fix compiler warning
@ 2026-02-25 15:03 Daniel Golle
  2026-02-25 15:07 ` Tom Rini
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Golle @ 2026-02-25 15:03 UTC (permalink / raw)
  To: Tom Rini, Daniel Golle, u-boot

tools/atmelimage.c: In function ‘atmel_find_pmecc_parameter_in_token’:
tools/atmelimage.c:64:31: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
64 |                         param = strstr(token, "=");
   |                               ^
cc1: all warnings being treated as errors

Add 'const' qualifier to variable 'param' to prevent build failing
due to -Werror.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 tools/atmelimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/atmelimage.c b/tools/atmelimage.c
index 6a2d9d8feab..770f7a0de4e 100644
--- a/tools/atmelimage.c
+++ b/tools/atmelimage.c
@@ -55,7 +55,7 @@ static const char * const configs[] = {
 static int atmel_find_pmecc_parameter_in_token(const char *token)
 {
 	size_t pos;
-	char *param;
+	const char *param;
 
 	debug("token: '%s'\n", token);
 
-- 
2.53.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tools/atmelimage: add const qualifier to fix compiler warning
  2026-02-25 15:03 [PATCH] tools/atmelimage: add const qualifier to fix compiler warning Daniel Golle
@ 2026-02-25 15:07 ` Tom Rini
  2026-02-25 15:14   ` Daniel Golle
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Rini @ 2026-02-25 15:07 UTC (permalink / raw)
  To: Daniel Golle; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

On Wed, Feb 25, 2026 at 03:03:57PM +0000, Daniel Golle wrote:

> tools/atmelimage.c: In function ‘atmel_find_pmecc_parameter_in_token’:
> tools/atmelimage.c:64:31: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> 64 |                         param = strstr(token, "=");
>    |                               ^
> cc1: all warnings being treated as errors
> 
> Add 'const' qualifier to variable 'param' to prevent build failing
> due to -Werror.
> 
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
>  tools/atmelimage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/atmelimage.c b/tools/atmelimage.c
> index 6a2d9d8feab..770f7a0de4e 100644
> --- a/tools/atmelimage.c
> +++ b/tools/atmelimage.c
> @@ -55,7 +55,7 @@ static const char * const configs[] = {
>  static int atmel_find_pmecc_parameter_in_token(const char *token)
>  {
>  	size_t pos;
> -	char *param;
> +	const char *param;
>  
>  	debug("token: '%s'\n", token);
>  

How / where are you triggering this problem? This is part of mkimage and
built on CI every time (and on macOS and Windows, in Azure). Thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tools/atmelimage: add const qualifier to fix compiler warning
  2026-02-25 15:07 ` Tom Rini
@ 2026-02-25 15:14   ` Daniel Golle
  2026-02-25 15:50     ` Tom Rini
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Golle @ 2026-02-25 15:14 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot

On Wed, Feb 25, 2026 at 09:07:42AM -0600, Tom Rini wrote:
> On Wed, Feb 25, 2026 at 03:03:57PM +0000, Daniel Golle wrote:
> 
> > tools/atmelimage.c: In function ‘atmel_find_pmecc_parameter_in_token’:
> > tools/atmelimage.c:64:31: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> > 64 |                         param = strstr(token, "=");
> >    |                               ^
> > cc1: all warnings being treated as errors
> > 
> > Add 'const' qualifier to variable 'param' to prevent build failing
> > due to -Werror.
> > 
> > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> > ---
> >  tools/atmelimage.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/atmelimage.c b/tools/atmelimage.c
> > index 6a2d9d8feab..770f7a0de4e 100644
> > --- a/tools/atmelimage.c
> > +++ b/tools/atmelimage.c
> > @@ -55,7 +55,7 @@ static const char * const configs[] = {
> >  static int atmel_find_pmecc_parameter_in_token(const char *token)
> >  {
> >  	size_t pos;
> > -	char *param;
> > +	const char *param;
> >  
> >  	debug("token: '%s'\n", token);
> >  
> 
> How / where are you triggering this problem? This is part of mkimage and
> built on CI every time (and on macOS and Windows, in Azure). Thanks!

I'm using archlinux on my workstation which got a fairly
recent version of GCC which is used to build the host tools:
gcc (GCC) 15.2.1 20260209

When trying to use the u-boot-size-test.sh scripts you had asked me for
it failed because of passing the '-E' parameter to buildman.

Also 'dtc' fails building for the same reason and that can be fixed by
picking commit dfe057874b34c ("scripts/dtc: Update to upstream versionv
1.7.2-62-ga26ef6400bd8") from Linux.
However, that has far-reaching consequences such as the
-Wno-graph_child_address parameter no longer existing, and also dtc
became more strict and issues new warnings for many of the dts files in
U-Boot, so then the build failed because of that...

As I wrote in the other email thread, I ended up just removing the '-E'
paramter because the rabbit hole became too deep...
diff --git a/contrib/trini/u-boot-size-test.sh b/contrib/trini/u-boot-size-test.sh
index da722f5..4cef66e 100755
--- a/contrib/trini/u-boot-size-test.sh
+++ b/contrib/trini/u-boot-size-test.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Initial and constant buildman args
-ARGS="-devl -PEWM"
+ARGS="-devl -PWM"
 ALL=0
 KEEP=0
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tools/atmelimage: add const qualifier to fix compiler warning
  2026-02-25 15:14   ` Daniel Golle
@ 2026-02-25 15:50     ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2026-02-25 15:50 UTC (permalink / raw)
  To: Daniel Golle; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 2568 bytes --]

On Wed, Feb 25, 2026 at 03:14:40PM +0000, Daniel Golle wrote:
> On Wed, Feb 25, 2026 at 09:07:42AM -0600, Tom Rini wrote:
> > On Wed, Feb 25, 2026 at 03:03:57PM +0000, Daniel Golle wrote:
> > 
> > > tools/atmelimage.c: In function ‘atmel_find_pmecc_parameter_in_token’:
> > > tools/atmelimage.c:64:31: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> > > 64 |                         param = strstr(token, "=");
> > >    |                               ^
> > > cc1: all warnings being treated as errors
> > > 
> > > Add 'const' qualifier to variable 'param' to prevent build failing
> > > due to -Werror.
> > > 
> > > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> > > ---
> > >  tools/atmelimage.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/tools/atmelimage.c b/tools/atmelimage.c
> > > index 6a2d9d8feab..770f7a0de4e 100644
> > > --- a/tools/atmelimage.c
> > > +++ b/tools/atmelimage.c
> > > @@ -55,7 +55,7 @@ static const char * const configs[] = {
> > >  static int atmel_find_pmecc_parameter_in_token(const char *token)
> > >  {
> > >  	size_t pos;
> > > -	char *param;
> > > +	const char *param;
> > >  
> > >  	debug("token: '%s'\n", token);
> > >  
> > 
> > How / where are you triggering this problem? This is part of mkimage and
> > built on CI every time (and on macOS and Windows, in Azure). Thanks!
> 
> I'm using archlinux on my workstation which got a fairly
> recent version of GCC which is used to build the host tools:
> gcc (GCC) 15.2.1 20260209

Ah. We dont' support 15.x yet due to:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121588

But a v2 where you note that newer compilers find this would be good and
get us ahead of problems once a newer gcc comes out with the fix.

> When trying to use the u-boot-size-test.sh scripts you had asked me for
> it failed because of passing the '-E' parameter to buildman.
> 
> Also 'dtc' fails building for the same reason and that can be fixed by
> picking commit dfe057874b34c ("scripts/dtc: Update to upstream versionv
> 1.7.2-62-ga26ef6400bd8") from Linux.
> However, that has far-reaching consequences such as the
> -Wno-graph_child_address parameter no longer existing, and also dtc
> became more strict and issues new warnings for many of the dts files in
> U-Boot, so then the build failed because of that...

Good to know for the next time we sync up, which should be soon to avoid
getting super out of date again.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-25 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 15:03 [PATCH] tools/atmelimage: add const qualifier to fix compiler warning Daniel Golle
2026-02-25 15:07 ` Tom Rini
2026-02-25 15:14   ` Daniel Golle
2026-02-25 15:50     ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox