From patchwork Fri Mar 1 07:10:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 159465 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp382181jad; Thu, 28 Feb 2019 23:10:57 -0800 (PST) X-Google-Smtp-Source: APXvYqw7LiZzq/0pUcw3vRmjp/34Xcp1qHvIsl8yhqagOlcnE3k9/SHLzX75sBMcqyyAa0HvPyIO X-Received: by 2002:a62:1551:: with SMTP id 78mr4032883pfv.45.1551424257244; Thu, 28 Feb 2019 23:10:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551424257; cv=none; d=google.com; s=arc-20160816; b=h2XUsJ66vd4vXLS5ZHP9LAhl1Mpa/pUTzEfC/3RlBqz8ebpVnOY67aE3yeeMKXqdRc myOABaSay18/mfgPwf6JHYKYjV7qXlWxa+iHhfwghH5KpKaDLrA9lZycVsDefx0/RB35 Pzds8q/MAYSKZsaoeQUjqMs2/YaGg0DDBPMAIuvbYSL9LOcg5XlG111WCUYIYRdsYOqY y2v1jQIE/ZiE9gU1ATeap3U/pK2oxT6YAQHNar/7eBnNuyUBQdIX0gBe7pxa7ITR7+NL q54RKpLnLEx2dkJVR7SLpq9BmqRrwWqVzddgFHx/X3A1tysHGTMqy2R64IiolU4zEZjh jOkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=8t7excQEtZ3k0zZuNz5dRZOkstOKAajR6OxsjLRcbGs=; b=t1jhqe3VNVdq4MXocQ1SOyWstVNhamXhUHL4RvNaeoKHS9LQYASX8IVR4NvfNOQi9D IKjsd9qpYA6buL/i6MUrDgqLe97Zz5Oo21UbEsFGIRSkbAvag5FUL2PlKl7XS5jQyQ1Z 3UbTSel8dKD0xKMB9Q7vt5uNswJJSEdJXhgzKVB45+o3Abj16GBQUnPBktf93ggCuJLc UVz5b/PiD7I3Rw2mrFc4ugiTH4huG1BuX0kKO5vKZUwR5ONIWEvsFqyz742TxJ6adilJ jp65dIwTa2geCO8Kij0X4OP3weBeOcceXEL7oScHnXbRzmWD0hQpwVRwK4zKGka3HBej CA4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=uQ3era+z; 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 j2si19658532plk.220.2019.02.28.23.10.56; Thu, 28 Feb 2019 23:10:57 -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=uQ3era+z; 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 S1731047AbfCAHKy (ORCPT + 31 others); Fri, 1 Mar 2019 02:10:54 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:16716 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726823AbfCAHKx (ORCPT ); Fri, 1 Mar 2019 02:10:53 -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 x217APwr017759; Fri, 1 Mar 2019 16:10:25 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x217APwr017759 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1551424225; bh=8t7excQEtZ3k0zZuNz5dRZOkstOKAajR6OxsjLRcbGs=; h=From:To:Cc:Subject:Date:From; b=uQ3era+zc3DAxv59/5kHhrafsI8uOdFCVnltLf4qo+rFtb/qRpK6N/qh+3wbdC3m5 /KSBiTDjm/UdqEg5iV06b8d/KYx/6XwFKi/Wywj956et37/0zE1mJXqeHeU+wBxpzW w4T4ybSG8ihRkglQSM5zAyIJRdyh/xnIvIj3Q55fgC0BuA86miIlqgait9YjblAm6C C03KepwLTtIlnejmSxf79q2XAk7/NzHL3khsESCRDXUzyOugG6Q90WOuYU4a/wXTlE itY6JFYH3Ghp4XZ7f1rzdkqLYa7kzVRAGv14YHcqmtANczl27ccHBqmoapf0IQpfmp slt+jhmWvPYUQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] kbuild: update comment block of scripts/clang-version.sh Date: Fri, 1 Mar 2019 16:10:20 +0900 Message-Id: <1551424222-3727-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 469cb7376c06 ("kconfig: add CC_IS_CLANG and CLANG_VERSION") changed the code, but missed to update the comment block. The -p option was gone, and the output is 5-digit (or 6-digit when Clang 10 is released). Update the comment now. Signed-off-by: Masahiro Yamada --- scripts/clang-version.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/scripts/clang-version.sh b/scripts/clang-version.sh index e65fbc3..6fabf06 100755 --- a/scripts/clang-version.sh +++ b/scripts/clang-version.sh @@ -1,14 +1,10 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # -# clang-version [-p] clang-command -# -# Prints the compiler version of `clang-command' in a canonical 4-digit form -# such as `0500' for clang-5.0 etc. -# -# With the -p option, prints the patchlevel as well, for example `050001' for -# clang-5.0.1 etc. +# clang-version clang-command # +# Print the compiler version of `clang-command' in a 5 or 6-digit form +# such as `50001' for clang-5.0.1 etc. compiler="$*" 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) From patchwork Fri Mar 1 07:10:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 159466 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp382207jad; Thu, 28 Feb 2019 23:10:59 -0800 (PST) X-Google-Smtp-Source: APXvYqy/EqL00KVlTglFQJBrlAq4LC5GohmR9WyTyeinR+2/1CoGj9T4YfUapncyUuFZclcAtMZS X-Received: by 2002:a63:54c:: with SMTP id 73mr3379710pgf.295.1551424259490; Thu, 28 Feb 2019 23:10:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551424259; cv=none; d=google.com; s=arc-20160816; b=dHxGZz4ZNQb5MFxHVjx7PMlKTEx21cD1jN4+jCQhnnqdvKRim1mtMIvW78Pv8ElCce YPsJdeA0EYTTA3FCtNjFhJUxVf+JeCIiSgTpwsHFe/Q6CPT6ufWHXm59K7DlIw0BnSpY jGN9IWrp3Gu6mKPPcqUq3cA2XBdNd1jCWOH5j5CYlF96PIFI0MQDImqhQZTTMxLwOxYL 5iXuvdedPzF21S/d1xpT+/idRUCnzsT5N3wmCTo1SGzLm5lbn5zdNXInFPr95S6kotSJ pTsyIzAoUPw/MC8Jm/oHY3jrx8bwiw5Hf05KjzH94aZi4NmRfp9DHy4CKoOt/9QxFsSu f1Eg== 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=C0sHvPANucd8+RgfELTY1HPKylG28HrnpVhzUAgdkk0=; b=iIOfA3+3IGZwsFmaMLvk+TDBUPn5ZJXvhF7+8VWSiM+vR31vXavdkoi0Fn/i+vjXF4 DqR890heFbDlZF8oLvexbG9rDB1zAydW0M2oJ/hzg69pm3p2ncfeMKPYT5XNMk5Ulpyw sKQoOSQ1SQQgnInJycnpFYYmO7As02ob+Yv3L6i8pPMoW8KGh8VnE970oaFfYzPnY/e4 nefKH/eq8TZXOLiMnXdbTj0CTrPtBbnovPFs8CQsSp1nIM/uMUm8w1cQYNhfwyDQqJwS mrUocsGnLJbA16j+6az1jTNdOy81Z9WoHk3q42+W8/F7pe64gaKC77nImWJaFBNv+xIr 55Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=2d9PP7OB; 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 j2si19658532plk.220.2019.02.28.23.10.59; Thu, 28 Feb 2019 23:10:59 -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=2d9PP7OB; 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 S1731831AbfCAHK6 (ORCPT + 31 others); Fri, 1 Mar 2019 02:10:58 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:16717 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfCAHKy (ORCPT ); Fri, 1 Mar 2019 02:10:54 -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 x217APwt017759; Fri, 1 Mar 2019 16:10:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x217APwt017759 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1551424226; bh=C0sHvPANucd8+RgfELTY1HPKylG28HrnpVhzUAgdkk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2d9PP7OBoHFTitYH2UMIfMvNNqNPknytSM9VQng+F2Gmc1kx8uGd03p+jQ8t3EQDK lZ46v3lDLI2ifd3Hzt4XuXQAZ/lzXtlIZhVX5JLPUrtxvBI1s0bvfS3An1j/pMvaEn v+oq5IVsZJulIm3lzfU+PYW8WMOXiCnI4IkWJxIOykzmlRgFyoyPxtiPVCjDzAJhuH tVUF1ILoQxhdsVEuZcFqvHdmCi3X7OKtfQOm9pqqn/W46WQQ5b8PFp+3mU3vpqCXzR bsKArSqls5lTrTRnJ8qSndTHLqMChD4Y5Dt+LB7JEmcVafb9wQWZHOVfQbS1p36Cx8 VFbVeyk7OJdIg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] kbuild: clean up scripts/gcc-version.sh Date: Fri, 1 Mar 2019 16:10:22 +0900 Message-Id: <1551424222-3727-3-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 Now that the Kconfig is the only user of this script, we can drop unneeded code. Remove the -p option, and stop prepending the output with zero, so that Kconfig can directly use the output from this script. Signed-off-by: Masahiro Yamada --- init/Kconfig | 2 +- scripts/Kconfig.include | 2 +- scripts/gcc-version.sh | 27 +++++++-------------------- 3 files changed, 9 insertions(+), 22 deletions(-) -- 2.7.4 diff --git a/init/Kconfig b/init/Kconfig index 1f05a88..74a0217 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -13,7 +13,7 @@ config CC_IS_GCC config GCC_VERSION int - default $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//') if CC_IS_GCC + default $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) if CC_IS_GCC default 0 config CC_IS_CLANG diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include index dad5583..87ff1dc 100644 --- a/scripts/Kconfig.include +++ b/scripts/Kconfig.include @@ -27,4 +27,4 @@ cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) ld-option = $(success,$(LD) -v $(1)) # gcc version including patch level -gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//') +gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh index 11bb909..ae35343 100755 --- a/scripts/gcc-version.sh +++ b/scripts/gcc-version.sh @@ -1,33 +1,20 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # -# gcc-version [-p] gcc-command -# -# Prints the gcc version of `gcc-command' in a canonical 4-digit form -# such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc. -# -# With the -p option, prints the patchlevel as well, for example `029503' for -# gcc-2.95.3, `030301' for gcc-3.3.1, etc. +# gcc-version gcc-command # - -if [ "$1" = "-p" ] ; then - with_patchlevel=1; - shift; -fi +# Print the gcc version of `gcc-command' in a 5 or 6-digit form +# such as `29503' for gcc-2.95.3, `30301' for gcc-3.3.1, etc. 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 exit 1 fi MAJOR=$(echo __GNUC__ | $compiler -E -x c - | tail -n 1) MINOR=$(echo __GNUC_MINOR__ | $compiler -E -x c - | tail -n 1) -if [ "x$with_patchlevel" != "x" ] ; then - PATCHLEVEL=$(echo __GNUC_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 __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1) +printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL