Skip to content

Commit aa0f5ea

Browse files
arielmarco-hzmasahir0y
authored andcommitted
checkkconfigsymbols.py: Remove skipping of help lines in parse_kconfig_file
When parsing Kconfig files to find symbol definitions and references, lines after a 'help' line are skipped until a new config definition starts. However, Kconfig statements can actually be after a help section, as long as these have shallower indentation. These are skipped by the parser. This means that symbols referenced in this kind of statements are ignored by this function and thus are not considered undefined references in case the symbol is not defined. Remove the 'skip' logic entirely, as it is not needed if we just use the STMT regex to find the end of help lines. However, this means that keywords that appear as part of the help message (i.e. with the same indentation as the help lines) it will be considered as a reference/definition. This can happen now as well, but only with REGEX_KCONFIG_DEF lines. Also, the keyword must have a SYMBOL after it, which probably means that someone referenced a config in the help so it seems like a bonus :) The real solution is to keep track of the indentation when a the first help line in encountered and then handle DEF and STMT lines only if the indentation is shallower. Signed-off-by: Ariel Marcovitch <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent d62d5ae commit aa0f5ea

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

scripts/checkkconfigsymbols.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
REGEX_KCONFIG_DEF = re.compile(DEF)
3535
REGEX_KCONFIG_EXPR = re.compile(EXPR)
3636
REGEX_KCONFIG_STMT = re.compile(STMT)
37-
REGEX_KCONFIG_HELP = re.compile(r"^\s+help\s*$")
3837
REGEX_FILTER_SYMBOLS = re.compile(r"[A-Za-z0-9]$")
3938
REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+")
4039
REGEX_QUOTES = re.compile("(\"(.*?)\")")
@@ -435,7 +434,6 @@ def parse_kconfig_file(kfile):
435434
lines = []
436435
defined = []
437436
references = []
438-
skip = False
439437

440438
if not os.path.exists(kfile):
441439
return defined, references
@@ -451,12 +449,6 @@ def parse_kconfig_file(kfile):
451449
if REGEX_KCONFIG_DEF.match(line):
452450
symbol_def = REGEX_KCONFIG_DEF.findall(line)
453451
defined.append(symbol_def[0])
454-
skip = False
455-
elif REGEX_KCONFIG_HELP.match(line):
456-
skip = True
457-
elif skip:
458-
# ignore content of help messages
459-
pass
460452
elif REGEX_KCONFIG_STMT.match(line):
461453
line = REGEX_QUOTES.sub("", line)
462454
symbols = get_symbols_in_line(line)

0 commit comments

Comments
 (0)