Commit e0627813 authored by Yann E. MORIN's avatar Yann E. MORIN Committed by Michal Marek

kconfig: do not allow more than one symbol to have 'option modules'

Previously, it was possible to have more than one symbol with the
'option modules' attached to them, although only the last one would
in fact control tristates.

Since this does not make much sense, only allow at most one symbol to
control tristates.

Note: it is still possible to have more than one symbol that control
tristates, but indirectly:

    config MOD1
        bool "mod1"
        select MODULES
    config MOD2
        bool "mod2"
        select MODULES
    config MODULES
        bool
        option modules
Signed-off-by: default avatar"Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent c80de52d
...@@ -147,6 +147,7 @@ applicable everywhere (see syntax). ...@@ -147,6 +147,7 @@ applicable everywhere (see syntax).
- "modules" - "modules"
This declares the symbol to be used as the MODULES symbol, which This declares the symbol to be used as the MODULES symbol, which
enables the third modular state for all config symbols. enables the third modular state for all config symbols.
At most one symbol may have the "modules" option set.
- "env"=<value> - "env"=<value>
This imports the environment variable into Kconfig. It behaves like This imports the environment variable into Kconfig. It behaves like
......
...@@ -199,6 +199,12 @@ void menu_add_option(int token, char *arg) ...@@ -199,6 +199,12 @@ void menu_add_option(int token, char *arg)
{ {
switch (token) { switch (token) {
case T_OPT_MODULES: case T_OPT_MODULES:
if (modules_sym)
zconf_error("symbol '%s' redefines option 'modules'"
" already defined by symbol '%s'",
current_entry->sym->name,
modules_sym->name
);
modules_sym = current_entry->sym; modules_sym = current_entry->sym;
break; break;
case T_OPT_DEFCONFIG_LIST: case T_OPT_DEFCONFIG_LIST:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment