From ddf3fd0cfc38f2e27b92f378b0df70f4c84faef8 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Fri, 29 May 2015 16:00:54 +0200 Subject: Only warn for 'option modules' on non-MODULES symbols. --- README.md | 10 ++++------ kconfiglib.py | 23 +++++++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 146c797..388ee46 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,10 @@ with `comment`s inside `choice`s (that didn't affect correctness but made output differ) the test suite now passes with Linux v4.0-rc3. Very little seems to have changed in the C implementation over the past years, which is nice. :) -Despite the warnings, modules *are* supported (or tests would break -horribly). The warnings are related to `option modules`, which specifies what -symbol serves as the `MODULES` symbol. It's always "MODULES" in the kernel, and -older versions of the `Kconfig` files did not set `option modules` on it -- hence the -warnings. With newer versions of the C implementation it's required. I should add -support for `option modules` in a backwards-compatible way. +One feature is missing: Kconfiglib assumes the modules symbol is `MODULES`, and +will warn if `option modules` is set on some other symbol. Let me know if this +is a problem for you, as adding support shouldn't be that hard. I haven't seen +modules used outside the kernel, where the name is unlikely to change. ## Installation ## diff --git a/kconfiglib.py b/kconfiglib.py index 1da33e6..9637f48 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1326,14 +1326,21 @@ error, and you should e-mail kconfiglib@gmail.com. self.defconfig_sym = stmt elif tokens.check(T_MODULES): - self._warn("the 'modules' option is not supported. " - "Let me know if this is a problem for you; " - "it shouldn't be that hard to implement. " - "(Note that modules are still supported -- " - "Kconfiglib just assumes the symbol name " - "MODULES.)", - filename, - linenr) + # To reduce warning spam, only warn if 'option modules' is + # set on some symbol that isn't MODULES, which should be + # safe. I haven't run into any projects that make use + # modules besides the kernel yet, and there it's likely to + # keep being called "MODULES". + if stmt.name != "MODULES": + self._warn("the 'modules' option is not supported. " + "Let me know if this is a problem for you; " + "it shouldn't be that hard to implement. " + "(Note that modules are still supported -- " + "Kconfiglib just assumes the symbol name " + "MODULES, like older versions of the C " + "did when 'option modules' wasn't used.)", + filename, + linenr) elif tokens.check(T_ALLNOCONFIG_Y): if not isinstance(stmt, Symbol): -- cgit v1.2.3