public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 2/2] eclass/toolchain-funcs: add clang version functions
@ 2016-06-27 22:04 Austin English
  2016-07-01 20:02 ` Michał Górny
  0 siblings, 1 reply; 6+ messages in thread
From: Austin English @ 2016-06-27 22:04 UTC (permalink / raw
  To: toolchain; +Cc: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1804 bytes --]

From ec0be3d1a808ea0c5bdd081a4bb935f86bf78d44 Mon Sep 17 00:00:00 2001
From: Austin English <wizardedit@gentoo.org>
Date: Mon, 27 Jun 2016 16:58:07 -0500
Subject: [PATCH 2/2] eclass/toolchain-funcs: add clang version functions

Signed-off-by: Austin English <wizardedit@gentoo.org>
---
 eclass/toolchain-funcs.eclass | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index fb8b2f9..9bb5232 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -642,6 +642,39 @@ gcc-micro-version() {
 	_gcc_fullversion '$3' "$@"
 }

+# Internal func. Based on _gcc_fullversion() above.
+_clang_fullversion() {
+	local ver="$1"; shift
+	set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__
__clang_patchlevel__")
+	eval echo "$ver"
+}
+
+# @FUNCTION: clang-fullversion
+# @RETURN: compiler version (major.minor.micro: [3.4.6])
+clang-fullversion() {
+	_clang_fullversion '$1.$2.$3' "$@"
+}
+# @FUNCTION: clang-version
+# @RETURN: compiler version (major.minor: [3.4].6)
+clang-version() {
+	_clang_fullversion '$1.$2' "$@"
+}
+# @FUNCTION: clang-major-version
+# @RETURN: major compiler version (major: [3].4.6)
+clang-major-version() {
+	_clang_fullversion '$1' "$@"
+}
+# @FUNCTION: clang-minor-version
+# @RETURN: minor compiler version (minor: 3.[4].6)
+clang-minor-version() {
+	_clang_fullversion '$2' "$@"
+}
+# @FUNCTION: clang-micro-version
+# @RETURN: micro compiler version (micro: 3.4.[6])
+clang-micro-version() {
+	_clang_fullversion '$3' "$@"
+}
+
 # Returns the installation directory - internal toolchain
 # function for use by _gcc-specs-exists (for flag-o-matic).
 _gcc-install-dir() {
-- 
2.7.3



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-05 17:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-27 22:04 [gentoo-dev] [PATCH 2/2] eclass/toolchain-funcs: add clang version functions Austin English
2016-07-01 20:02 ` Michał Górny
2016-07-05  0:16   ` Austin English
2016-07-05  5:00     ` Michał Górny
2016-07-05  6:08       ` Austin English
2016-07-05 17:47         ` waltdnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox