linux-brain/scripts/kconfig/tests/err_recursive_dep/Kconfig
Masahiro Yamada 5e8c5299d3 kconfig: report recursive dependency involving 'imply'
Currently, Kconfig does not complain about the recursive dependency
where 'imply' keywords are involved.

[Test Code]

  config A
          bool "a"

  config B
          bool "b"
          imply A
          depends on A

In the code above, Kconfig cannot calculate the symbol values correctly
due to the circular dependency.  For example, allyesconfig followed by
syncconfig results in an odd behavior because CONFIG_B becomes visible
in syncconfig.

  $ make allyesconfig
  scripts/kconfig/conf  --allyesconfig Kconfig
  #
  # configuration written to .config
  #
  $ cat .config
  #
  # Automatically generated file; DO NOT EDIT.
  # Main menu
  #
  CONFIG_A=y
  $ make syncconfig
  scripts/kconfig/conf  --syncconfig Kconfig
  *
  * Restart config...
  *
  *
  * Main menu
  *
  a (A) [Y/n/?] y
    b (B) [N/y/?] (NEW)

To detect this correctly, sym_check_expr_deps() should recurse to
not only sym->rev_dep.expr but also sym->implied.expr .

At this moment, sym_check_print_recursive() cannot distinguish
'select' and 'imply' since it does not know the precise context
where the recursive dependency has been hit.  This will be solved
by the next commit.

In fact, even the document and the unit-test are confused.  Using
'imply' does not solve recursive dependency since 'imply' addresses
the unmet direct dependency, which 'select' could cause.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Dirk Gouders <dirk@gouders.net>
2018-08-22 23:21:39 +09:00

64 lines
587 B
Plaintext

# SPDX-License-Identifier: GPL-2.0
# depends on itself
config A
bool "A"
depends on A
# select itself
config B
bool
select B
# depends on each other
config C1
bool "C1"
depends on C2
config C2
bool "C2"
depends on C1
# depends on and select
config D1
bool "D1"
depends on D2
select D2
config D2
bool
# depends on and imply
config E1
bool "E1"
depends on E2
imply E2
config E2
bool "E2"
# property
config F1
bool "F1"
default F2
config F2
bool "F2"
depends on F1
# menu
menu "menu depending on its content"
depends on G
config G
bool "G"
endmenu