Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: toolchain@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 4/4] toolchain-funcs.eclass: Add helpful tc-is-{gcc,clang} wrappers
Date: Wed, 22 Jun 2016 20:09:34
Message-Id: 20160622200654.6961-5-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/4] toolchain-funcs.eclass: fix for version checks (v2) + compiler identification by "Michał Górny"
1 ---
2 eclass/toolchain-funcs.eclass | 14 ++++++++++++++
3 1 file changed, 14 insertions(+)
4
5 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
6 index 116bc43..00dec40 100644
7 --- a/eclass/toolchain-funcs.eclass
8 +++ b/eclass/toolchain-funcs.eclass
9 @@ -604,6 +604,20 @@ tc-get-compiler-type() {
10 fi
11 }
12
13 +# @FUNCTION: tc-is-gcc
14 +# @DESCRIPTION:
15 +# Return true if the current compiler is pure GCC.
16 +tc-is-gcc() {
17 + [[ $(tc-get-compiler-type) == gcc ]]
18 +}
19 +
20 +# @FUNCTION: tc-is-clang
21 +# @DESCRIPTION:
22 +# Return true if the current compiler is clang.
23 +tc-is-clang() {
24 + [[ $(tc-get-compiler-type) == clang ]]
25 +}
26 +
27 # Internal func. The first argument is the version info to expand.
28 # Query the preprocessor to improve compatibility across different
29 # compilers rather than maintaining a --version flag matrix. #335943
30 --
31 2.9.0

Replies