From c1c5ef2eb1009bacb6f7278e7d73335ec6223cba Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 25 Apr 2018 14:30:25 +0200 Subject: 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. --- kconfiglib.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3