Received: by 10.223.185.116 with SMTP id b49csp1067243wrg; Fri, 16 Feb 2018 11:50:34 -0800 (PST) X-Google-Smtp-Source: AH8x226d8zgjSM5n6ah+zveL3mLcIjFmKNpkYpmRTRDuzzg0vG73E5fp8G9Q5Ddf/Ar/Y6GoXZ+v X-Received: by 2002:a17:902:69cf:: with SMTP id m15-v6mr6941908pln.104.1518810634159; Fri, 16 Feb 2018 11:50:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518810634; cv=none; d=google.com; s=arc-20160816; b=ALoNWFLAc8SEVbCksGr34n/2/z8tDkx8pXt3fMeEFIBO1T7viUN+0dSViQrE/lrD5m fDmEsTXKGXFfBKTAQJkL4bOFEC7a7dyggWL3wz6Mhr2MyJzw4rCnpo1FrwfpENBgM0VM FTy+v0uHWydgAhTXy1ni1QeOBtgDr5ZB3j5TgMMZhua/m9fNeXv/NGDpPAstaBwIeEWe Xo4We/Ta+IfOAvwgW8D0wxdL3MCd7tLjs9c50bU3GafIKmFKmXKuh+AZ16PdjMCxqjX1 UnMUhM8/Up3k1LgGl+C1w5XFD8ozU3bJm3N/Ytbwg/SQs1roZ1VlgDgVps2ssCmmeprJ JTYg== 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:arc-authentication-results; bh=4JQSPGiKxYLflk9BrMigDN51Y0jDv17eMkl4bKzIspM=; b=CVSVZKQ/jbnO3Pe6ZqbdMs1z83aWKZn3QGtTtSbcIgXsqKWxeUe2yI/sN7C3RUQG9O e1xCql8hu1KfwRhGxFtFjdohr0qCvfN9NbfmxqQ9ITF4uugeukbOD11D1eHIpYaHFjGM nLbPi2XkohyEOnALmsG5EgTaNjhI4k+PX988g2WeDj3xaGhV9VAZ3fwfps3Od2kHBNma ThYZpWzmKbZA5eAgp6WpDdDIzkkI0Iaka4OEPLBzSuz7g5GoqKpGl94sffZl1qRH5S/I aUJ18Q8pQQgyb9XQusONs1fgcLqRs+LyzlzdbM7MqsaNC/47CODRbvMxOE+MFY4s/28a YQCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=exO+RsIV; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=xpfO5M+O; 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 s88si452721pfa.235.2018.02.16.11.50.18; Fri, 16 Feb 2018 11:50:34 -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=exO+RsIV; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=xpfO5M+O; 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 S1750913AbeBPTtf (ORCPT + 99 others); Fri, 16 Feb 2018 14:49:35 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:59962 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750743AbeBPTtd (ORCPT ); Fri, 16 Feb 2018 14:49:33 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id E8B67CAC55; Fri, 16 Feb 2018 14:49:32 -0500 (EST) 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=2bYTpfDLivbsNdArCbbmw9ngWPc=; b=exO+Rs IVnEfCbTGftiy+fCicbKkVNrOZbUpotMwIQVpifBEWjuXJ18DrfSVrZyowZC+3Sy 4IB4L2uGkB1rklaSsYbrbuY5cl1uqUmKt/AhGgB266cp99a6AWQjo4fHZtAgU8uR fvBIHMMIx4RAzhBfOPMzqeKTPe7U7u7wnEQ34= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id DEE1ACAC53; Fri, 16 Feb 2018 14:49:32 -0500 (EST) 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=km/M/HrzwT8ygoFAvNWqpzaPAT5shmsB64ZEiHFusk8=; b=xpfO5M+O20Cb/id0T8gNDdFXcuhzkOQjy+zRBsobZ/KFUKUWM0DZgdbFaAIpffy74/3y5SP9HhGRTK1cgWRFQN08WiWiA+czMXmPQ5l5oOQ3GV6W50UqJsCDsnQznkpXFM0Shph1qf7VKvfoUWRS8YnpKgLRMlHgyaf5hktmeMA= Received: from yoda.home (unknown [70.82.104.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 61751CAC52; Fri, 16 Feb 2018 14:49:32 -0500 (EST) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id 9AD982DA0419; Fri, 16 Feb 2018 14:49:31 -0500 (EST) Date: Fri, 16 Feb 2018 14:49:31 -0500 (EST) From: Nicolas Pitre To: Masahiro Yamada cc: linux-kbuild@vger.kernel.org, Linus Torvalds , Greg Kroah-Hartman , Arnd Bergmann , Kees Cook , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Michal Marek , linux-kernel@vger.kernel.org Subject: Re: [PATCH 08/23] kconfig: add 'macro' keyword to support user-defined function In-Reply-To: <1518806331-7101-9-git-send-email-yamada.masahiro@socionext.com> Message-ID: References: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com> <1518806331-7101-9-git-send-email-yamada.masahiro@socionext.com> 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: 8201AC4E-1352-11E8-B5B2-692D1A68708C-78420484!pb-smtp1.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 17 Feb 2018, Masahiro Yamada wrote: > Now, we got a basic ability to test compiler capability in Kconfig. > > config CC_HAS_STACKPROTECTOR > bool > default $(shell $CC -Werror -fstack-protector -c -x c /dev/null -o /dev/null) > > This works, but it is ugly to repeat this long boilerplate. > > We want to describe like this: > > config CC_HAS_STACKPROTECTOR > bool > default $(cc-option -fstack-protector) > > It is straight-forward to implement a new function, but I do not like > to hard-code specialized functions like this. Hence, here is another > feature to add functions from Kconfig files. > > A user-defined function can be defined as a string type symbol with > a special keyword 'macro'. It can be referenced in the same way as > built-in functions. This feature was also inspired by Makefile where > user-defined functions are referenced by $(call func-name, args...), > but I omitted the 'call' to makes it shorter. > > The macro definition can contain $(1), $(2), ... which will be replaced > with arguments from the caller. > > Example code: > > config cc-option > string > macro $(shell $CC -Werror $(1) -c -x c /dev/null -o /dev/null) I think this syntax for defining a macro shouldn't start with the "config" keyword, unless you want it to be part of the config symbol space and land it in .config. And typing it as a "string" while it actually returns y/n (hence a bool) is also strange. What about this instead: macro cc-option bool $(shell $CC -Werror $(1) -c -x c /dev/null -o /dev/null) This makes it easier to extend as well if need be. Nicolas