From patchwork Tue Mar 27 05:29:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10309297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 067436037D for ; Tue, 27 Mar 2018 05:35:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAA7029A77 for ; Tue, 27 Mar 2018 05:35:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF57629AE0; Tue, 27 Mar 2018 05:35:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66A1B29A77 for ; Tue, 27 Mar 2018 05:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752031AbeC0FcD (ORCPT ); Tue, 27 Mar 2018 01:32:03 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:44594 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751824AbeC0FcA (ORCPT ); Tue, 27 Mar 2018 01:32:00 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id w2R5TaLt011947; Tue, 27 Mar 2018 14:29:49 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w2R5TaLt011947 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1522128590; bh=6WjQL00enGkVi5o0NmgKQEyQtdjD15+bMKSxvKuX21Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hWZA5rAgTdtyQlLHlLR8bImQVEDz+6RHMxv4k44d0mU4URPF2saV+jcl4Watm6WbU 3YZqviUtjodS+j6r5KZ+m+zkD19Pv4AaL3fjvVgRbqIZ+2fEV4PHovZCmIxUBSv88+ cZ91CDirSz9Bjuy4rWs0mD9WxqCKdyZKKafvIQ6aNKg1uCQGamL2fuLaMp+iXYFroB WtJUFWALvbwoLPOYpKOYOIv2Pag32mvqNYC/fyfXpgquiY1pZsCIP3xMQc9GzDLJUC NMax/GPJSwaFZv4pOrC3oVRQnATNb0R6LubYWVuzXiZPM9AkltiCrMAB72m80FUIhF SdviJmqJDT4Xg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Linus Torvalds , Arnd Bergmann , Ulf Magnusson , Kees Cook , Thomas Gleixner , Greg Kroah-Hartman , Randy Dunlap , "Luis R . Rodriguez" , Nicolas Pitre , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 10/21] kconfig: add 'success' and 'cc-option' macros Date: Tue, 27 Mar 2018 14:29:24 +0900 Message-Id: <1522128575-5326-11-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522128575-5326-1-git-send-email-yamada.masahiro@socionext.com> References: <1522128575-5326-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 'cc-option' will be the most frequently used macro. It evaluates to 'y' if the given argument is supported by the compiler, or 'n' otherwise. Signed-off-by: Masahiro Yamada Reviewed-by: Kees Cook Reviewed-by: Ulf Magnusson --- Changes in v2: - Implement 'success' as a macro init/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init/Kconfig b/init/Kconfig index 0d6fe20..c456030 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -8,6 +8,12 @@ config DEFCONFIG_LIST default ARCH_DEFCONFIG default "arch/$ARCH/defconfig" +# expanded to y if the command exits with 0, n otherwise +macro success $(shell ($(1) && echo y) || echo n) + +# expanded to y if the given compiler flag is supported, n otherwise +macro cc-option $(success $CC -Werror $(1) -c -x c /dev/null -o /dev/null) + config CONSTRUCTORS bool depends on !UML