From patchwork Fri Feb 16 18:38:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 128622 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp869041ljc; Fri, 16 Feb 2018 10:47:29 -0800 (PST) X-Google-Smtp-Source: AH8x226JnEs4U+cgucQsNRRkCvKVML4g9Xjbstcdn2TViMH+NZvjWMl56Y7rFLwzsYFb30GIMDKB X-Received: by 2002:a17:902:c81:: with SMTP id 1-v6mr6692188plt.281.1518806849812; Fri, 16 Feb 2018 10:47:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518806849; cv=none; d=google.com; s=arc-20160816; b=BQg3E/zTatuSVoK/C+jj+5sYL0tOXVOmIFalg4fIl7dVdgSlIS+0twenMgGd7AydrC 2t6ukbdTR8FBbmgZSO+4TnXUFhMwBBWgfu0CbHyja9kJNRx+Hifqwwlm+szm/a5p/Btr zBm0Vi0RewiTje4srIrXt6z72XanGZSxw/pbOLuynEbxNJx37WYHm+4dNkAeECfKM3x6 wg71B+k8P4F9JpqwOEvdL2ju9Kh45D4zmbA7smeCZGRTMC2IFPpuYG1TzlKfVfNYpR7I fwH13AynYRfW9qYX+4agzXxQ2/VkSfCjQCqYm9NqrzHrCVTGtUH5Tm1YfwimgcgZtcyz kUEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=D0SFCGOFIy+/Nth0+l6GLQfAxw29uEAyFnvGWq1jc7A=; b=o9JQH4FH/jp1Y0SMVDEFEkUnFx4WWwIAGbVp5KFFFlCP6UIArNdaXfJJ0Qj4MmuyMr bCd9KkwDodkvW2i665VshHmRXdwRehVZH/1VzE4N69ad3ezpOsfT5J7awW6aRWjpi6lY 8mEU/EQHfTNKISf7kxpiTLidvQGELa0apUUBYxt3YOrPz0oa7sYHHocTaaKeBw14f7eN XkgAhfyVQBdc4fBz2Z0DB00XfTY+1ePnvqELe2zgmCU1WowSO2lyQNB4urmZJcujOAMZ MW8PDtwrCj8c+Zj+lbuHtYoMeTqoP/XfCqh8V3dzZhHiraIchaSeb3TDvAk1OV5bzFxV 2FnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Yt/IrWbd; 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 n7si4324240pga.670.2018.02.16.10.47.29; Fri, 16 Feb 2018 10:47:29 -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=@nifty.com header.s=dec2015msa header.b=Yt/IrWbd; 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 S1751267AbeBPSpJ (ORCPT + 28 others); Fri, 16 Feb 2018 13:45:09 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:57776 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752697AbeBPSlT (ORCPT ); Fri, 16 Feb 2018 13:41:19 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w1GIdBTK013418; Sat, 17 Feb 2018 03:39:28 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w1GIdBTK013418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1518806369; bh=D0SFCGOFIy+/Nth0+l6GLQfAxw29uEAyFnvGWq1jc7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yt/IrWbdovkVWI/a78BtJWddlbKNgIUK/X7Pg1FPaDZF2qREBkb3f0DXby7H6nQSe n1qUCg0CcjikdlFyYupOaFEqeDpV/Tgyq60WhiLZZSz7zkWKGJ4QV62UIZ/fij+djo /kLG3XIApBgaNFiStipjmatrieAJNbs6+xApfztQzvrlHTVI8C3PP6QpxyN6RyWH5G ZlkM8lKVctTnz1ABk0pKM51qJ7vZncjI8xhH24RRHxtFsLFDKmYiLr8GJLpgOiFOe6 RndGUJYN2Cv+PszpFIKvVL+P1W3i1M/HiPiCXB1hRS0r5XcwTXWAng7wuwrWMghdH/ CQwAu19/q6UOQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org, Linus Torvalds Cc: Greg Kroah-Hartman , Arnd Bergmann , Kees Cook , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Michal Marek , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 17/23] kconfig: add CC_IS_CLANG and CLANG_VERSION Date: Sat, 17 Feb 2018 03:38:45 +0900 Message-Id: <1518806331-7101-18-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com> References: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This will be useful to describe the clang version dependency. Signed-off-by: Masahiro Yamada --- init/Kconfig | 8 ++++++++ scripts/clang-version.sh | 24 +++++++++++------------- 2 files changed, 19 insertions(+), 13 deletions(-) -- 2.7.4 diff --git a/init/Kconfig b/init/Kconfig index f2da5e9..1b751bc 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -21,6 +21,14 @@ config GCC_VERSION default $(shell-stdout $srctree/scripts/gcc-version.sh -p $CC | sed 's/^0*//') if CC_IS_GCC default 0 +config CC_IS_CLANG + bool + default $(shell $CC --version | grep -q clang) + +config CLANG_VERSION + int + default $(shell-stdout $srctree/scripts/clang-version.sh $CC) + config CONSTRUCTORS bool depends on !UML diff --git a/scripts/clang-version.sh b/scripts/clang-version.sh index 9780efa..d8002d2 100755 --- a/scripts/clang-version.sh +++ b/scripts/clang-version.sh @@ -10,24 +10,22 @@ # clang-5.0.1 etc. # -if [ "$1" = "-p" ] ; then - with_patchlevel=1; - shift; -fi - compiler="$*" if [ ${#compiler} -eq 0 ]; then - echo "Error: No compiler specified." - printf "Usage:\n\t$0 \n" + echo "Error: No compiler specified." >&2 + printf "Usage:\n\t$0 \n" >&2 + echo 0 + exit 1 +fi + +if !( $compiler --version | grep -q clang) ; then + echo "This is not clang." >&2 + echo 0 exit 1 fi MAJOR=$(echo __clang_major__ | $compiler -E -x c - | tail -n 1) MINOR=$(echo __clang_minor__ | $compiler -E -x c - | tail -n 1) -if [ "x$with_patchlevel" != "x" ] ; then - PATCHLEVEL=$(echo __clang_patchlevel__ | $compiler -E -x c - | tail -n 1) - printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL -else - printf "%02d%02d\\n" $MAJOR $MINOR -fi +PATCHLEVEL=$(echo __clang_patchlevel__ | $compiler -E -x c - | tail -n 1) +printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL