summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-04-25 14:30:25 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-04-25 14:41:21 +0200
commitc1c5ef2eb1009bacb6f7278e7d73335ec6223cba (patch)
tree47f2be5c6a22145a0347654c0985cc8686074877 /kconfiglib.py
parent509e374dfcadbe04ba30fe8aeea372101e0b5502 (diff)
Print a warning for malformed .config lines
Flag lines matching neither 'CONFIG_FOO=...' nor '# CONFIG_FOO is not set' that aren't blank or comments.
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index e014481..8169c11 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -814,7 +814,7 @@ class Kconfig(object):
elif sym.orig_type == STRING:
string_match = _conf_string_re_match(val)
if not string_match:
- self._warn("Malformed string literal in "
+ self._warn("malformed string literal in "
"assignment to {}. Assignment ignored."
.format(_name_and_loc(sym)),
filename, linenr)
@@ -825,6 +825,15 @@ class Kconfig(object):
else:
unset_match = unset_re_match(line)
if not unset_match:
+ # Print a warning for lines that match neither
+ # set_re_match() nor unset_re_match() and that are not
+ # blank lines or comments. 'line' has already been
+ # rstrip()'d, so blank lines show up as "" here.
+ if line and not line.lstrip().startswith("#"):
+ self._warn("ignoring malformed line '{}'"
+ .format(line),
+ filename, linenr)
+
continue
name = unset_match.group(1)