Received: by 10.223.185.116 with SMTP id b49csp3870712wrg; Mon, 19 Feb 2018 07:21:06 -0800 (PST) X-Google-Smtp-Source: AH8x225W0fo50rnYWKfz8CwY1kJUAXES74eKNOjdQwhFj9xs7Xhd/wtYZ6PQ3hIIuEAgE8RpzEOx X-Received: by 10.98.216.137 with SMTP id e131mr14696722pfg.17.1519053665918; Mon, 19 Feb 2018 07:21:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519053665; cv=none; d=google.com; s=arc-20160816; b=d4GZtPp8W21mvu+YS0njKtu3ewTyEWDCPa+bzwunySqBISUVCZWXifoa313CQmzdba U2cq+aoyQPfPajmPZodbT6nOB7JYFIlmtkZ2PB65NOPxQhCdFv3c1yblbwY6R3ADMTTK /Gb9xPqRXQz8Ppabji1s6mvw7fwqqnEYB5e4GLLzPSifwcIW4XaxNM2fnO1RAxpQbuol A4pVkobCjsOBdLcYDVRVhciqRPPu0RB02YEYW4QGfQL7qqeDEE9zd2kMr3ITtwik32Tg IZQGYtFpfhSUqRKFcRCqFKppqra93Ezf/iK1T03CMMCPoa9AzAJQTh2E7lXNZ09xsOZa zG9g== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=hxyifqpz0mkTI9IPhUntpEp4OLxDrXBhIInWUNbtQ+A=; b=c00I/tSaU03VkGdHLDywLxIaegM+md22t94Hsj+PZzUNdc0N2NKSavcoNByUCArjnb bUDlOoVXvHW0OW+CnoQ+CkJbFqd3Ngaf1MjmaDLp1pfBLMURU2ZnSFR32hjZL9mTGwNm seKiOnX7iP+xPyvVd/jNu421tOhRow/rm2be2woAkBBDWPZlgBeEt1fuWnhT5icdoKWZ FYKvZgCpstJXfC7gdRkiucGvSAFohROb9wuCWkaZjVsji9+et/h/x+7OGQpBIsjs15c6 EHOZ1x4TrnZc66AQoTIH3iJwti2wrlIQvIVxnv5Bw9Za0820XflT8uk5S40vEttb59jy G/SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XkBbeVHz; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si780300pfl.304.2018.02.19.07.20.51; Mon, 19 Feb 2018 07:21:05 -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=@gmail.com header.s=20161025 header.b=XkBbeVHz; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752985AbeBSPSW (ORCPT + 99 others); Mon, 19 Feb 2018 10:18:22 -0500 Received: from mail-ua0-f196.google.com ([209.85.217.196]:34513 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752492AbeBSPSS (ORCPT ); Mon, 19 Feb 2018 10:18:18 -0500 Received: by mail-ua0-f196.google.com with SMTP id m43so6366416uah.1; Mon, 19 Feb 2018 07:18:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hxyifqpz0mkTI9IPhUntpEp4OLxDrXBhIInWUNbtQ+A=; b=XkBbeVHzJFchcWoqRqInzrQBJBtL3v63pHDYJaAP12wypPfRIqucX5qzneOCAazsKN CQULYZl1oBL3VeptLtYOGKTbvX8oGi75MAjTSoAk792fTtnNqJ1Tmwlwk+lgXIu37zTw QEkWMd5xQs1igAzaTgLEFFCqwTDLImOs/BfGp+hC5b5mWwHo1bAEcekjl7Z8RFTn4+zl ThS7cOxDgwCBOsrzOXPJ8xWF4EQrL5NJUD7EjR3N6PEAvBtriartI9U0wVIG8kFP/8sV hsHvaRU/bgGz3HCUg8sOtlV2Nv7tPwBhi3zKOOrqzrgG+ReMfDlLWvru07F1uYnKZ+ZL yAfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hxyifqpz0mkTI9IPhUntpEp4OLxDrXBhIInWUNbtQ+A=; b=GLk2TmSAF3ARGH1QCoqL5nRvII29+y1uQOvexu41SxjMB/QA89K4c7bMy6vV62UuXH OBcWc+vQFxGFTyPD0yVqlGnFA1aOcAXIfY6gl2dw9ZLpNkelGDUww31Q6fvH2dUQXNF0 +gD2UvzWuRfHs7gYuqYaDDntQdf0v1KaKfSwlovGb59TyTUtCdjFSB/uxtc8yEHGAQth AIPplEKhE/Hu1Yf9/tsOV/yGbj6ULVdtSD36Nj5LkIW4V+tbTGih7WEuUi20QAqdt+6G 8yZfVIShYvvzIoqJ9oLowBiZvaV3/zvGzII4W1L6rTJrToefvZaMa4OJ/CvA8UmV5PlQ KM8w== X-Gm-Message-State: APf1xPCfsKrTRq3bXZVsZwswf85h2QKuwJ6ZK/nWrUR613uM7parlW+x c84kXa88Bl4ROBc15scJkJmx6iffS0XnYsxQyf0= X-Received: by 10.176.79.229 with SMTP id t37mr4003638uah.70.1519053496678; Mon, 19 Feb 2018 07:18:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.70.21 with HTTP; Mon, 19 Feb 2018 07:18:16 -0800 (PST) In-Reply-To: <20180218221352.GA6651@ravnborg.org> References: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com> <20180218221352.GA6651@ravnborg.org> From: Ulf Magnusson Date: Mon, 19 Feb 2018 16:18:16 +0100 Message-ID: Subject: Re: [PATCH 00/23] kconfig: move compiler capability tests to Kconfig To: Sam Ravnborg Cc: Masahiro Yamada , Linux Kbuild mailing list , Linus Torvalds , Greg Kroah-Hartman , Arnd Bergmann , Kees Cook , Randy Dunlap , 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 Mailing List , Richard Weinberger , Emese Revfy 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 Hello, On Sun, Feb 18, 2018 at 11:13 PM, Sam Ravnborg wrote: > 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. I think we should be careful about allowing references to config symbols. It mixes up the parsing and evaluation phases, since $() is expanded during parsing (which I consider a feature and think is needed to retain sanity). Patch 06/23 removes the last existing instance of symbol references in strings by getting rid of 'option env'. That's an improvement to me. We shouldn't add it back. > > 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 Cheers, Ulf