mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-23 18:14:04 +08:00
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 <arielmarcovitch@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
d62d5aed33
commit
aa0f5ea12e
@ -34,7 +34,6 @@ REGEX_SOURCE_SYMBOL = re.compile(SOURCE_SYMBOL)
|
||||
REGEX_KCONFIG_DEF = re.compile(DEF)
|
||||
REGEX_KCONFIG_EXPR = re.compile(EXPR)
|
||||
REGEX_KCONFIG_STMT = re.compile(STMT)
|
||||
REGEX_KCONFIG_HELP = re.compile(r"^\s+help\s*$")
|
||||
REGEX_FILTER_SYMBOLS = re.compile(r"[A-Za-z0-9]$")
|
||||
REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+")
|
||||
REGEX_QUOTES = re.compile("(\"(.*?)\")")
|
||||
@ -435,7 +434,6 @@ def parse_kconfig_file(kfile):
|
||||
lines = []
|
||||
defined = []
|
||||
references = []
|
||||
skip = False
|
||||
|
||||
if not os.path.exists(kfile):
|
||||
return defined, references
|
||||
@ -451,12 +449,6 @@ def parse_kconfig_file(kfile):
|
||||
if REGEX_KCONFIG_DEF.match(line):
|
||||
symbol_def = REGEX_KCONFIG_DEF.findall(line)
|
||||
defined.append(symbol_def[0])
|
||||
skip = False
|
||||
elif REGEX_KCONFIG_HELP.match(line):
|
||||
skip = True
|
||||
elif skip:
|
||||
# ignore content of help messages
|
||||
pass
|
||||
elif REGEX_KCONFIG_STMT.match(line):
|
||||
line = REGEX_QUOTES.sub("", line)
|
||||
symbols = get_symbols_in_line(line)
|
||||
|
Loading…
Reference in New Issue
Block a user