diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-07-24 22:13:43 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-07-24 22:13:43 +0200 |
| commit | 6899f91867ecd1df50620499db7a64f9d5c1397b (patch) | |
| tree | 17e02674bddacaa2c2bc7a3f4b5ef996b1275fd5 | |
| parent | b650ccda72102bf8581420cfa31f6c6eab67f65d (diff) | |
Restore compatibility with old kernels
Add a small hack to restore compatibility with older (2015-) versions of
the Linux kernel. Weird help tokens like -help- and --help--- are now
accepted again.
Compatibility was originally dropped by commit c19fc11 ("Drop some
compatibility and tighten up lexing"), but it turns that people are
still using Kconfiglib with older kernels.
The new compatibility hack has pretty minimal impact at least.
| -rw-r--r-- | kconfiglib.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 18baa83..cc5141d 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1646,8 +1646,17 @@ class Kconfig(object): # to the previous token. See _STRING_LEX for why this is needed. token = _get_keyword(match.group(1)) if not token: - # If the first token is not a keyword, we have a preprocessor - # variable assignment (or a bare macro on a line) + # Backwards compatibility with old versions of the C tools, which + # (accidentally) accepted stuff like "--help--" and "-help---". + # This was fixed in the C tools by commit c2264564 ("kconfig: warn + # of unhandled characters in Kconfig commands"), committed in July + # 2015, but it seems people still run Kconfiglib on older kernels. + if s.strip(" \t\n-") == "help": + return (_T_HELP, None) + + # If the first token is not a keyword (and not a weird help token), + # we have a preprocessor variable assignment (or a bare macro on a + # line) self._parse_assignment(s) return (None,) |
