public inbox for devicetree-compiler@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dtc: Remove unused dts_version in dtc-lexer.l
@ 2026-03-26  0:13 Nathan Chancellor
  2026-03-27  9:27 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2026-03-26  0:13 UTC (permalink / raw)
  To: David Gibson; +Cc: devicetree-compiler, Nathan Chancellor

A recent strengthening of -Wunused-but-set-variable (enabled with -Wall)
in clang under a new subwarning, -Wunused-but-set-global, points out an
unused static global variable in dtc-lexer.l:

  ../dtc-lexer.l:42:12: error: variable 'dts_version' set but not used [-Werror,-Wunused-but-set-global]
     42 | static int dts_version = 1;
        |            ^

This variable has been unused since commit 4e1a0a0 ("Remove support for
the legacy DTS source file format."). Remove it to clear up the warning.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 dtc-lexer.l | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/dtc-lexer.l b/dtc-lexer.l
index 15d585c..1b129b1 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -39,8 +39,6 @@ extern bool treesource_error;
 #define DPRINT(fmt, ...)	do { } while (0)
 #endif
 
-static int dts_version = 1;
-
 #define BEGIN_DEFAULT()		DPRINT("<V1>\n"); \
 				BEGIN(V1); \
 
@@ -101,7 +99,6 @@ static void PRINTF(1, 2) lexical_error(const char *fmt, ...);
 
 <*>"/dts-v1/"	{
 			DPRINT("Keyword: /dts-v1/\n");
-			dts_version = 1;
 			BEGIN_DEFAULT();
 			return DT_V1;
 		}

---
base-commit: caf7465c5d60a56e00ea8c6b6eeb4e443371f815
change-id: 20260325-dtc-lexer-remove-dts_version-dbf0fcd4aec4

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>


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

* Re: [PATCH] dtc: Remove unused dts_version in dtc-lexer.l
  2026-03-26  0:13 [PATCH] dtc: Remove unused dts_version in dtc-lexer.l Nathan Chancellor
@ 2026-03-27  9:27 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2026-03-27  9:27 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: devicetree-compiler

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

On Wed, Mar 25, 2026 at 05:13:44PM -0700, Nathan Chancellor wrote:
> A recent strengthening of -Wunused-but-set-variable (enabled with -Wall)
> in clang under a new subwarning, -Wunused-but-set-global, points out an
> unused static global variable in dtc-lexer.l:
> 
>   ../dtc-lexer.l:42:12: error: variable 'dts_version' set but not used [-Werror,-Wunused-but-set-global]
>      42 | static int dts_version = 1;
>         |            ^
> 
> This variable has been unused since commit 4e1a0a0 ("Remove support for
> the legacy DTS source file format."). Remove it to clear up the warning.
> 
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Applied, thanks.

> ---
>  dtc-lexer.l | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/dtc-lexer.l b/dtc-lexer.l
> index 15d585c..1b129b1 100644
> --- a/dtc-lexer.l
> +++ b/dtc-lexer.l
> @@ -39,8 +39,6 @@ extern bool treesource_error;
>  #define DPRINT(fmt, ...)	do { } while (0)
>  #endif
>  
> -static int dts_version = 1;
> -
>  #define BEGIN_DEFAULT()		DPRINT("<V1>\n"); \
>  				BEGIN(V1); \
>  
> @@ -101,7 +99,6 @@ static void PRINTF(1, 2) lexical_error(const char *fmt, ...);
>  
>  <*>"/dts-v1/"	{
>  			DPRINT("Keyword: /dts-v1/\n");
> -			dts_version = 1;
>  			BEGIN_DEFAULT();
>  			return DT_V1;
>  		}
> 
> ---
> base-commit: caf7465c5d60a56e00ea8c6b6eeb4e443371f815
> change-id: 20260325-dtc-lexer-remove-dts_version-dbf0fcd4aec4
> 
> Best regards,
> --  
> Nathan Chancellor <nathan@kernel.org>
> 
> 

-- 
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] 2+ messages in thread

end of thread, other threads:[~2026-03-27 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26  0:13 [PATCH] dtc: Remove unused dts_version in dtc-lexer.l Nathan Chancellor
2026-03-27  9: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