Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: /
Date: Fri, 30 Aug 2019 21:41:32
Message-Id: 1567181270.9a057f02f055237593d0b29fcc9357786a659195.whissi@gentoo
1 commit: 9a057f02f055237593d0b29fcc9357786a659195
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 30 16:07:50 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 30 16:07:50 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=9a057f02
7
8 gen_funcs.sh: Import gcc-* functions from toolchain eclass
9
10 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
11
12 gen_funcs.sh | 35 +++++++++++++++++++++++++++++++++++
13 1 file changed, 35 insertions(+)
14
15 diff --git a/gen_funcs.sh b/gen_funcs.sh
16 index 3f285e3..381c645 100755
17 --- a/gen_funcs.sh
18 +++ b/gen_funcs.sh
19 @@ -321,6 +321,41 @@ kv_replace() {
20 var_replace "KV" "${KV}" "${1}"
21 }
22
23 +# Internal func. The first argument is the version info to expand.
24 +# Query the preprocessor to improve compatibility across different
25 +# compilers rather than maintaining a --version flag matrix. #335943
26 +_gcc_fullversion() {
27 + local ver="$1"; shift
28 + set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__")
29 + eval echo "$ver"
30 +}
31 +
32 +# @FUNCTION: gcc-fullversion
33 +# @RETURN: compiler version (major.minor.micro: [3.4.6])
34 +gcc-fullversion() {
35 + _gcc_fullversion '$1.$2.$3' "$@"
36 +}
37 +# @FUNCTION: gcc-version
38 +# @RETURN: compiler version (major.minor: [3.4].6)
39 +gcc-version() {
40 + _gcc_fullversion '$1.$2' "$@"
41 +}
42 +# @FUNCTION: gcc-major-version
43 +# @RETURN: major compiler version (major: [3].4.6)
44 +gcc-major-version() {
45 + _gcc_fullversion '$1' "$@"
46 +}
47 +# @FUNCTION: gcc-minor-version
48 +# @RETURN: minor compiler version (minor: 3.[4].6)
49 +gcc-minor-version() {
50 + _gcc_fullversion '$2' "$@"
51 +}
52 +# @FUNCTION: gcc-micro-version
53 +# @RETURN: micro compiler version (micro: 3.4.[6])
54 +gcc-micro-version() {
55 + _gcc_fullversion '$3' "$@"
56 +}
57 +
58 gen_die() {
59 set +x