From: Sam Ravnborg <sam@ravnborg.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-kbuild@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Arnd Bergmann <arnd@arndb.de>, Kees Cook <keescook@chromium.org>,
Randy Dunlap <rdunlap@infradead.org>,
Ulf Magnusson <ulfalizer@gmail.com>,
Michal Marek <michal.lkml@markovi.net>,
Peter Oberparleiter <oberpar@linux.vnet.ibm.com>,
kernel-hardening@lists.openwall.com,
Jonathan Corbet <corbet@lwn.net>,
sparclinux@vger.kernel.org, linux-sh@vger.kernel.org,
x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Rich Felker <dalias@libc.org>, Jeff Dike <jdike@addtoit.com>,
"H. Peter Anvin" <hpa@zytor.com>,
user-mode-linux-devel@lists.sourceforge.net,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
linuxppc-dev@lists.ozlabs.org, Paul Mackerras <paulus@samba.org>,
user-mode-linux-user@lists.sourceforge.net,
Ingo Molnar <mingo@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Michael Ellerman <mpe@ellerman.id.au>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Richard Weinberger <richard@nod.at>,
Emese Revfy <re.emese@gmail.com>
Subject: Re: [PATCH 00/23] kconfig: move compiler capability tests to Kconfig
Date: Sun, 18 Feb 2018 23:13:52 +0100 [thread overview]
Message-ID: <20180218221352.GA6651@ravnborg.org> (raw)
In-Reply-To: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com>
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
next prev parent reply other threads:[~2018-02-18 22:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-16 18:38 [PATCH 00/23] kconfig: move compiler capability tests to Kconfig Masahiro Yamada
2018-02-16 18:38 ` [PATCH 21/23] gcc-plugins: move GCC version check for PowerPC " Masahiro Yamada
2018-02-22 5:04 ` Andrew Donnellan
2018-02-18 22:13 ` Sam Ravnborg [this message]
2018-02-19 15:18 ` [PATCH 00/23] kconfig: move compiler capability tests " Ulf Magnusson
2018-02-21 7:38 ` Masahiro Yamada
2018-02-21 9:56 ` Arnd Bergmann
2018-02-21 10:20 ` Masahiro Yamada
2018-02-21 10:52 ` Arnd Bergmann
2018-02-21 12:57 ` Masahiro Yamada
2018-02-21 16:03 ` Arnd Bergmann
2018-02-21 21:39 ` Ulf Magnusson
2018-03-02 5:50 ` Masahiro Yamada
2018-03-02 9:03 ` Ulf Magnusson
2018-03-02 9:12 ` Ulf Magnusson
2018-02-22 3:22 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180218221352.GA6651@ravnborg.org \
--to=sam@ravnborg.org \
--cc=arnd@arndb.de \
--cc=benh@kernel.crashing.org \
--cc=corbet@lwn.net \
--cc=dalias@libc.org \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=jdike@addtoit.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=michal.lkml@markovi.net \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=oberpar@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=rdunlap@infradead.org \
--cc=re.emese@gmail.com \
--cc=richard@nod.at \
--cc=sparclinux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=ulfalizer@gmail.com \
--cc=user-mode-linux-devel@lists.sourceforge.net \
--cc=user-mode-linux-user@lists.sourceforge.net \
--cc=x86@kernel.org \
--cc=yamada.masahiro@socionext.com \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).