From patchwork Fri Mar 1 07:10:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 159467 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp382353jad; Thu, 28 Feb 2019 23:11:09 -0800 (PST) X-Google-Smtp-Source: APXvYqwo754g7BSEmca4KPXBWTGSv84x7urI1W8c2TbiSKwOddDJ8dnfJsnz+WqPcvmWLWhF1xhN X-Received: by 2002:a17:902:368:: with SMTP id 95mr3915015pld.139.1551424269247; Thu, 28 Feb 2019 23:11:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551424269; cv=none; d=google.com; s=arc-20160816; b=UCznnRdiC5yYNYIq26ZJs1/Q2PgdOgSm7XdjBkZkaUMwv+iDiweomQvGuSzipmYDfE m1OAqGmqGEPSp2Et9qG3YOAo53QwcO2WrD/hJgcsHRbcmK6kAI6JFEK8OF51szh739B/ ORo48yNyoTkpsssZgYJ4kC93OIA5v9NTM2ed0Kfd3jRp8sQYvRoxFOzMdNjRBwWe2mGS 0DVIhev2A6FDJUjp2NUwYqgTDD7hcl79BkECSV/RjVOCqmEvr1jS9EQeT0PSOusivGIB JBcWswzwoSTCHO7sSpJ7T6fqAuuA5Uo3Hk4y01ACNZ4buS657RcvD5WruQFG4JXIt0k7 NiKA== 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; bh=ePc3zu1pq/u4/yjsicbC/fuitXjH2YJiwIfWsJXCxDg=; b=uNJybmBkbLVDIRyyCZOHqde50qIogHBId3qRGE/fWg0m5cwB6GO8UpaKxAw0BZX33d eusJLm4++SD/9u/PQarmMdI7HuFdfXM68IBAfktxFwXXTTQiqDggpEazfN4Fb6Q3vUBT SV4rV0kUlty9LyVLoAOkYJ1vroVJ7VDekiKmjeKGvN1tzTHEAkoURdcAOoqt34SNAl2H AtW8l1uR0PtwNY0E8P9kLu/wr0Fsqt54WPdvKguue/jPSGQSDX1p0i0/41oA0s7UDEGE EjZ32DuMWsyGrtUt4vSqoohic4JEuVvzB/sZBdkAueRR517PJOJODbQSxKPge7+Ifq8t xUWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=A2BS+upC; 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 r35si19752239pgl.379.2019.02.28.23.11.08; Thu, 28 Feb 2019 23:11:09 -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=A2BS+upC; 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 S1732139AbfCAHLH (ORCPT + 31 others); Fri, 1 Mar 2019 02:11:07 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:17147 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfCAHLH (ORCPT ); Fri, 1 Mar 2019 02:11:07 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id x217APws017759; Fri, 1 Mar 2019 16:10:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x217APws017759 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1551424226; bh=ePc3zu1pq/u4/yjsicbC/fuitXjH2YJiwIfWsJXCxDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A2BS+upCGQVuwDAR31FfzgDjbuwt0ph2DhwutBFWobEcpXMzfpoPSJ31RsjRgO+4R 0o8lcb+HbBfd2JdNF2hJhc6gbjKfdXEjIxqnI4MrCZd5vtM6hHT6bvPpcSbL406vAK Gb5PySYpZGyIhbYQDzO5WM+xt+6nqqTG29K4S51hoDgxtsazwKTkDbnXZcFkdo4M2b SkxvANNV1VBHW9GF3oa2Awg5w09vm85sEl8zT9XMRgAiigJKLQObYNyU+wJcAqVjkA VkoIgrDrG4xTyr9AEJcHxtFlxK8NFlwUIFJxzATmjlOqbs1q4gSNj/DnNhiNHQZ1jP tm0Xw9aQQ4HaA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Corbet , Michal Marek Subject: [PATCH 2/3] kbuild: remove cc-version macro Date: Fri, 1 Mar 2019 16:10:21 +0900 Message-Id: <1551424222-3727-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551424222-3727-1-git-send-email-yamada.masahiro@socionext.com> References: <1551424222-3727-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 There is no more direct user of this macro; it is only used by cc-ifversion. Calling this macro is not efficient since it invokes the compiler to get the compiler version. CONFIG_GCC_VERSION is already calculated in the Kconfig stage, so Makefile can reuse it. Here is a note about the slight difference between cc-version and CONFIG_GCC_VERSION: When using Clang, cc-version is evaluated to '0402' because Clang defines __GNUC__ and __GNUC__MINOR__, and looks like GCC 4.2 in the version point of view. On the other hand, CONFIG_GCC_VERSION=0 when $(CC) is clang. There are currently two users of cc-ifversion: arch/mips/loongson64/Platform arch/powerpc/Makefile They are not affected by this change. The format of cc-version is , while CONFIG_GCC_VERSION . I adjusted cc-ifversion for the difference of the number of digits. Signed-off-by: Masahiro Yamada --- Documentation/kbuild/makefiles.txt | 17 ----------------- scripts/Kbuild.include | 5 +---- 2 files changed, 1 insertion(+), 21 deletions(-) -- 2.7.4 diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 48eab0b..f124be6 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -499,23 +499,6 @@ more details, with real examples. In the above example, -Wno-unused-but-set-variable will be added to KBUILD_CFLAGS only if gcc really accepts it. - cc-version - cc-version returns a numerical version of the $(CC) compiler version. - The format is where both are two digits. So for example - gcc 3.41 would return 0341. - cc-version is useful when a specific $(CC) version is faulty in one - area, for example -mregparm=3 was broken in some gcc versions - even though the option was accepted by gcc. - - Example: - #arch/x86/Makefile - cflags-y += $(shell \ - if [ $(cc-version) -ge 0300 ] ; then \ - echo "-mregparm=3"; fi ;) - - In the above example, -mregparm=3 is only used for gcc version greater - than or equal to gcc 3.0. - cc-ifversion cc-ifversion tests the version of $(CC) and equals the fourth parameter if version expression is true, or the fifth (if given) if the version diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index d93250b..b59983e 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -138,12 +138,9 @@ cc-option-yn = $(call try-run,\ cc-disable-warning = $(call try-run,\ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) -# cc-version -cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) - # cc-ifversion # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) -cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo $(3) || echo $(4)) +cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4)) # cc-ldoption # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)