Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp379323ybv; Wed, 19 Feb 2020 23:46:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzgXmHwKx3yKq0jhCq6hDzg4nO2SNu4usZgI/zvbS++5LRtdB9qadSK80WYF5SmYhqtwtuw X-Received: by 2002:a05:6830:1d93:: with SMTP id y19mr22934575oti.350.1582184787279; Wed, 19 Feb 2020 23:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582184787; cv=none; d=google.com; s=arc-20160816; b=WxLvsfvdrLdesg2PEjhH3shfYJBOS44W/YGv47IRaeA5E9a3HGB8GakR3ivjkZUsqF vDY+FCzp+uSvQf588ii2c+6wgk1KGNrOLaQCPBjwl370vqtJgxu9sHRO5cBuzzl+XNcF 2rTPCYLSoN7Q+WsRfS1Egjc9veVJpT3HtBDXnSlH6AJywOjExLTBCqZUp414pq2R7Zr3 LrImA89MG62gxzLJBY5duMVBVDYcyKzE0nMMlOUOhZNJpktIgjf7O1+YB3thlVZ4pE8h luDR124WdenkwxmyBLfpVGZEtcHBQaf9YcRBFiu8sWXCGmBrXfF41mSfre9SXj4JomB9 r0gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=6zhzpzAVSdaGoqnVCzrCzV7UypsIepdCzBEW+mzNg4g=; b=lMrdRE7ejb/6UT16O4KjJ3TndKe6vr4Emi8C24zRV+5ZOJEPB89SOlC16yrAJLwX+o lkLc950FY7oDJoP1oBJcXkZf6OnEC7Diq8CpiYYA8QYcOtT41T0qCRp/9fIxjaSvyl1l 3TXirlf7XV+ZZwKTk5avyquU6cO1O1XB/8+CxqhYrNOJ+reSITWCEpSxOgX+3J1X6CG4 339pXl98vs+Gx1GjXXXkJAo4go0fIEIBs2COLrcYJM2OU2+OGbGTTwEWj95STzgLUAAI WqYg9JMqs0fiRXsZ8LXZ7cEqcY6jqIGpy1cVKNakNGbP0QvD+wZjZNY2Mqoy2rDIUXmH cR4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=LzqgfMc5; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4si1244207otq.188.2020.02.19.23.46.14; Wed, 19 Feb 2020 23:46:27 -0800 (PST) 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=@nifty.com header.s=dec2015msa header.b=LzqgfMc5; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726783AbgBTHqH (ORCPT + 99 others); Thu, 20 Feb 2020 02:46:07 -0500 Received: from conssluserg-05.nifty.com ([210.131.2.90]:48072 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726248AbgBTHqH (ORCPT ); Thu, 20 Feb 2020 02:46:07 -0500 Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 01K7jnNe017759; Thu, 20 Feb 2020 16:45:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 01K7jnNe017759 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1582184750; bh=6zhzpzAVSdaGoqnVCzrCzV7UypsIepdCzBEW+mzNg4g=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LzqgfMc5G4lrLV1+sfUx8shwfKt4So/roIe/QPFBZsftvSnpYuoiMicA1h6NQHmHL KRMW9qD0IKqNMz38uF7hSEK+A5cZQ/hj6QtlKf5DmnNnHMJjoOdlU4xvcXXMKz2I8x ipN8SdwcTbtobL5tEqwwlJY9hs2PUmo3GEaN+pJjyNoqKSvWFqO9n8AR9TAecFdmTq SmPZegvYZHleOTdJrJMDnugBnSF6JxMCQ/09vtHlgraz1gxRiKU4/MrF8jEzeyZLAY PM7nNh1ry9rhrqwvAoUsI8MC9NgygmFLVrKYQOGNnyfjdj8nvrisv5X786gB435ppk vMPK1IY94OzGQ== X-Nifty-SrcIP: [209.85.217.53] Received: by mail-vs1-f53.google.com with SMTP id b79so2071468vsd.9; Wed, 19 Feb 2020 23:45:50 -0800 (PST) X-Gm-Message-State: APjAAAWqOH3hicYnmZzQ3CInviekLBJkHj93T5eGzbQzOiUTjuGCY2M9 CbF7i+zsSOP15i7jWj2h8Pbd9eFlTfG4C4qJppw= X-Received: by 2002:a67:6485:: with SMTP id y127mr17007256vsb.54.1582184749282; Wed, 19 Feb 2020 23:45:49 -0800 (PST) MIME-Version: 1.0 References: <20200219074950.23344-1-masahiroy@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Thu, 20 Feb 2020 16:45:13 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kconfig: make 'imply' obey the direct dependency To: Nicolas Pitre Cc: Linux Kbuild mailing list , Arnd Bergmann , Richard Cochran , Thomas Gleixner , John Stultz , Josh Triplett , Mark Brown , Ulf Magnusson , Geert Uytterhoeven , Jonathan Corbet , Michal Marek , "open list:DOCUMENTATION" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nicolas, On Thu, Feb 20, 2020 at 1:16 AM Nicolas Pitre wrote: > > On Wed, 19 Feb 2020, Masahiro Yamada wrote: > > > 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 ignores 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' should be weaker than 'depends on', Kconfig should > > take the direct dependency into account. > > > > Describe this case in Documentation/kbuild/kconfig-language.rst for > > clarification. > > > > Commit 237e3ad0f195 ("Kconfig: Introduce the "imply" keyword") says that > > a symbol implied by y is restricted to y or n, excluding m. > > > > As for the combination of FOO=y and BAR=m, the case of BAZ=m is excluded > > by the 'imply', and BAZ=y is also excluded by 'depends on'. So, only the > > possible value is BAZ=n. > > I don't think this is right. The imply keyword provide influence over > another symbol but it should not impose any restrictions. If BAR=m then > BAZ should still be allowed to be m or n. > > > @@ -174,6 +174,9 @@ applicable everywhere (see syntax). > > n y n N/m/y > > m y m M/y/n > > y y y Y/n > > + n m n N/m > > + m m m M/n > > + y m n N > > Here the last line shoule be y m n N/m. > > Generally speaking, the code enabled by FOO may rely on functionalities > provided by BAZ only when BAZ >= FOO. This is accomplished with > IS_REACHABLE(): > > foo_init() > { > if (IS_REACHABLE(CONFIG_BAZ)) > baz_register(&foo); > ... > } > > So if FOO=y and BAZ=m then IS_REACHABLE(CONFIG_BAZ) will be false. Maybe > adding a note to that effect linked to the "y m n N/m" line in the table > would be a good idea. > I also thought so. I agree IS_REACHABLE() is much saner approach. So, do you agree to change the current behavior as follows? index d0111dd26410..47dbfd1ee003 100644 --- a/Documentation/kbuild/kconfig-language.rst +++ b/Documentation/kbuild/kconfig-language.rst @@ -173,7 +173,7 @@ applicable everywhere (see syntax). === === ============= ============== n y n N/m/y m y m M/y/n - y y y Y/n + y y y Y/m/n y n * N === === ============= ============== -- Best Regards Masahiro Yamada