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.
Unified · Split
| @@ -159,11 +159,11 @@ applicable everywhere (see syntax). · 158 unmodified lines | ||
| 159 | 159 | Given the following example:: |
| 160 | 160 | |
| 161 | 161 | config FOO |
| 162 | − tristate | |
| 162 | + tristate "foo" | |
| 163 | 163 | imply BAZ |
| 164 | 164 | |
| 165 | 165 | config BAZ |
| 166 | − tristate | |
| 166 | + tristate "baz" | |
| 167 | 167 | depends on BAR |
| 168 | 168 | |
| 169 | 169 | The following values are possible: |
| @@ -174,6 +174,9 @@ applicable everywhere (see syntax). · 4 unmodified lines | ||
| 174 | 174 | n y n N/m/y |
| 175 | 175 | m y m M/y/n |
| 176 | 176 | 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 | 180 | 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 | 205 | - limiting menu display: "visible if" <expr> |
| 195 | 206 | |
| 196 | 207 | This attribute is only applicable to menu blocks, if the condition is |
| @@ -221,7 +221,7 @@ static void sym_calc_visibility(struct symbol *sym) · 220 unmodified lines | ||
| 221 | 221 | sym_set_changed(sym); |
| 222 | 222 | } |
| 223 | 223 | tri = no; |
| 224 | − if (sym->implied.expr && sym->dir_dep.tri != no) | |
| 224 | + if (sym->implied.expr) | |
| 225 | 225 | tri = expr_calc_value(sym->implied.expr); |
| 226 | 226 | if (tri == mod && sym_get_type(sym) == S_BOOLEAN) |
| 227 | 227 | tri = yes; |
| @@ -394,6 +394,8 @@ void sym_calc_value(struct symbol *sym) · 166 unmodified lines | ||
| 394 | 394 | if (sym->implied.tri != no) { |
| 395 | 395 | sym->flags |= SYMBOL_WRITE; |
| 396 | 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 | 401 | calc_newval: |