History

kconfig: make 'imply' obey the direct dependency

The 'imply' statement may create unmet direct dependency when the implied symbol depends on m. [Test Code] config FOO tristate "foo" imply BAZ config BAZ tristate "baz" depends on BAR config BAR def_tristate m config MODULES def_bool y option modules If you set FOO=y, BAZ is also promoted to y, which results in the following .config file: CONFIG_FOO=y CONFIG_BAZ=y CONFIG_BAR=m CONFIG_MODULES=y This does not meet the dependency 'BAZ depends on BAR'. Unlike 'select', what is worse, Kconfig never shows the 'WARNING: unmet direct dependencies detected for ...' for this case. Because 'imply' is considered to be weaker than 'depends on', Kconfig should take the direct dependency into account. For clarification, describe this case in kconfig-language.rst too.

Masahiro Yamada committed 6 years ago

Commit 3a9dd3e1 parent def2fbf2 files · +16 −3Browse files

Unified · Split

2 files
  1. Documentation/kbuild/kconfig-language.rst +13 −2
  2. scripts/kconfig/symbol.c +3 −1
Documentation/kbuild/kconfig-language.rst+13−2
@@ -159,11 +159,11 @@ applicable everywhere (see syntax). · 158 unmodified lines
159 Given the following example::159 Given the following example::
160 160
161 config FOO161 config FOO
162 tristate162 tristate "foo"
163 imply BAZ163 imply BAZ
164 164
165 config BAZ165 config BAZ
166 tristate166 tristate "baz"
167 depends on BAR167 depends on BAR
168 168
169 The following values are possible:169 The following values are possible:
@@ -174,6 +174,9 @@ applicable everywhere (see syntax). · 4 unmodified lines
174 n y n N/m/y174 n y n N/m/y
175 m y m M/y/n175 m y m M/y/n
176 y y y Y/m/n176 y y y Y/m/n
177 n m n N/m
178 m m m M/n
179 y m n M/n
177 y n * N180 y n * N
178 === === ============= ==============181 === === ============= ==============
179 182
@@ -191,6 +194,14 @@ applicable everywhere (see syntax). · 11 unmodified lines
191 ...194 ...
192 }195 }
193 196
197 Note: If the feature provided by BAZ is highly desirable for FOO,
198 FOO should imply not only BAZ, but also its dependency BAR::
199
200 config FOO
201 tristate "foo"
202 imply BAR
203 imply BAZ
204
194- limiting menu display: "visible if" <expr>205- limiting menu display: "visible if" <expr>
195 206
196 This attribute is only applicable to menu blocks, if the condition is207 This attribute is only applicable to menu blocks, if the condition is
scripts/kconfig/symbol.c+3−1
@@ -221,7 +221,7 @@ static void sym_calc_visibility(struct symbol *sym) · 220 unmodified lines
221 sym_set_changed(sym);221 sym_set_changed(sym);
222 }222 }
223 tri = no;223 tri = no;
224 if (sym->implied.expr && sym->dir_dep.tri != no)224 if (sym->implied.expr)
225 tri = expr_calc_value(sym->implied.expr);225 tri = expr_calc_value(sym->implied.expr);
226 if (tri == mod && sym_get_type(sym) == S_BOOLEAN)226 if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
227 tri = yes;227 tri = yes;
@@ -394,6 +394,8 @@ void sym_calc_value(struct symbol *sym) · 166 unmodified lines
394 if (sym->implied.tri != no) {394 if (sym->implied.tri != no) {
395 sym->flags |= SYMBOL_WRITE;395 sym->flags |= SYMBOL_WRITE;
396 newval.tri = EXPR_OR(newval.tri, sym->implied.tri);396 newval.tri = EXPR_OR(newval.tri, sym->implied.tri);
397 newval.tri = EXPR_AND(newval.tri,
398 sym->dir_dep.tri);
397 }399 }
398 }400 }
399 calc_newval:401 calc_newval: