Skip to contentSkip to conversation

scripts: checkkconfigsymbols: match complete numeric literals

PATCH In review Hamdy Abou El Anein 2 participants 2 messages Nov 3 – Nov 6 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: checkkconfigsymbols: match complete numeric literals

From: Hamdy Abou El Anein <[email protected]>

REGEX_NUMERIC.match() also accepts the numeric prefix of a symbol such as 64BIT_MISSING. The reference is then discarded as a numeric value, so a misspelled digit-prefixed Kconfig symbol is not reported.

Require the entire token to match the numeric expression.

Tested Kconfig dependencies and conditional defaults containing 64BIT_MISSING and 32BIT_MISSING, alongside decimal and hexadecimal literals. The symbols are retained and the literals remain excluded.

AI assistance: ChatGPT/Codex identified the issue and prepared the change, commit message and executable regression tests.

Fixes 0bd38ae35522 ("scripts/checkkconfigsymbols.py: support default statements")
---
 scripts/checkkconfigsymbols.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkkconfigsymbols.py +1 -1
index 9f7aed98d91..5582e19c007 100755
@@ -459,7 +459,7 @@ def parse_kconfig_file(kfile):
                 line = line.strip('\n')
                 symbols.extend(get_symbols_in_line(line))
             for symbol in set(symbols):
-                if REGEX_NUMERIC.match(symbol):
+                if REGEX_NUMERIC.fullmatch(symbol):
                     # ignore numeric values
                     continue
                 references.append(symbol)
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines

REGEX_NUMERIC.match() also accepts the numeric prefix of a symbol such as 64BIT_MISSING. The reference is then discarded as a numeric value, so a misspelled digit-prefixed Kconfig symbol is not reported.

Require the entire token to match the numeric expression.

Tested Kconfig dependencies and conditional defaults containing 64BIT_MISSING and 32BIT_MISSING, alongside decimal and hexadecimal literals. The symbols are retained and the literals remain excluded.

Quoted 5 lines

AI assistance: ChatGPT/Codex identified the issue and prepared the change, commit message and executable regression tests.

Fixes 0bd38ae35522 ("scripts/checkkconfigsymbols.py: support default statements")

Seems fine.

Signature · 2 lines
Cheers,
Nathan