Received: by 10.223.185.116 with SMTP id b49csp1055826wrg; Fri, 16 Feb 2018 11:36:13 -0800 (PST) X-Google-Smtp-Source: AH8x224t9Ok0zkfVRI19wj4IGaSdJcqRy4QjMmMDJtdNnrs5P1RvipByauWZoEsdKk1oEfZhQ7Q9 X-Received: by 2002:a17:902:12f:: with SMTP id 44-v6mr6809512plb.403.1518809772951; Fri, 16 Feb 2018 11:36:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518809772; cv=none; d=google.com; s=arc-20160816; b=MmiVYMoESPnP+AoMH9NwTCUxD0YILjzReGeyaBhZ76pO+rYAIG1KzXZHiZ+ASvt5zp IvbjM5IvOHuJP0YnYaLmcDnnTMJgB3Qi5JXqxOPnbM1QlZ3VZogn1h5V5hC7JC+1syAu KQD7dmKXT6Zts9X+tJieBL06oURRmflxscnYXiBm2TbVR+mnnV3l+Tnp267GrcCnNcji RFo+BmyQ0Vx4vewXWksWcTX5B7PiOIwucr+VoKt7uVvGF7MoUjN31L9md1v7hLEEuiPn D25/UMRjyVG4XpckwYI3DjYGiTQrSoWtoWiAe9IX4r7/KSVvuuaBH9BvOloN3kfbafLd OcWA== 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 w16-v6si154280plp.276.2018.02.16.11.35.58; Fri, 16 Feb 2018 11:36:12 -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 S1751237AbeBPSpI (ORCPT + 99 others); Fri, 16 Feb 2018 13:45:08 -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(-) 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 -- 2.7.4