# Simple Kconfig recursive issue # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Test with: # # make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig # # This Kconfig file has a simple recursive dependency issue. In order to # understand why this recursive dependency issue occurs lets consider what # Kconfig needs to address. We iterate over what Kconfig needs to address # by stepping through the questions it needs to address sequentially. # # * What values are possible for [31mCONFIG_CORE[0m? # # [31mCONFIG_CORE_BELL_A_ADVANCED[0m selects [31mCONFIG_CORE[0m, which means that it influences the values # that are possible for [31mCONFIG_CORE[0m. So for example if [31mCONFIG_CORE_BELL_A_ADVANCED[0m is 'y', # [31mCONFIG_CORE[0m must be 'y' too. # # * What influences [31mCONFIG_CORE_BELL_A_ADVANCED[0m ? # # As the name implies [31mCONFIG_CORE_BELL_A_ADVANCED[0m is an advanced feature of # [31mCONFIG_CORE_BELL_A[0m so naturally it depends on [31mCONFIG_CORE_BELL_A[0m. So if [31mCONFIG_CORE_BELL_A[0m is 'y' # we know [31mCONFIG_CORE_BELL_A_ADVANCED[0m can be 'y' too. # # * What influences [31mCONFIG_CORE_BELL_A[0m ? # # [31mCONFIG_CORE_BELL_A[0m depends on [31mCONFIG_CORE[0m, so [31mCONFIG_CORE[0m influences [31mCONFIG_CORE_BELL_A[0m. # # But that is a problem, because this means that in order to determine # what values are possible for [31mCONFIG_CORE[0m we ended up needing to address questions # regarding possible values of [31mCONFIG_CORE[0m itself again. Answering the original # question of what are the possible values of [31mCONFIG_CORE[0m would make the kconfig # tools run in a loop. When this happens Kconfig exits and complains about # the "recursive dependency detected" error. # # Reading the Documentation/kbuild/Kconfig.recursion-issue-01 file it may be # obvious that an easy to solution to this problem should just be the removal # of the "select CORE" from [31mCONFIG_CORE_BELL_A_ADVANCED[0m as that is implicit already # since [31mCONFIG_CORE_BELL_A[0m depends on [31mCONFIG_CORE[0m. Recursive dependency issues are not always # so trivial to resolve, we provide another example below of practical # implications of this recursive issue where the solution is perhaps not so # easy to understand. Note that matching semantics on the dependency on # [31mCONFIG_CORE[0m also consist of a solution to this recursive problem. mainmenu "Simple example to demo kconfig recursive dependency issue" config [31mCONFIG_CORE[0m tristate config [31mCONFIG_CORE_BELL_A[0m tristate depends on [31mCONFIG_CORE[0m config [31mCONFIG_CORE_BELL_A_ADVANCED[0m tristate depends on [31mCONFIG_CORE_BELL_A[0m select [31mCONFIG_CORE[0m |