Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4268602ooa; Tue, 14 Aug 2018 03:46:16 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxnjPd24jaQ3B7zAIrWYi9jle4Tf8SdEubPX8eD1XH9HJ8kGxBG6YKwcHJpZ6YmQN7m5t3g X-Received: by 2002:a17:902:227:: with SMTP id 36-v6mr20247507plc.103.1534243576586; Tue, 14 Aug 2018 03:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534243576; cv=none; d=google.com; s=arc-20160816; b=BRxSG4sK7W3LvQs5tYKK/EXrfMOyMHaxs3aIeLeKRC0Lom3KsZyZMNpMBDChTjZblB DRXJV+HyYLXXRs487AW7pHvMEWgR26lJ9rvZ6a7ski1PPwdsVjxYL6iwCeaph9ITKOnv tBl6n6WebA35hW+R7jXaLKPHLewDSsbaCo2dQpO3eWc677Ns3MNM3iqEFIM0LaBXfQct BdBafXQBP3LxVGVDYmJCyX+G7IB27gV/8H5LUr1U5pN6Q6GMq6mO3ntOdEvpI7XXGbSc S9zkzQ7pqJevsbtvKFv9+X0Q4EFOyg3EJ79aGXfbNvkDILMNlKyvBbXz29TOt/87an8p MeOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=CHBl/rPyYVMPB4iqcE5ZYlq1uVIGNOgccJf41MbOOH8=; b=nhzdn1l21Qqie11dX3b4W5qVRYhZ/0QAtBilD556+iurTQhHyfYGmiwzG/iRAVxBJi 7d3599RfXO7iA1/nh7EAFp1sYxwgVs4YWzVPDIF8o67+cPZN9MVUQUUno5l20UaDr3dN 4a28J90hA2hTm8a8ue+FMnpx5VaWGQVFB8suHYAuFvVyYWa8B13F9WzvonwKAV2lDPsN d+recQnpODxrNUgu7c19OYceO17AN/ISAmzfw0VTQJXOup7gYbbcDpfqwtqc4kjVyxI1 bLQbUAsM/90SdH+m4QYgrdF+ln+zKA0wn7Ch6BuWhfovQCmnKAOW0jEmLJpPWU4lCh8N X10A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gouders.net header.s=gnet header.b=nudQ106j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4-v6si20427667pgl.139.2018.08.14.03.46.01; Tue, 14 Aug 2018 03:46:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gouders.net header.s=gnet header.b=nudQ106j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732231AbeHNNbt (ORCPT + 99 others); Tue, 14 Aug 2018 09:31:49 -0400 Received: from services.gouders.net ([141.101.32.176]:53328 "EHLO services.gouders.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731957AbeHNNbt (ORCPT ); Tue, 14 Aug 2018 09:31:49 -0400 Received: from localhost ([193.175.198.193]) (authenticated bits=0) by services.gouders.net (8.14.8/8.14.8) with ESMTP id w7EAcQsX023477 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Aug 2018 12:38:26 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gouders.net; s=gnet; t=1534243107; bh=9cewOiH228aYA4iUl+nAWdJpjpkPj/m5j02YWXqGfMI=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=nudQ106jO/e6GGEJ4oWAzL1mylQIPtteAJuEufBeJSK6nFE12QU1VUv+Ft7bN/RZr 6AqxO1uVX+J79Asl0UfaFO//aeOYJhsZIN63kyiwmFyHw8YNN/SIxUb3xpMNky0qFf E+NQHMxmBgCcqD8LCwc4fU/zt6bcpU/5JgNh07sY= From: Dirk Gouders To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, Michal Marek , Sam Ravnborg , Ulf Magnusson , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] kconfig: report recursive dependency involving 'imply' In-Reply-To: <1534229021-8056-1-git-send-email-yamada.masahiro@socionext.com> (Masahiro Yamada's message of "Tue, 14 Aug 2018 15:43:40 +0900") References: <1534229021-8056-1-git-send-email-yamada.masahiro@socionext.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Date: Tue, 14 Aug 2018 12:38:25 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Masahiro Yamada writes: > Currently, Kconfig does not report anything about the recursive > dependency where 'imply' keywords are involved. > > [Test Code] > > config A > bool "a" > > config B > bool "b" > imply A > depends on A Hello Masahiro, obviously, it is hard to find a reason why one wants to use dependencies like above but I also wonder how e.g. menuconfig handles this case: First, only "a" is visible, if I then select "a", "b" does not become visible but when I then reset "a" to "n", "b" becomes visible. If I then try to select "b", it becomes invisible... Perhaps it would be better to just error out instead of giving users the impression, Kconfig thinks such questionable behavior is OK. Side note: perhaps, the documentation could be better when it comes to recursive dependencies. The documentation says "select" and "imply" can be used to specify lower limits whereas direct dependencies specify upper limits for symbol values and with this in mind, one might wonder why it is a problem to work with both limits in a recursive way. Not very unlikely that it is just me who still has to understand recursive dependencies or problems with reading English text, though. What definitely seems to get void with your patches is item c) in "Practical solutions to kconfig recursive issue" in Documentation/kbuild/kconfig-language: c) Consider the use of "imply" instead of "select" Dirk > 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 report 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 is hit. This will be solved by > the next commit. > > Signed-off-by: Masahiro Yamada > --- > > scripts/kconfig/symbol.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c > index 4ec8b1f..7de7463a 100644 > --- a/scripts/kconfig/symbol.c > +++ b/scripts/kconfig/symbol.c > @@ -1098,7 +1098,7 @@ static void sym_check_print_recursive(struct symbol *last_sym) > sym->name ? sym->name : "", > next_sym->name ? next_sym->name : ""); > } else { > - fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n", > + fprintf(stderr, "%s:%d:\tsymbol %s is selected or implied by %s\n", > prop->file->name, prop->lineno, > sym->name ? sym->name : "", > next_sym->name ? next_sym->name : ""); > @@ -1161,8 +1161,13 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym) > if (sym2) > goto out; > > + sym2 = sym_check_expr_deps(sym->implied.expr); > + if (sym2) > + goto out; > + > for (prop = sym->prop; prop; prop = prop->next) { > - if (prop->type == P_CHOICE || prop->type == P_SELECT) > + if (prop->type == P_CHOICE || prop->type == P_SELECT || > + prop->type == P_IMPLY) > continue; > stack.prop = prop; > sym2 = sym_check_expr_deps(prop->visible.expr);