Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp739688ybv; Wed, 19 Feb 2020 08:17:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxD9/cngjwiScfSZUxdcf5raR4j5WsMKUp5XKFK3/88aZqU7wrXkNjZrnX0yADVCfL2MhDn X-Received: by 2002:aca:f584:: with SMTP id t126mr5302277oih.132.1582129043783; Wed, 19 Feb 2020 08:17:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582129043; cv=none; d=google.com; s=arc-20160816; b=X0GuCTaxasnVLHtHC0BbWrC1XRQCcMcG/vQDp48PHjrMU52mYDgrHfYuLLbeaKMAlj P2BjJ0ExMcbkRTnyENgf4uzYNVyPJphKzpmQF3p6V3S2oWl2kPNvCJ0pXKPA7h4tGu+X jl2BdOhfmXRc80J3bsFRT2SHw8FTEjxn8oaxU+skxm5WPBsJvUAlaA0pPboBXlKof1Sp tyrphRYDc2ub/X33OrIkV5IzhpKipp7B4xu8BUfy1qv4XYBpiJ9XWzZOlmFCVdFaMvnj Ddvqbpa+0ggllB/n31bTcdjgwVXkZTEJhX5iSIvY+TZVwWYMmkrvAJqOfoAlKtr5w4nS tPaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=s3mIZ+9twIuyizui6ussLTH/HmE/KY7YdSig+5OPTvM=; b=Ax/mau3B2Lr9FL7nKWWD9n4N6Dv52eRPjwm3/6vjJtDxQH3QVm+K/r0IFTqI3SkiYL vyplhOpB0bNNTsiFaUxqkbz+3qPoxYN+1IJAUwiexjIsfniqLjn7aJKbfePBLE8UUse4 T+M6TKLONrXGHJiP5j6Gqhq934KC3RledqQZ3SHXioR/aXCS82hq9rDDA4EkDeOXU4oY rvXXOv9FX7QEF43mCKcVK1voWJrnoVB43fH4V7/BfoHQI5BBinsj3Lotxc52icNb6FF5 d9CxPq632G/5WRK7fQseqMK2qSqdyhjmDSfZXs2KM7HltFkljtp4y0qAraEl8TJUNxtj YjCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=A8qbss13; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=XjVUwBq4; 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 y9si94979otk.136.2020.02.19.08.17.11; Wed, 19 Feb 2020 08:17:23 -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=@pobox.com header.s=sasl header.b=A8qbss13; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=XjVUwBq4; 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 S1726789AbgBSQQG (ORCPT + 99 others); Wed, 19 Feb 2020 11:16:06 -0500 Received: from pb-smtp21.pobox.com ([173.228.157.53]:56037 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbgBSQQF (ORCPT ); Wed, 19 Feb 2020 11:16:05 -0500 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 8A923C3D6B; Wed, 19 Feb 2020 11:16:02 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=XtMU/4b5IGSfpYkZCGu5uzpv9so=; b=A8qbss 13zDDHQnllBhRUStKjdBhjG42y4BdLYd3zfE8x1c4GnTnmbAESYHedrpLZFkObOZ u9dW0ZWY913qGaVl11sWPaCZkC0sGalwZGpbDBZuD6HtuAdzUAZ1YVoxoE5OdS52 V8CrxmDNSgRILwM7+x8MSPXE+Rokl9mrToE9E= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 82969C3D6A; Wed, 19 Feb 2020 11:16:02 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=fluxnic.net; h=date:from:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type; s=2016-12.pbsmtp; bh=Pd52co5mLcPM8CNVJEjnyKKtge8+vEpzfcY4NUuaImw=; b=XjVUwBq4gU1kuQh3xuy1rbq0RW9fP8wTQa5Jwow7zjC6ptzC0o8Ta9cc9VzySvsICTvf6ZRekv6M9gJb24DQ872/8Zk7nognGX/xuQOQLjf6Jk2kB6vQBUBckDHEoAiawi2bvaQkbVB+QJFyMeffogIyDbC6hg2dyx8dH1hrRCY= Received: from yoda.home (unknown [24.203.50.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id 5E1AEC3D67; Wed, 19 Feb 2020 11:15:59 -0500 (EST) (envelope-from nico@fluxnic.net) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id 8007A2DA08DE; Wed, 19 Feb 2020 11:15:57 -0500 (EST) Date: Wed, 19 Feb 2020 11:15:57 -0500 (EST) From: Nicolas Pitre To: Masahiro Yamada cc: linux-kbuild@vger.kernel.org, Arnd Bergmann , Richard Cochran , Thomas Gleixner , John Stultz , Josh Triplett , Mark Brown , Ulf Magnusson , Geert Uytterhoeven , Jonathan Corbet , Michal Marek , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kconfig: make 'imply' obey the direct dependency In-Reply-To: <20200219074950.23344-1-masahiroy@kernel.org> Message-ID: References: <20200219074950.23344-1-masahiroy@kernel.org> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Pobox-Relay-ID: 1DA55B42-5333-11EA-A2D4-8D86F504CC47-78420484!pb-smtp21.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Nicolas