diff options
author | Valentin Rothberg <valentinrothberg@gmail.com> | 2015-07-27 06:33:05 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-08-03 20:16:58 -0400 |
commit | 0bd38ae355227792dde3487779a9dc24d6b99631 (patch) | |
tree | 65f6dc6488b7c3014e173cdfaa4777325592e725 /scripts/checkkconfigsymbols.py | |
parent | c745566306e363675d8aa43ee9f39232ade4d5e6 (diff) |
scripts/checkkconfigsymbols.py: support default statements
Until now, checkkonfigsymbols.py did not check default statements for
references on missing Kconfig symbols (i.e., undefined Kconfig options).
Hence, add support to parse and check the Kconfig default statement.
Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts/checkkconfigsymbols.py')
-rwxr-xr-x | scripts/checkkconfigsymbols.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py index d89371cc9110..2f4b7ffd5570 100755 --- a/scripts/checkkconfigsymbols.py +++ b/scripts/checkkconfigsymbols.py | |||
@@ -20,18 +20,20 @@ OPERATORS = r"&|\(|\)|\||\!" | |||
20 | FEATURE = r"(?:\w*[A-Z0-9]\w*){2,}" | 20 | FEATURE = r"(?:\w*[A-Z0-9]\w*){2,}" |
21 | DEF = r"^\s*(?:menu){,1}config\s+(" + FEATURE + r")\s*" | 21 | DEF = r"^\s*(?:menu){,1}config\s+(" + FEATURE + r")\s*" |
22 | EXPR = r"(?:" + OPERATORS + r"|\s|" + FEATURE + r")+" | 22 | EXPR = r"(?:" + OPERATORS + r"|\s|" + FEATURE + r")+" |
23 | STMT = r"^\s*(?:if|select|depends\s+on)\s+" + EXPR | 23 | DEFAULT = r"default\s+.*?(?:if\s.+){,1}" |
24 | STMT = r"^\s*(?:if|select|depends\s+on|(?:" + DEFAULT + r"))\s+" + EXPR | ||
24 | SOURCE_FEATURE = r"(?:\W|\b)+[D]{,1}CONFIG_(" + FEATURE + r")" | 25 | SOURCE_FEATURE = r"(?:\W|\b)+[D]{,1}CONFIG_(" + FEATURE + r")" |
25 | 26 | ||
26 | # regex objects | 27 | # regex objects |
27 | REGEX_FILE_KCONFIG = re.compile(r".*Kconfig[\.\w+\-]*$") | 28 | REGEX_FILE_KCONFIG = re.compile(r".*Kconfig[\.\w+\-]*$") |
28 | REGEX_FEATURE = re.compile(r"(" + FEATURE + r")") | 29 | REGEX_FEATURE = re.compile(r'(?!\B"[^"]*)' + FEATURE + r'(?![^"]*"\B)') |
29 | REGEX_SOURCE_FEATURE = re.compile(SOURCE_FEATURE) | 30 | REGEX_SOURCE_FEATURE = re.compile(SOURCE_FEATURE) |
30 | REGEX_KCONFIG_DEF = re.compile(DEF) | 31 | REGEX_KCONFIG_DEF = re.compile(DEF) |
31 | REGEX_KCONFIG_EXPR = re.compile(EXPR) | 32 | REGEX_KCONFIG_EXPR = re.compile(EXPR) |
32 | REGEX_KCONFIG_STMT = re.compile(STMT) | 33 | REGEX_KCONFIG_STMT = re.compile(STMT) |
33 | REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$") | 34 | REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$") |
34 | REGEX_FILTER_FEATURES = re.compile(r"[A-Za-z0-9]$") | 35 | REGEX_FILTER_FEATURES = re.compile(r"[A-Za-z0-9]$") |
36 | REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+") | ||
35 | 37 | ||
36 | 38 | ||
37 | def parse_options(): | 39 | def parse_options(): |
@@ -314,6 +316,9 @@ def parse_kconfig_file(kfile, defined_features, referenced_features): | |||
314 | line = line.strip('\n') | 316 | line = line.strip('\n') |
315 | features.extend(get_features_in_line(line)) | 317 | features.extend(get_features_in_line(line)) |
316 | for feature in set(features): | 318 | for feature in set(features): |
319 | if REGEX_NUMERIC.match(feature): | ||
320 | # ignore numeric values | ||
321 | continue | ||
317 | paths = referenced_features.get(feature, set()) | 322 | paths = referenced_features.get(feature, set()) |
318 | paths.add(kfile) | 323 | paths.add(kfile) |
319 | referenced_features[feature] = paths | 324 | referenced_features[feature] = paths |