Skip to contentSkip to conversation

dtc: Remove unused dts_version in dtc-lexer.l

PATCH Applied Nathan Chancellor 2 participants 2 messages Mar 26 – Mar 27

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dtc: Remove unused dts_version in dtc-lexer.l

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.

---
 dtc-lexer.l | 3 ---
 1 file changed, 3 deletions(-)
dtc-lexer.l +0 -3
index 15d585c..1b129b1 100644
@@ -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,

Signature · 1 line
Nathan Chancellor <[email protected]>
Applied
#1 lore raw
Quoted 4 lines · 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:

Quoted 8 lines

../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.

Applied, thanks.

Quoted 35 lines
---
 dtc-lexer.l | 3 ---
 1 file changed, 3 deletions(-)
dtc-lexer.l +0 -4
index 15d585c..1b129b1 100644
@@ -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,

Signature · 1 line
Nathan Chancellor <[email protected]>
Signature · 4 lines
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