scripts: checkkconfigsymbols: match complete numeric literals
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.
--- scripts/checkkconfigsymbols.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkkconfigsymbols.py +1 -1
@@ -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)
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-prefixedKconfigsymbol is not reported.Require the entire token to match the numeric expression.
Tested
Kconfigdependencies 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")Signed-off-by Hamdy Abou El Anein <[email protected]>
Seems fine.
Signature · 2 lines
Cheers, Nathan