Received: by 10.223.185.116 with SMTP id b49csp3104304wrg; Sun, 18 Feb 2018 14:15:28 -0800 (PST) X-Google-Smtp-Source: AH8x224NsIWvMYOHSSb8J7N1TQBn6seTAI7J0rmwvlxzfNvETRXrmfjdMnCCsHvWt4btUpFp6sQ/ X-Received: by 2002:a17:902:9a06:: with SMTP id v6-v6mr7173474plp.311.1518992128532; Sun, 18 Feb 2018 14:15:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518992128; cv=none; d=google.com; s=arc-20160816; b=uFgWolJUf4P5wiZFvAcIjGMIH3aCQcTCYl8kfmhjTu/1nQSTwURQxMfXiRXy2628c9 +lZ4WBnHrt4OiAcPjryJEcDtKZZGG4fBsnPLNXnYr9Cmj8PKBfTelPYYSaOs59HwMAGS NZ3XEd8+i+xKgW+ahE6iyDVQkyPdTDE9UR63EeMafARW8m/yxAApvqdrTeQMTkt2Vtvu zVYowtAsicFkjXzhDPogKV9a0L8Ej/DjdMtSvDOLov/Y0ySfe9lk9q6hlW5/hkKcGYYP dnJBbHqtkC1c4OgZSCanuij3sEHqmMx2dERZOEvlnSVGqUpcJAiFdh49nKn3sJ7L+9ES qEEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=84KxJAVEeU7/9eT2azVYL/1rFFEHMMIVGnFC4vwNpGI=; b=weRSbtrDRhWk4JGfge0wK6HpfHV7Yiq3R6xvYQvXRYOuaza1U58RnrOQs7c+P8JAwI 6k21mitGuPDtQe8b+K7UaBoexuwhwhR2QCKsXpBMQO5crvhi3pEtyC7P+rvdmNKPu0ts KCGzxxET1iqUt9/xFeVd1c4LhfK/Rvkz0yeIs53vfDGVjySnSnjR4r1t1xP8DIjyczNx VK9o6kW03t/+supkXN55nxSKDIx7LxLEnAyOe2oTfwGmCed7TofsXNUtzLf1nsag8uhl YyN1tgGP/4OQAhMg9ZuVEJERJzXm0Zefg490wWO5SSvV4so/W2CxPVyTZ7acYgVblK2f XX3w== ARC-Authentication-Results: i=1; mx.google.com; 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 u80si322653pfg.402.2018.02.18.14.15.12; Sun, 18 Feb 2018 14:15:28 -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; 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 S1751790AbeBRWOF (ORCPT + 99 others); Sun, 18 Feb 2018 17:14:05 -0500 Received: from asavdk3.altibox.net ([109.247.116.14]:46098 "EHLO asavdk3.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751576AbeBRWOC (ORCPT ); Sun, 18 Feb 2018 17:14:02 -0500 Received: from ravnborg.org (126.158-248-196.customer.lyse.net [158.248.196.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by asavdk3.altibox.net (Postfix) with ESMTPS id 532C020031; Sun, 18 Feb 2018 23:13:54 +0100 (CET) Date: Sun, 18 Feb 2018 23:13:52 +0100 From: Sam Ravnborg To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, Linus Torvalds , Greg Kroah-Hartman , Arnd Bergmann , Kees Cook , Randy Dunlap , Ulf Magnusson , Michal Marek , Peter Oberparleiter , kernel-hardening@lists.openwall.com, Jonathan Corbet , sparclinux@vger.kernel.org, linux-sh@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Rich Felker , Jeff Dike , "H. Peter Anvin" , user-mode-linux-devel@lists.sourceforge.net, Yoshinori Sato , Benjamin Herrenschmidt , linuxppc-dev@lists.ozlabs.org, Paul Mackerras , user-mode-linux-user@lists.sourceforge.net, Ingo Molnar , "David S. Miller" , Michael Ellerman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Weinberger , Emese Revfy Subject: Re: [PATCH 00/23] kconfig: move compiler capability tests to Kconfig Message-ID: <20180218221352.GA6651@ravnborg.org> References: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=W9cWqyek c=1 sm=1 tr=0 a=ddpE2eP9Sid01c7MzoqXPA==:117 a=ddpE2eP9Sid01c7MzoqXPA==:17 a=kj9zAlcOel0A:10 a=fIvg0Y2KpfyUdLn-zlAA:9 a=CjuIK1q_8ugA:10 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masahiro. On Sat, Feb 17, 2018 at 03:38:28AM +0900, Masahiro Yamada wrote: > I brushed up the implementation in this version. > > In the previous RFC, CC_HAS_ was described by using 'option shell=', > like this: > > config CC_HAS_STACKPROTECTOR > bool > option shell="$CC -Werror -fstack-protector -c -x c /dev/null" > > After I thought a bit more, the following syntax is more grammatical, > and flexible. > > config CC_HAS_STACKPROTECTOR > bool > default $(shell $CC -Werror -fstack-protector -c -x c /dev/null) Looks good - but maybe we should go one step further. So we in the syntax explicit handles: - shell commands - other commands, defined as strings - environment variables - config variables Each case is explicit - so the reader is not confused what is used when. $(shell foo) - output of the shell command foo. Uses $SHELL as the shell. May include optional paramters. foo may be a config variable referenced using ${} or a config variable prefixed with $ Example: config BUILD_DIR string default $(shell cd ${objtree}; pwd) $(call bar) - output of the bar command that may take optional parameters. bar may be a text string, a config variable or an environment variable The definition of bar may reference the parameters using $(1), $(2) In this context a config variable needs to be prefixed with $ Example: config reverse string default $(2) $(1) config NEW_ORDER string $(call $reverse, A, B) # Will assign REVERSE the value "B A" Example2: config CC_OPTION string default $(shell ${srctree}/scripts/cc-option ${CC} $(1) $(2)) config CC_OPTIMIZE string $(call $CC_OPTION, -Oz, -Os) ${FOO} - environment variable The above is inspired by how make implement similar functionality. I'm not happy that we in one context can reference CONFIG variables directly, but inside the $(call ...) and $(shell ...) needs the $ prefix. But I could not come up with something un-ambigious where this could be avoided. The above proposal include the functionality of the macro stuff proposed in this patch-set. But with a simpler syntax and we keep all the other kconfig logic (depends on etc) - so users will not be limited in their creativity. > Current limitations: > > Dependency on outside scripts. > Inter-option dependency: > Functions are evaluated statically: Same limitations exists with the syntax suggested above. Sam